From f85172f141a2d1ea1978d8e08a25f656f4b31d83 Mon Sep 17 00:00:00 2001 From: Levko Kravets Date: Mon, 29 Apr 2024 23:55:38 +0300 Subject: [PATCH] Adjust Typescript configs for building and linting scenarios Signed-off-by: Levko Kravets --- package.json | 4 ++-- tsconfig.build.json | 8 ++++++++ tsconfig.json | 15 +++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index da6ecf32..f379670a 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "e2e": "nyc --reporter=lcov --report-dir=${NYC_REPORT_DIR:-coverage_e2e} mocha --config tests/e2e/.mocharc.js", "test": "nyc --reporter=lcov --report-dir=${NYC_REPORT_DIR:-coverage_unit} mocha --config tests/unit/.mocharc.js", "update-version": "node bin/update-version.js && prettier --write ./lib/version.ts", - "build": "npm run update-version && tsc", - "watch": "tsc -w", + "build": "npm run update-version && tsc --project tsconfig.build.json", + "watch": "tsc --project tsconfig.build.json --watch", "type-check": "tsc --noEmit", "prettier": "prettier . --check", "prettier:fix": "prettier . --write", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000..7b375312 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/" /* Redirect output structure to the directory. */, + "rootDir": "./lib/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + }, + "exclude": ["./tests/**/*", "./dist/**/*"] +} diff --git a/tsconfig.json b/tsconfig.json index 030f8cfa..43e7eae2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,12 @@ { "compilerOptions": { - "target": "ES6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + "target": "ES6", + "module": "commonjs", "declaration": true, "sourceMap": true, - "outDir": "./dist/" /* Redirect output structure to the directory. */, - "rootDir": "./lib/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, - "strict": true /* Enable all strict type-checking options. */, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } + "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": ["./dist/**/*"] }