-
Notifications
You must be signed in to change notification settings - Fork 74
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
chore: add typescript declarations to .gitignore #2665
base: master
Are you sure you want to change the base?
Conversation
When `npm`-`link`-ing Endo against external projects, the types are not resolvable without first building the declaration files (unlike how types are resolved within the project itself). This requires compiling declaration files in the appropriate Endo workspaces and re-running as needed. Previously, all generated declaration files (and their sourcemaps) were recognized as unstaged new files by Git, which is incredibly annoying when trying to see what changes have been made to Endo sources. This change adds declaration files, their sourcemaps and any build cache files (`*.tsbuildinfo`) to Git's ignorelist. Caveats: - Any future declaration files which need to be under version control must be force-added - When publishing, `npm`'s default behavior is to skip ignored files unless they are present in a `package.json`'s `files` array. I believe this is already configured correctly, but future packages must maintain the same strategy. I recommend carefully examining the output of `npm pack --dry-run` before the next publish to avoid regressions in the list of published artifacts.
(Yes, this change is basically just for me) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a lot of manually authored .d.ts
files so a blanket ignore of them is not ok. In general I wish we had a CI job to verify that any files in the repo are not currently excluded by the gitignore config, as it's a pain to manage files "force added"
I believe @kriskowal has some commands to verify no regression here that I'd like to see the output of before approving a merge. |
@mhofman I feel like the concern may be overblown.
We aren't really adding a ton of these on a regular basis. |
This should surface everything to be published: npm pack --workspaces --json --dry-run So we can diff the output of that |
One way forward is to have a consistent module name for hand-written types and make that an exclusion in gitignore. |
Some tests are failing because
UPDATE: |
This changes the `postpack` scripts to use the `-X` flag of `git clean`, which only considers ignored files.
@turadg Since I was touching the |
As @turadg mentioned, while we may not have a lot of these manual definition files currently, I would really like them to be excluded one way or another from being ignored. Force added files are a pain to deal with. |
*.d.ts* | ||
*.d.[mc]ts* | ||
*.tsbuildinfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
npm
-link
-ing Endo against external projects, the types are not resolvable without first building the declaration files (unlike how types are resolved within the project itself). This requires compiling declaration files in the appropriate Endo workspaces and re-running as needed.Previously, all generated declaration files (and their sourcemaps) were recognized as unstaged new files by Git, which is incredibly annoying when trying to see what changes have been made to Endo sources.
This change adds declaration files, their sourcemaps and any build cache files (
*.tsbuildinfo
) to Git's ignorelist.Caveats:
npm
's default behavior is to skip ignored files unless they are present in apackage.json
'sfiles
array. I believe this is already configured correctly, but future packages must maintain the same strategy. I recommend carefully examining the output ofnpm pack --dry-run
before the next publish to avoid regressions in the list of published artifacts.An example of my workflow is something like this:
npm link -w @endo/compartment-mapper \ -w ses \ -w @endo/env-options \ -w @endo/cjs-module-analyzer \ -w @endo/static-module-record \ -w @endo/zip \ -w @endo/evasive-transform cd /path/to/lavamoat npm link @endo/compartment-mapper \ ses \ @endo/env-options \ @endo/cjs-module-analyzer \ @endo/static-module-record \ @endo/zip \ @endo/evasive-transform
At this point, my build will fail because the type declarations I need are missing. So I need to:
cd /path/to/endo npm run prepack -w @endo/compartment-mapper -w ses
This will generate the declarations I need, but
git status
results in:...which is annoying if I have actual changes in Endo!