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 .relative-deps-ignore option, to solve double rebuild in TS / other compiled or built repos #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vpiskunov
Copy link

This resolves #55 - Watch mode rebuilds multiple times.

The cause was that dist directory was not ignored for change detection.

This PR adds not just "static" dist directory ignore, but a flexible option of adding .relative-deps-ignore file into the Lib directory, to then specify !dist for example.

  • Works with multiple lines to specify multiple ignored dirs (!build, !.output)
  • Supports comments in .relative-deps-ignore (anything after # on any given line is ignored/skipped)
  • Readme updated to describe this option.

Please review & should be safe to merge! @mweststrate

index.js Outdated Show resolved Hide resolved
Comment on lines +87 to +90
? fs.readFileSync(relativeDepsIgnoreFile, "utf8")
.split("\n")
.filter(line => line.trim() && !line.trim().startsWith('#'))
.map(line => line.split('#')[0])
Copy link
Collaborator

Choose a reason for hiding this comment

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

So in addition to checking that the file exists, there may be other causes of errors in reading the file contents (such as a lack of permissions, or the file may be huge and fail to be read into memory or a number of other issues).
To mitigate that, at the very least this block needs to be wrapped in try/catch. But instead of trying to mitigate all possible issues here, I'm sure there's a package which handles reading/parsing .gitignore format instead.

Co-authored-by: Nick Ribal <[email protected]>
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.

Watch mode rebuilds multiple times - resulting in the smallest lib taking 15s to be updated
3 participants