diff --git a/packages/cheatsheet-local/tsconfig.json b/packages/cheatsheet-local/tsconfig.json index 475cd01504..34703aa242 100644 --- a/packages/cheatsheet-local/tsconfig.json +++ b/packages/cheatsheet-local/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "rootDir": "src", - "outDir": "out", "jsx": "react-jsx", "lib": ["es5", "es6", "dom"], "allowSyntheticDefaultImports": true, diff --git a/packages/cheatsheet/tsconfig.json b/packages/cheatsheet/tsconfig.json index 3f3069efcd..e73c1b1ccc 100644 --- a/packages/cheatsheet/tsconfig.json +++ b/packages/cheatsheet/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "rootDir": "src", - "outDir": "out", "jsx": "react-jsx", "esModuleInterop": true, "skipLibCheck": true, diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json index 159bdc3aaa..984fd3bbe5 100644 --- a/packages/common/tsconfig.json +++ b/packages/common/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src" - }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [] } diff --git a/packages/cursorless-cheatsheet/tsconfig.json b/packages/cursorless-cheatsheet/tsconfig.json index f95ec8ae56..28f94c07f4 100644 --- a/packages/cursorless-cheatsheet/tsconfig.json +++ b/packages/cursorless-cheatsheet/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src" - }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ { diff --git a/packages/cursorless-engine/tsconfig.json b/packages/cursorless-engine/tsconfig.json index dd65e3b18f..82daced7ae 100644 --- a/packages/cursorless-engine/tsconfig.json +++ b/packages/cursorless-engine/tsconfig.json @@ -1,9 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "target": "es2020", - "outDir": "out", - "rootDir": "src" + "target": "es2020" }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ diff --git a/packages/cursorless-org-docs/tsconfig.json b/packages/cursorless-org-docs/tsconfig.json index 0c1f97ebfa..2fe0fedcef 100644 --- a/packages/cursorless-org-docs/tsconfig.json +++ b/packages/cursorless-org-docs/tsconfig.json @@ -1,10 +1,8 @@ { "extends": ["@tsconfig/docusaurus/tsconfig.json", "../../tsconfig.base.json"], "compilerOptions": { - "rootDir": "src", "esModuleInterop": true, - "emitDeclarationOnly": false, - "outDir": "out" + "emitDeclarationOnly": false }, "references": [], "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"] diff --git a/packages/cursorless-org/tsconfig.json b/packages/cursorless-org/tsconfig.json index 1c78f7cd34..2ce4454b4f 100644 --- a/packages/cursorless-org/tsconfig.json +++ b/packages/cursorless-org/tsconfig.json @@ -11,9 +11,7 @@ "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", - "incremental": true, - "rootDir": "src", - "outDir": "out" + "incremental": true }, "include": [ "src/**/*.ts", diff --git a/packages/cursorless-vscode-e2e/tsconfig.json b/packages/cursorless-vscode-e2e/tsconfig.json index 08759df0cd..01add93940 100644 --- a/packages/cursorless-vscode-e2e/tsconfig.json +++ b/packages/cursorless-vscode-e2e/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src" - }, "references": [ { "path": "../common" diff --git a/packages/cursorless-vscode/tsconfig.json b/packages/cursorless-vscode/tsconfig.json index 71228f1ab6..7c49aa7bd2 100644 --- a/packages/cursorless-vscode/tsconfig.json +++ b/packages/cursorless-vscode/tsconfig.json @@ -1,9 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "target": "es2020", - "outDir": "out", - "rootDir": "src" + "target": "es2020" }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ diff --git a/packages/meta-updater/src/updateTSConfig.ts b/packages/meta-updater/src/updateTSConfig.ts index ab9bd240ea..36c07f5f7a 100644 --- a/packages/meta-updater/src/updateTSConfig.ts +++ b/packages/meta-updater/src/updateTSConfig.ts @@ -5,7 +5,7 @@ import { pathExists } from "path-exists"; import { PackageJson, TsConfigJson } from "type-fest"; import { toPosixPath } from "./toPosixPath"; import { Context } from "./Context"; -import { uniq } from "lodash-es"; +import { cloneDeep, isEqual, uniq } from "lodash-es"; import { readFile } from "fs/promises"; /** @@ -89,14 +89,18 @@ export async function updateTSConfig( references.push({ path: relativePath }); } + const compilerOptions = { + ...(cloneDeep(input.compilerOptions) ?? {}), + }; + delete compilerOptions.outDir; + delete compilerOptions.rootDir; + return { ...input, extends: getExtends(pathFromPackageToRoot, input.extends), - compilerOptions: { - ...(input.compilerOptions ?? {}), - rootDir: "src", - outDir: "out", - }, + + ...(isEqual(compilerOptions, {}) ? {} : { compilerOptions }), + references: references.sort((r1, r2) => r1.path.localeCompare(r2.path)), include: [ "src/**/*.ts", diff --git a/packages/meta-updater/tsconfig.json b/packages/meta-updater/tsconfig.json index c1beb312b7..4bd3b640a8 100644 --- a/packages/meta-updater/tsconfig.json +++ b/packages/meta-updater/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "out", - "rootDir": "src", "target": "es2020", "module": "ES2020", "moduleResolution": "node", diff --git a/packages/node-common/tsconfig.json b/packages/node-common/tsconfig.json index f29b56f5fa..0f90f239b4 100644 --- a/packages/node-common/tsconfig.json +++ b/packages/node-common/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "out" - }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ { diff --git a/packages/sentence-parser/tsconfig.json b/packages/sentence-parser/tsconfig.json index cea565539b..1eba1fa892 100644 --- a/packages/sentence-parser/tsconfig.json +++ b/packages/sentence-parser/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "out" - }, "references": [], "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"] } diff --git a/packages/test-case-recorder/tsconfig.json b/packages/test-case-recorder/tsconfig.json index 00219117a8..d66e443d06 100644 --- a/packages/test-case-recorder/tsconfig.json +++ b/packages/test-case-recorder/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "out" - }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ { diff --git a/packages/test-harness/tsconfig.json b/packages/test-harness/tsconfig.json index f95ec8ae56..28f94c07f4 100644 --- a/packages/test-harness/tsconfig.json +++ b/packages/test-harness/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src" - }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ { diff --git a/packages/vscode-common/tsconfig.json b/packages/vscode-common/tsconfig.json index 31f84660d6..457f525704 100644 --- a/packages/vscode-common/tsconfig.json +++ b/packages/vscode-common/tsconfig.json @@ -1,9 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "target": "es2020", - "outDir": "out", - "rootDir": "src" + "target": "es2020" }, "include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"], "references": [ diff --git a/tsconfig.base.json b/tsconfig.base.json index f31610dd3f..e5fedcda52 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -11,6 +11,8 @@ "composite": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, - "strict": true + "strict": true, + "rootDir": "${configDir}/src", + "outDir": "${configDir}/out" } }