Skip to content

Commit

Permalink
chore: add TS-generated files to gitignore
Browse files Browse the repository at this point in the history
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.**

## Escape Hatch

Sometimes it's helpful to keep declarations under version control.  To that end, any _new_ declaration file that needs to be tracked should match `^.+\.types\.d\.[mc]?ts$`. Example: `foo.types.d.ts`. This will avoid the need to force-add the file to Git.

## Notes

- To avoid the need to rename files (e.g., the various `types.js` files amongst the workspaces), the pattern `^types.*\.d\.[mc]?ts$` was **not** chosen.
- If the need arises to track a directory full of declaration files, another convention can be established and appended to the ignorefile.
- All `clean` scripts will need to be updated, since `git clean` needs another flag (`-X`) to delete _ignored_ files.
  • Loading branch information
boneskull committed Jan 17, 2025
1 parent 630592d commit 9fdc940
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,15 @@ dist/
api-docs

.aider*

# ts build cache
*.tsbuildinfo

# ignore all declarations and mappings, but whitelist allow matching the "*.types.d{m,c,t}s"
# convention below to make it easier to track new declaration files as needed
*.d.ts*
*.d.mts*
*.d.cts*
!*.types.d.ts
!*.types.d.mts
!*.types.d.cts

0 comments on commit 9fdc940

Please sign in to comment.