From 12b4abd5d1e3572dc1d6336a63d3408170d7fed1 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 | 6 +++++- tsconfig.lib.json | 5 ----- 4 files changed, 8 insertions(+), 9 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..b425a5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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"] }