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

add ts-clean script #10156

Merged
merged 6 commits into from
Sep 24, 2021
Merged

add ts-clean script #10156

merged 6 commits into from
Sep 24, 2021

Conversation

paul-marechal
Copy link
Member

When doing refactorings, one might end up renaming/deleting TypeScript
source files. But if a build was run previously, the outputted
JavaScript files will still be in the build output folder. Then
extensions that depend on the refactored package will not fail to build
because the old path still resolves to the lingering JavaScript files.

Add ts-clean script that deletes all generated files without a
corresponding source file.

Add the missing compile script to most packages.

How to test

  • Build those changes.
  • Rename a TypeScript file to something new.
  • Run npx ts-clean dev-packages/* packages/* --dry.
  • The tool should prompt about a missing source file and deleting generated files.

The tool supports a --watch (-w) mode, use --dry to only get logs without touching the fs.

Review checklist

Reminder for reviewers

@paul-marechal paul-marechal added quality issues related to code and application quality contributor experience issues related to the contributor experience labels Sep 23, 2021
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I believe the CI error is simply because @theia/timeline incorrectly does not have a package.spec.ts so it fails to execute it's tests.

@paul-marechal
Copy link
Member Author

@vince-fugnitto CI is fixed \o/

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

The changes look good to me, removing/moving a file now correctly leads to typescript compilation errors due to the removed .js files.

When doing refactorings, one might end up renaming/deleting TypeScript
source files. But if a build was run previously, the outputted
JavaScript files will still be in the build output folder. Then
extensions that depend on the refactored package will not fail to build
because the old path still resolves to the lingering JavaScript files.

Add `ts-clean` script that deletes all generated files without a
corresponding source file.

Add the missing `compile` script to most packages.
@paul-marechal paul-marechal merged commit a585804 into master Sep 24, 2021
@paul-marechal paul-marechal deleted the mp/smart-clean branch September 24, 2021 18:11
@github-actions github-actions bot added this to the 1.18.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor experience issues related to the contributor experience quality issues related to code and application quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants