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

Fix output for TS Build Info File in TypeScript recipe #905

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TimonVS
Copy link

@TimonVS TimonVS commented Oct 3, 2023

TS Build Info File is usually named <config name>.tsbuildInfo (e.g., tsconfig.tsbuildinfo). I had a weird issue where some files would go missing from the outDir, this occurred when I had a compilation error, and then I would fix the compilation error. The video below demonstrates the issue, you'll notice at the end that only foo.ts gets output to foo.js, index.js and math.js are missing completely. Changing .tsbuildinfo to *.tsbuildinfo (or tsconfig.tsbuildinfo) fixed the issue for me.

CleanShot.2023-10-03.at.11.38.53.mp4

TS Build Info File is usually named `<config name>.tsbuildInfo` (e.g., `tsconfig.tsbuildinfo`). The previous configuration wouldn't clean up the TS Build Info File, causing some TS files not to be output after fixing a compilation error.
@google-cla
Copy link

google-cla bot commented Oct 3, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@aomarks
Copy link
Member

aomarks commented Oct 3, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull reques

Thanks for the PR @TimonVS! Would you be able to sign the Google CLA? We are required to only accept pull requests from contributors who have signed this CLA. Thank you!

@augustjk
Copy link
Collaborator

augustjk commented Oct 6, 2023

Fixes #505

@@ -764,7 +764,7 @@ This section contains advice about integrating specific build tools with Wireit.
"command": "tsc --build --pretty",
"clean": "if-file-deleted",
"files": ["src/**/*.ts", "tsconfig.json"],
"output": ["lib/**", ".tsbuildinfo"]
"output": ["lib/**", "*.tsbuildinfo"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're going by default behavior, this might be better. See #505 (comment)

Suggested change
"output": ["lib/**", "*.tsbuildinfo"]
"output": ["lib/**", "lib/tsconfig.tsbuildinfo"]

Copy link
Author

Choose a reason for hiding this comment

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

My tsconfig.tsbuildinfo file doesn't get output to the output folder. And otherwise it would have been included by the lib/** glob, right? I chose to use *.tsbuildinfo specifically because the name of the file can be different depending on your tsconfig.json. See: https://www.typescriptlang.org/tsconfig#tsBuildInfoFile.

Copy link
Member

Choose a reason for hiding this comment

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

@augustjk Did you happen to double check the default behavior here already?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just tested now. Seems like I was mistaken, but so is the doc linked above.

If outDir is set, then the default is <outDir>/<config name>.tsbuildInfo

But I observed tsconfig.tsbuildinfo being generated next to the config file, not inside the <outDir>.

I retract the suggestion.

Copy link
Collaborator

@augustjk augustjk Oct 12, 2023

Choose a reason for hiding this comment

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

Ooohhh nevermind, I also had rootDir set.

If rootDir and outDir are set, then the file is <outDir>/<relative path to config from rootDir>/<config name>.tsbuildinfo

This rule pulled it back out. It's hard to say what's correct here as it's highly dependent on the user's tsconfig that we're not showing in the example. I am happy with *.tsbuildinfo. Especially considering my suggestion is redundant with the lib/** glob.

@augustjk augustjk linked an issue Oct 6, 2023 that may be closed by this pull request
@TimonVS
Copy link
Author

TimonVS commented Oct 11, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull reques

Thanks for the PR @TimonVS! Would you be able to sign the Google CLA? We are required to only accept pull requests from contributors who have signed this CLA. Thank you!

I have accepted the CLA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ts example "typo"?
3 participants