From 3bcd7cbb331d6703bcf12f9a8c38e64852ea4c09 Mon Sep 17 00:00:00 2001 From: SimeonC <1085899+SimeonC@users.noreply.github.com> Date: Tue, 3 Oct 2023 11:58:29 +0900 Subject: [PATCH] ci: fix builds with tsconfig dancing --- .eslintrc.js | 2 +- .github/workflows/release.yml | 2 +- .gitignore | 2 -- packages/audit/tsconfig.build.json | 6 ++++-- packages/audit/tsconfig.json | 4 +++- packages/eslint-config/tsconfig.build.json | 2 +- packages/eslint-config/tsconfig.json | 4 +++- packages/eslint-plugin/tsconfig.build.json | 2 +- packages/eslint-plugin/tsconfig.json | 4 +++- packages/nx/src/generators/quality/eslintConfig.ts | 2 +- packages/nx/tsconfig.json | 4 +++- packages/semantic-release-config/tsconfig.json | 4 +++- packages/utils/tsconfig.json | 4 +++- tsconfig.base.json | 2 -- tsconfig.eslint.json | 8 ++++++++ tsconfig.json | 7 ++----- 16 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 tsconfig.eslint.json diff --git a/.eslintrc.js b/.eslintrc.js index d79f3cd0..89f12487 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { node: true, }, parserOptions: { - project: './tsconfig.base.json', + project: './tsconfig.eslint.json', }, overrides: [ { diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30e48ddb..0f4e22fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,4 +26,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} - run: npx auto shipit + run: npx auto shipit --verbose diff --git a/.gitignore b/.gitignore index 64046a71..edf7ee25 100644 --- a/.gitignore +++ b/.gitignore @@ -22,8 +22,6 @@ junit .env.test.local .env.production.local .@tablecheck -tsconfig.compound.json /packages/quality/build.config.ts /packages/utils/build.config.ts -/tsconfig.eslint.json /packages/utils/config diff --git a/packages/audit/tsconfig.build.json b/packages/audit/tsconfig.build.json index 2b235aea..345efca6 100644 --- a/packages/audit/tsconfig.build.json +++ b/packages/audit/tsconfig.build.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "./tsconfig.json", "include": [ "src/**/*.ts", "src/**/*.tsx", @@ -13,7 +13,9 @@ "rootDir": "src", "outDir": "dist", "paths": {}, - "module": "NodeNext" + "module": "NodeNext", + + "resolveJsonModule": true }, "exclude": ["node_modules"], "files": [] diff --git a/packages/audit/tsconfig.json b/packages/audit/tsconfig.json index 05395298..7bef2bad 100644 --- a/packages/audit/tsconfig.json +++ b/packages/audit/tsconfig.json @@ -11,7 +11,9 @@ "compilerOptions": { "baseUrl": ".", "rootDir": "src", - "outDir": "dist" + "outDir": "dist", + "module": "NodeNext", + "resolveJsonModule": true }, "exclude": ["node_modules"], "files": [] diff --git a/packages/eslint-config/tsconfig.build.json b/packages/eslint-config/tsconfig.build.json index 6024a5a2..6e4a0137 100644 --- a/packages/eslint-config/tsconfig.build.json +++ b/packages/eslint-config/tsconfig.build.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "./tsconfig.json", "include": [ "src/**/*.ts", "src/**/*.tsx", diff --git a/packages/eslint-config/tsconfig.json b/packages/eslint-config/tsconfig.json index 8042def6..61a9029f 100644 --- a/packages/eslint-config/tsconfig.json +++ b/packages/eslint-config/tsconfig.json @@ -12,7 +12,9 @@ "rootDir": "src", "outDir": "dist", "paths": {}, - "types": ["vitest"] + "types": ["vitest"], + "module": "NodeNext", + "resolveJsonModule": true }, "exclude": ["node_modules"], "files": [] diff --git a/packages/eslint-plugin/tsconfig.build.json b/packages/eslint-plugin/tsconfig.build.json index 6024a5a2..6e4a0137 100644 --- a/packages/eslint-plugin/tsconfig.build.json +++ b/packages/eslint-plugin/tsconfig.build.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "./tsconfig.json", "include": [ "src/**/*.ts", "src/**/*.tsx", diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 8042def6..b9618182 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -12,7 +12,9 @@ "rootDir": "src", "outDir": "dist", "paths": {}, - "types": ["vitest"] + "types": ["vitest"], + "module": "NodeNext", + "moduleResolution": "NodeNext" }, "exclude": ["node_modules"], "files": [] diff --git a/packages/nx/src/generators/quality/eslintConfig.ts b/packages/nx/src/generators/quality/eslintConfig.ts index 0db5078a..4835f546 100644 --- a/packages/nx/src/generators/quality/eslintConfig.ts +++ b/packages/nx/src/generators/quality/eslintConfig.ts @@ -20,7 +20,7 @@ export function generateEslintConfig(tree: Tree, projectName: string) { const { projectRoot } = getNxProjectRoot(tree, projectName); const projectTsConfigs = getConfigs(projectRoot) - .map((tsConfig) => path.relative(tree.root, tsConfig)) + .map((tsConfig) => `'${path.relative(tree.root, tsConfig)}'`) .join(',') || '/* could not detect tsconfig.json files, manually set them here */'; const fileContent = ` diff --git a/packages/nx/tsconfig.json b/packages/nx/tsconfig.json index 09a11c71..76874c91 100644 --- a/packages/nx/tsconfig.json +++ b/packages/nx/tsconfig.json @@ -12,7 +12,9 @@ "compilerOptions": { "baseUrl": ".", "rootDir": "src", - "outDir": "dist" + "outDir": "dist", + "module": "NodeNext", + "resolveJsonModule": true }, "exclude": [ "node_modules", diff --git a/packages/semantic-release-config/tsconfig.json b/packages/semantic-release-config/tsconfig.json index 0569ad89..04bdceb1 100644 --- a/packages/semantic-release-config/tsconfig.json +++ b/packages/semantic-release-config/tsconfig.json @@ -11,7 +11,9 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "paths": {} + "paths": {}, + "module": "NodeNext", + "resolveJsonModule": true }, "exclude": ["node_modules"], "files": [] diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 0569ad89..04bdceb1 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -11,7 +11,9 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "paths": {} + "paths": {}, + "module": "NodeNext", + "resolveJsonModule": true }, "exclude": ["node_modules"], "files": [] diff --git a/tsconfig.base.json b/tsconfig.base.json index d68d7f49..2077c889 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -5,13 +5,11 @@ "sourceMap": true, "declaration": true, "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, "emitDecoratorMetadata": true, "esModuleInterop": true, "experimentalDecorators": true, "importHelpers": true, "target": "ES2022", - "module": "NodeNext", "lib": ["es2020", "dom"], "skipLibCheck": true, "skipDefaultLibCheck": true, diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 00000000..5454fdce --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "resolveJsonModule": true, + "module": "NodeNext" + }, + "exclude": ["node_modules", "tmp"] +} diff --git a/tsconfig.json b/tsconfig.json index ee221c91..f1bd9965 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,4 @@ { - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "CommonJS" - }, - "exclude": ["node_modules", "tmp"] + "include": ["this file is just for auto-rc to work correctly..."], + "exclude": ["**/*"] }