diff --git a/doc-gen/tsconfig.json b/doc-gen/tsconfig.json index 6f30f323..39113d76 100644 --- a/doc-gen/tsconfig.json +++ b/doc-gen/tsconfig.json @@ -1,7 +1,4 @@ { - "extends": "../tsconfig.json", - "compilerOptions": { - "sourceMap": false - } + "extends": "../tsconfig.base.json" } diff --git a/lib/tsconfig.base.json b/lib/tsconfig.base.json new file mode 100644 index 00000000..afc054e6 --- /dev/null +++ b/lib/tsconfig.base.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "declaration": true, + "strict": true, + } +} + diff --git a/lib/tsconfig.dev.json b/lib/tsconfig.dev.json new file mode 100644 index 00000000..62ee3e17 --- /dev/null +++ b/lib/tsconfig.dev.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "inlineSources": true, + "sourceMap": true + } +} + diff --git a/lib/tsconfig.dist.json b/lib/tsconfig.dist.json new file mode 100644 index 00000000..6396e491 --- /dev/null +++ b/lib/tsconfig.dist.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "inlineSources": false, + "sourceMap": false + } +} + diff --git a/lib/tsconfig.json b/lib/tsconfig.json deleted file mode 100644 index 72c91c7f..00000000 --- a/lib/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "declaration": true, - "strict": true - } -} - diff --git a/package.json b/package.json index 08781134..b6ece3b3 100644 --- a/package.json +++ b/package.json @@ -89,16 +89,15 @@ ], "scripts": { "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' 'test/**/*.js' 'test/**/*.js.map' 'doc-gen/**/*.js' 'doc-gen/**/*.js.map'", - "compile-src": "tsc -p lib --sourceMap false", - "compile-test": "tsc -p test", - "compile-doc": "tsc -p doc-gen", - "compile": "yarn run compile-src && yarn compile-test && yarn compile-doc", + "compile": "tsc -b", + "compile:dist": "tsc -b ./tsconfig.dist.json", "lint:ts": "biome check", "lint:md": "yarn run remark -u remark-preset-lint-consistent .", "lint": "yarn run lint:ts && yarn run lint:md", - "test": "mocha", + "test": "cross-env TS_NODE_PROJECT=./test/tsconfig.json mocha", "build": "yarn run clean && yarn compile && yarn run doc-gen", - "prepublishOnly": "yarn run build", + "build:dist": "yarn run clean && yarn compile:dist && yarn run doc-gen", + "prepublishOnly": "yarn run build:dist", "test-coverage": "c8 yarn run test", "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage", "doc-gen": "yarn node doc-gen/gen.js", @@ -128,6 +127,7 @@ "c8": "^10.1.3", "chai": "^6.0.1", "chai-as-promised": "^8.0.2", + "cross-env": "^10.0.0", "del-cli": "^6.0.0", "mime": "^4.1.0", "mocha": "^11.7.2", diff --git a/test/tsconfig.base.json b/test/tsconfig.base.json new file mode 100644 index 00000000..60162be0 --- /dev/null +++ b/test/tsconfig.base.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "types": ["mocha", "node"], + "strict": false + } +} + diff --git a/test/tsconfig.dist.json b/test/tsconfig.dist.json new file mode 100644 index 00000000..d5cab7a7 --- /dev/null +++ b/test/tsconfig.dist.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "inlineSources": false, + "sourceMap": false + } +} + diff --git a/test/tsconfig.json b/test/tsconfig.json index 0fc8832c..62ee3e17 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -1,8 +1,8 @@ { - "extends": "../tsconfig.json", + "extends": "./tsconfig.base.json", "compilerOptions": { - "types": ["mocha", "node"], - "strict": false + "inlineSources": true, + "sourceMap": true } } diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000..eb4007d9 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "node16", + "moduleResolution": "node16", + "target": "ES2020", + "esModuleInterop": true, + "baseUrl": ".", + "erasableSyntaxOnly": true, + "libReplacement": false, + } +} diff --git a/tsconfig.dist.json b/tsconfig.dist.json new file mode 100644 index 00000000..72967cab --- /dev/null +++ b/tsconfig.dist.json @@ -0,0 +1,8 @@ +{ + "files": [], + "references": [ + { "path": "./lib/tsconfig.dist.json" }, + { "path": "./test/tsconfig.dist.json" }, + { "path": "./doc-gen/tsconfig.json" } + ] +} diff --git a/tsconfig.json b/tsconfig.json index 32aa60f4..ff425098 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,8 @@ { - "compilerOptions": { - "inlineSources": false, - "module": "node16", - "moduleResolution": "node16", - "target": "ES2020", - "esModuleInterop": true, - "baseUrl": ".", - "erasableSyntaxOnly": true, - "libReplacement": false, - } + "files": [], + "references": [ + { "path": "./lib/tsconfig.dev.json" }, + { "path": "./test/tsconfig.json" }, + { "path": "./doc-gen/tsconfig.json" } + ] } diff --git a/yarn.lock b/yarn.lock index e7c658d3..8fdcd06d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -144,6 +144,13 @@ __metadata: languageName: node linkType: hard +"@epic-web/invariant@npm:^1.0.0": + version: 1.0.0 + resolution: "@epic-web/invariant@npm:1.0.0" + checksum: 10c0/72dbeb026e4e4eb3bc9c65739b91408ca77ab7d603a2494fa2eff3790ec22892c4caba751cffdf30f5ccf0e7ba79c1e9c96cf0a357404b9432bf1365baac23ca + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -917,6 +924,19 @@ __metadata: languageName: node linkType: hard +"cross-env@npm:^10.0.0": + version: 10.0.0 + resolution: "cross-env@npm:10.0.0" + dependencies: + "@epic-web/invariant": "npm:^1.0.0" + cross-spawn: "npm:^7.0.6" + bin: + cross-env: dist/bin/cross-env.js + cross-env-shell: dist/bin/cross-env-shell.js + checksum: 10c0/d16ffc3734106577d57b6253d81ab50294623bd59f96e161033eaf99c1c308ffbaba8463c23a6c0f72e841eff467cb7007a0a551f27554fcf2bbf6598cd828f9 + languageName: node + linkType: hard + "cross-spawn@npm:^7.0.6": version: 7.0.6 resolution: "cross-spawn@npm:7.0.6" @@ -2200,6 +2220,7 @@ __metadata: chai: "npm:^6.0.1" chai-as-promised: "npm:^8.0.2" content-type: "npm:^1.0.5" + cross-env: "npm:^10.0.0" debug: "npm:^4.4.3" del-cli: "npm:^6.0.0" file-type: "npm:^21.0.0"