Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat project references #549

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ dist

# TernJS port file
.tern-port

# IDEs
.vscode
.idea
3 changes: 0 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions template/tsconfig/base/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": ".",
Expand Down
4 changes: 3 additions & 1 deletion template/tsconfig/base/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 6 additions & 4 deletions template/tsconfig/cypress-ct/tsconfig.cypress-ct.json
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not strictly necessary to have the declarations output for anything but the tsconfig.app.json right now, but I think it makes sense to make them all work the same way.

Copy link

@codethief codethief Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Besides, whether or not declarations will be output will change slightly in TypeScript 5.6, see microsoft/TypeScript#32651 (comment)

"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.cypress-ct.tsbuildinfo"
}
},
"references": [
{ "path": "./tsconfig.app.json" }
]
}
14 changes: 0 additions & 14 deletions template/tsconfig/nightwatch-ct/tsconfig.app.json

This file was deleted.

9 changes: 8 additions & 1 deletion template/tsconfig/vitest/tsconfig.vitest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"extends": "./tsconfig.app.json",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this extending the app config, but maybe it's better to make it extend @vue/tsconfig/tsconfig.dom.json directly? That's how I've set it up in my project, makes it easier to manage.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'd argue it's better to keep production and test configs separate (and rather have them extend a common base config), so that people won't e.g. add types to tsconfig.app.json that don't belong in test files.

"include": [
"src/**/__tests__/*"
],
"exclude": [],
"compilerOptions": {
"composite": true,
"outDir": "./node_modules/.tmp/vitest",
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
Copy link

@codethief codethief Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsBuildInfoFile can be removed since now that we set outDir, its default value will be <outDir>/<config name>.tsbuildInfo, compare https://www.typescriptlang.org/tsconfig/#tsBuildInfoFile

Same thing goes for tsBuildInfoFile in the other tsconfigs.


"lib": [],
"types": ["node", "jsdom"]
}
},
"references": [
{ "path": "./tsconfig.app.json" }
]
}