From 7fe89ecf1c354912f701dadbb7dd8abfcbc45035 Mon Sep 17 00:00:00 2001 From: Oleg Shibaev Date: Mon, 5 Aug 2024 01:59:43 +0400 Subject: [PATCH 1/3] feat(typescript): use project references in vitest and cypress tsconfigs --- .gitignore | 4 ++++ template/tsconfig/base/tsconfig.app.json | 3 +++ template/tsconfig/base/tsconfig.node.json | 4 +++- template/tsconfig/cypress-ct/tsconfig.cypress-ct.json | 10 ++++++---- template/tsconfig/vitest/tsconfig.vitest.json | 9 ++++++++- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f7999996..da4198f2 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,7 @@ dist # TernJS port file .tern-port + +# IDEs +.vscode +.idea diff --git a/template/tsconfig/base/tsconfig.app.json b/template/tsconfig/base/tsconfig.app.json index e14c754d..96a1279c 100644 --- a/template/tsconfig/base/tsconfig.app.json +++ b/template/tsconfig/base/tsconfig.app.json @@ -4,6 +4,9 @@ "exclude": ["src/**/__tests__/*"], "compilerOptions": { "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "./node_modules/.tmp/app", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "baseUrl": ".", diff --git a/template/tsconfig/base/tsconfig.node.json b/template/tsconfig/base/tsconfig.node.json index f0940630..22377cb7 100644 --- a/template/tsconfig/base/tsconfig.node.json +++ b/template/tsconfig/base/tsconfig.node.json @@ -9,7 +9,9 @@ ], "compilerOptions": { "composite": true, - "noEmit": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "./node_modules/.tmp/node", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "module": "ESNext", diff --git a/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json b/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json index 12833b27..8137b87e 100644 --- a/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json +++ b/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json @@ -1,15 +1,17 @@ { "extends": "./tsconfig.app.json", "include": [ - "env.d.ts", - "src/**/*", - "src/**/*.vue", + "src/**/__tests__/*", "cypress/support/component.*", "cypress/support/commands.ts" ], "exclude": [], "compilerOptions": { "composite": true, + "outDir": "./node_modules/.tmp/cypress-ct", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.cypress-ct.tsbuildinfo" - } + }, + "references": [ + { "path": "./tsconfig.app.json" } + ] } diff --git a/template/tsconfig/vitest/tsconfig.vitest.json b/template/tsconfig/vitest/tsconfig.vitest.json index 571995d1..6d59214c 100644 --- a/template/tsconfig/vitest/tsconfig.vitest.json +++ b/template/tsconfig/vitest/tsconfig.vitest.json @@ -1,11 +1,18 @@ { "extends": "./tsconfig.app.json", + "include": [ + "src/**/__tests__/*" + ], "exclude": [], "compilerOptions": { "composite": true, + "outDir": "./node_modules/.tmp/vitest", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo", "lib": [], "types": ["node", "jsdom"] - } + }, + "references": [ + { "path": "./tsconfig.app.json" } + ] } From 86939b8effbb4117c09458c2c92da443786363da Mon Sep 17 00:00:00 2001 From: Oleg Shibaev Date: Mon, 5 Aug 2024 02:01:13 +0400 Subject: [PATCH 2/3] feat(typescript): delete duplicate tsconfig --- index.ts | 3 --- template/tsconfig/nightwatch-ct/tsconfig.app.json | 14 -------------- 2 files changed, 17 deletions(-) delete mode 100644 template/tsconfig/nightwatch-ct/tsconfig.app.json diff --git a/index.ts b/index.ts index f552cfd8..98f4e00f 100755 --- a/index.ts +++ b/index.ts @@ -445,9 +445,6 @@ async function init() { path: './nightwatch/tsconfig.json' }) } - if (needsNightwatchCT) { - render('tsconfig/nightwatch-ct') - } fs.writeFileSync( path.resolve(root, 'tsconfig.json'), JSON.stringify(rootTsConfig, null, 2) + '\n', diff --git a/template/tsconfig/nightwatch-ct/tsconfig.app.json b/template/tsconfig/nightwatch-ct/tsconfig.app.json deleted file mode 100644 index e14c754d..00000000 --- a/template/tsconfig/nightwatch-ct/tsconfig.app.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "@vue/tsconfig/tsconfig.dom.json", - "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], - "exclude": ["src/**/__tests__/*"], - "compilerOptions": { - "composite": true, - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - - "baseUrl": ".", - "paths": { - "@/*": ["./src/*"] - } - } -} From 965871616e323502305c59c8000b0e624dd54197 Mon Sep 17 00:00:00 2001 From: Oleg Shibaev Date: Tue, 6 Aug 2024 03:45:33 +0400 Subject: [PATCH 3/3] feat(typescript): remove redundant tsBuildInfoFile, don't inherit tsconfig.app.json --- template/tsconfig/base/tsconfig.app.json | 2 -- template/tsconfig/base/tsconfig.node.json | 2 -- .../tsconfig/cypress-ct/tsconfig.cypress-ct.json | 10 +++++++--- template/tsconfig/vitest/tsconfig.vitest.json | 15 ++++++++------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/template/tsconfig/base/tsconfig.app.json b/template/tsconfig/base/tsconfig.app.json index 96a1279c..6b3d763f 100644 --- a/template/tsconfig/base/tsconfig.app.json +++ b/template/tsconfig/base/tsconfig.app.json @@ -7,8 +7,6 @@ "noEmit": false, "emitDeclarationOnly": true, "outDir": "./node_modules/.tmp/app", - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "baseUrl": ".", "paths": { "@/*": ["./src/*"] diff --git a/template/tsconfig/base/tsconfig.node.json b/template/tsconfig/base/tsconfig.node.json index 22377cb7..0ff9dcfc 100644 --- a/template/tsconfig/base/tsconfig.node.json +++ b/template/tsconfig/base/tsconfig.node.json @@ -12,8 +12,6 @@ "noEmit": false, "emitDeclarationOnly": true, "outDir": "./node_modules/.tmp/node", - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", - "module": "ESNext", "moduleResolution": "Bundler", "types": ["node"] diff --git a/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json b/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json index 8137b87e..4002dc7d 100644 --- a/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json +++ b/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json @@ -1,15 +1,19 @@ { - "extends": "./tsconfig.app.json", + "extends": "@vue/tsconfig/tsconfig.dom.json", "include": [ "src/**/__tests__/*", "cypress/support/component.*", "cypress/support/commands.ts" ], - "exclude": [], "compilerOptions": { "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, "outDir": "./node_modules/.tmp/cypress-ct", - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.cypress-ct.tsbuildinfo" + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } }, "references": [ { "path": "./tsconfig.app.json" } diff --git a/template/tsconfig/vitest/tsconfig.vitest.json b/template/tsconfig/vitest/tsconfig.vitest.json index 6d59214c..bbf047c2 100644 --- a/template/tsconfig/vitest/tsconfig.vitest.json +++ b/template/tsconfig/vitest/tsconfig.vitest.json @@ -1,14 +1,15 @@ { - "extends": "./tsconfig.app.json", - "include": [ - "src/**/__tests__/*" - ], - "exclude": [], + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["src/**/__tests__/*"], "compilerOptions": { "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, "outDir": "./node_modules/.tmp/vitest", - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo", - + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + }, "lib": [], "types": ["node", "jsdom"] },