From 787163985812f641adcdde3c0fef64586729be1e Mon Sep 17 00:00:00 2001 From: tienduy-nguyen Date: Sun, 2 Apr 2023 09:42:25 +0200 Subject: [PATCH] feat(esm): simplify tsconfig.json --- ava.config.js | 2 +- package.json | 4 ++-- tsconfig.json | 8 ++++++-- tsconfig.lib.json | 5 ----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ava.config.js b/ava.config.js index 2c8a77a..2375ccb 100644 --- a/ava.config.js +++ b/ava.config.js @@ -1,5 +1,5 @@ export default { - require: ['ts-node/register/transpile-only'], + require: ['ts-node/register'], extensions: ['js', 'ts'], files: ['test/**/*.test.{js,ts}'], nodeArguments: ['--experimental-specifier-resolution=node', '--loader=ts-node/esm', '--no-warnings'], diff --git a/package.json b/package.json index 49d77a5..68abf5c 100644 --- a/package.json +++ b/package.json @@ -77,8 +77,8 @@ "scripts": { "fmt": "prettier --color --write \"{*,src/**/*,test/**/*}.{js,ts}\" --cache", "check-fmt": "prettier --list-different \"{*,test/**/*}.{js,ts}\"", - "build-cjs": "node scripts/esbuild-cjs.js && tsc -p ./tsconfig.lib.json --declaration --emitDeclarationOnly --declarationDir lib/cjs && node scripts/casting.js", - "build-esm": "node scripts/esbuild-esm.js && tsc -p ./tsconfig.lib.json --declaration --emitDeclarationOnly --declarationDir lib/esm", + "build-cjs": "node scripts/esbuild-cjs.js && tsc -p ./tsconfig.lib.json --declarationDir lib/cjs && node scripts/casting.js", + "build-esm": "node scripts/esbuild-esm.js && tsc -p ./tsconfig.lib.json --declarationDir lib/esm", "build": "yarn build-cjs && yarn build-esm", "prepublishOnly": "rm -rf lib && yarn build", "test": "ava", diff --git a/tsconfig.json b/tsconfig.json index 6d6f152..ec857f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,8 @@ "noImplicitAny": true, "allowJs": true, "target": "esnext", - "module": "esnext", "lib": ["esnext","dom"], + "module": "nodenext", "moduleResolution": "nodenext", "alwaysStrict": true, "skipLibCheck": true, @@ -16,7 +16,11 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "typeRoots": ["./node_modules/@types", "./@types"] + "typeRoots": ["./node_modules/@types", "./@types"], + "sourceMap": true, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "lib" }, "include": ["src/**/*", "test/**/*.ts"], "exclude": [] diff --git a/tsconfig.lib.json b/tsconfig.lib.json index f19638b..9db49fa 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -1,9 +1,4 @@ { "extends": "./tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "lib", - "sourceMap": true - }, "include": ["src/**/*.ts"] }