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

[cli] Add new options to watcher #173

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

Conversation

RafalFilipek
Copy link

What

  • add --poll / -p option for polling
  • add --ignored / -i option for ignoring specified paths
  • add some default options for watcher based on config used in tailwindcss

Why

--poll option

It was easy to add and maybe someone will need that

--ignored option

This might be useful for big projects / monorepos. Someone might want to ignore node_modules directory. My case was slightly different. Due to unexpected behavior of chokidar lib on Windows, I had to ignore some additional paths. Nevertheless, the case is still valid :)

Additional options
This was copied from https://github.com/tailwindlabs/tailwindcss/blob/60a0ae20176604b9444f95b09cbb1f549702a143/src/cli.js#L846-L854. Since tailwind is widely used, I assumed those settings might serve as nice defaults.

Thank you for your time.

- add `--poll` / `-p` option  for polling 
- add `--ignored` / `-i` option for ignoring specified paths 
- add some default options for watcher based on config used in `tailwindcss`
@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2022

⚠️ No Changeset found

Latest commit: 14ae957

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@RafalFilipek RafalFilipek changed the title Add new options to watcher [cli] Add new options to watcher Jun 30, 2022
watch(filesPattern, { persistent: false })
.on("add", (path) => {
.option(
"-p, --poll",
Copy link
Member

@Andarist Andarist Jul 5, 2022

Choose a reason for hiding this comment

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

are those -p and -i shortcuts matching the Tailwind CLI? Personally, I would not introduce those as we might add some other options in the future and they might be better suited for having those shortcuts (this feels especial;y true about -p)

.on("add", (path) => {
.option(
"-p, --poll",
"Use polling instead of filesystem events when watching"
Copy link
Member

Choose a reason for hiding this comment

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

is there any specific reason to prefer this in certain situations?

ignored,
usePolling: shouldPoll,
interval: shouldPoll ? pollInterval : undefined,
ignoreInitial: true,
Copy link
Member

Choose a reason for hiding this comment

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

this one has been added, right? could you elaborate on why you think it's needed? what kind of issues this can help us avoid?

stabilityThreshold: 50,
pollInterval: pollInterval,
}
: false,
Copy link
Member

Choose a reason for hiding this comment

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

previously we were using true here at all times - any particular reason why this has been changed?

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.

2 participants