Skip to content

Commit

Permalink
chore: adjust build and update deps (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored Aug 15, 2023
1 parent 84e0231 commit 16e6094
Show file tree
Hide file tree
Showing 9 changed files with 1,120 additions and 746 deletions.
3 changes: 1 addition & 2 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
transform: {
'^.+\\.ts$': ['ts-jest', {useESM: true}],
'^.+\\.ts$': ['ts-jest', {tsconfig: './tsconfig.jest.json'}],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
extensionsToTreatAsEsm: ['.ts'],
transformIgnorePatterns: ['node_modules/(?!(@gravity-ui)/)'],
coverageDirectory: './coverage',
collectCoverageFrom: ['src/**/*.ts'],
Expand Down
1,787 changes: 1,076 additions & 711 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 20 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
"description": "",
"license": "MIT",
"type": "module",
"main": "dist/commonjs/index.js",
"types": "dist/types/index.d.ts",
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.js",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"files": [
Expand All @@ -34,33 +39,32 @@
"test": "jest",
"build": "npm run build:clean && run-p build:compile:*",
"build:clean": "rimraf dist",
"build:compile:esm": "tsc",
"build:compile:esm": "tsc -p tsconfig.esm.json",
"build:compile:commonjs": "tsc -p tsconfig.commonjs.json && cp ./templates/package.commonjs.json ./dist/commonjs/package.json",
"build:compile:types": "tsc -p tsconfig.types.json",
"prepublishOnly": "npm run build"
},
"dependencies": {
"htmlescape": "^1.1.1"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@gravity-ui/eslint-config": "^1.0.2",
"@gravity-ui/prettier-config": "^1.0.1",
"@gravity-ui/tsconfig": "^1.0.0",
"@types/express": "^4.17.13",
"@types/htmlescape": "^1.1.1",
"@types/node": "^14",
"@types/jest": "^29.0.0",
"eslint": "^8.23.0",
"jest": "^29.0.2",
"husky": "^8.0.1",
"@types/jest": "^29.5.3",
"eslint": "^8.47.0",
"jest": "^29.6.2",
"husky": "^8.0.3",
"nano-staged": "^0.8.0",
"npm-run-all": "^4.1.5",
"prettier": "2.7.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.0",
"typescript": "^4.8.3"
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
"nano-staged": {
"*.{js,ts}": [
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {createGoogleAnalyticsPlugin} from './google-analytics/index.js';
import {createYandexMetrikaPlugin} from './yandex-metrika/index.js';
import {createLayoutPlugin, LayoutInitOptions} from './layout/index.js';
import {createLayoutPlugin} from './layout/index.js';
import type {LayoutInitOptions} from './layout/index.js';

export function createDefaultPlugins({layout}: {layout: LayoutInitOptions}) {
return [createGoogleAnalyticsPlugin(), createYandexMetrikaPlugin(), createLayoutPlugin(layout)];
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.commonjs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig",
"extends": "./tsconfig.esm",
"compilerOptions": {
"module": "CommonJS",
"outDir": "dist/commonjs"
"outDir": "dist/commonjs",
"verbatimModuleSyntax": false
}
}
9 changes: 9 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"declaration": true,
"outDir": "dist/esm"
},
"include": ["src/**/*.ts"],
"exclude": ["**/__tests__", "**/*.test.ts"]
}
6 changes: 6 additions & 0 deletions tsconfig.jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"verbatimModuleSyntax": false
}
}
9 changes: 3 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"importsNotUsedAsValues": "error",
"verbatimModuleSyntax": true,
"noUncheckedIndexedAccess": true,
"experimentalDecorators": false,
"resolveJsonModule": true,
"outDir": "dist/esm"
},
"include": ["src/**/*.ts"],
"exclude": ["**/__tests__", "**/*.test.ts"]
"resolveJsonModule": true
}
}
8 changes: 0 additions & 8 deletions tsconfig.types.json

This file was deleted.

0 comments on commit 16e6094

Please sign in to comment.