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

fix: Drop default excludes that are exist in includes #643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lbennett-stacki
Copy link

Preserves the intention of users that explicitly specify an included path that may exist in the default excludes list.

For example, the following command should trigger a re-run for any changes in node_modules/linked-dependency, despite node_modules appearing in the default excludes.

tsx watch --include "node_modules/linked-dependency/**/*" src/index.ts

Preserves the intention of users that explicitly specify an included path
that may exist in the default excludes list.

For example, the following command should trigger a re-run for any
changes in node_modules/linked-dependency, despite node_modules
appearing in the default excludes.

```bash
tsx watch --include "node_modules/linked-dependency/**/*" src/index.ts
```
@lbennett-stacki
Copy link
Author

lbennett-stacki commented Aug 31, 2024

I recognise there is probably a better method here, around either:

  1. Resolve all default excluded path patterns, then only remove the paths that match the include pattern.
defaultExcludes = resolveAll(defaultExcludes).filter(exclude => doesNotMatchAnyInclude(exclude));
  1. Manipulating exclude patterns to negate any includes from the excludes list
const includes = ["node_modules/linked-dependency/**/*"];
// results in...
excludes[0] === "**/node_modules/**"
// manipulated into...
excludes[0] === "**/node_modules/!(linked-dependency)/**"

However I think this PR is a simple first step whilst a decision is made by maintainers. If users are setting --include flags, their intention should be preserved, they are also much more likely at this point to understand the include/exclude functionality so can exclude any paths that end up causing issues themselves.

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.

1 participant