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

Make prepack scripts more consistent #1020

Merged
merged 2 commits into from
Oct 15, 2020
Merged

Conversation

joshgummersall
Copy link
Contributor

Somewhere between Typescript 3.5.x and 4.0.x, the behavior of the
compiler changed in a subtle way when using the -b flag.

In 3.5.x, if outDir was removed after a build but
tsconfig.tsbuildinfo remained, running tsc -b again would fully
reproduce outDir. Technically, this is incorrect behavior because the
compiler state should be fully derived from the include/rootDir
files and the tsconfig.tsbuildinfo file.

In 4.0.x, outDir is not reproduced because the compiler properly loads
its state from tsconfig.tsbuildinfo and does not perform any
recompilation.

Why did this affect packages/plugins? The prepack script runs
rimraf lib && tsc -b. In the 3.5.x compiler version, this would
reproduce the lib directory. In 4.0.x, it would not. This, the
packaged set of files does not include the lib directory.

This commit makes prepack scripts more consistent by using npm run clean and npm run build. The clean scripts already properly clean
up both outDir and the tsconfig.tsbuildinfo file.

Somewhere between Typescript 3.5.x and 4.0.x, the behavior of the
compiler changed in a subtle way when using the `-b` flag.

In 3.5.x, if `outDir` was removed after a build but
`tsconfig.tsbuildinfo` remained, running `tsc -b` again would fully
reproduce `outDir`. Technically, this is incorrect behavior because the
compiler state should be fully derived from the `include`/`rootDir`
files and the `tsconfig.tsbuildinfo` file.

In 4.0.x, `outDir` is not reproduced because the compiler properly loads
its state from `tsconfig.tsbuildinfo` and does not perform any
recompilation.

Why did this affect `packages/plugins`? The `prepack` script runs
`rimraf lib && tsc -b`. In the 3.5.x compiler version, this would
reproduce the `lib` directory. In 4.0.x, it would not. This, the
packaged set of files does not include the `lib` directory.

This commit makes `prepack` scripts more consistent by using `npm run
clean` and `npm run build`. The `clean` scripts already properly clean
up both `outDir` and the `tsconfig.tsbuildinfo` file.
@joshgummersall joshgummersall merged commit 24ec3b9 into main Oct 15, 2020
@joshgummersall joshgummersall deleted the jpg/fix-prepack-scripts branch October 15, 2020 21:00
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.

2 participants