Skip to content

Commit

Permalink
docs(watch): document --include flag
Browse files Browse the repository at this point in the history
Co-authored-by: Kingston Tam <web@ktam.org>
  • Loading branch information
privatenumber and kingston committed Oct 16, 2024
1 parent 375e39a commit 315d5f4
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions docs/watch-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,30 @@ By default, _tsx_ watches all imported files, except those in the following dire
- `dist`
- Hidden directories (`.*`)

## Ignoring files
## Customizing watched files

To exclude specific files or directories from being watched, use the `--ignore` flag:
### Including files to watch

To include specific files or directories to watch, use the `--include` flag:

```sh
tsx watch --include ./other-dep.txt --include "./other-deps/*" ./file.ts
```


### Excluding files from watch
To exclude specific files from being watched, use the `--exclude` flag:

```sh
tsx watch --ignore ./ignore-me.js --ignore ./ignore-me-too.js ./file.ts
tsx watch --exclude ./ignore-me.js --exclude ./ignore-me-too.js ./file.ts
```

### Using glob patterns

Glob patterns allow you to define a set of files or directories to ignore. To prevent your shell from expanding the glob patterns, wrap them in quotes:

```sh
tsx watch --ignore "./data/**/*" ./file.ts
tsx watch --exclude "./data/**/*" ./file.ts
```

## Tips
Expand Down

0 comments on commit 315d5f4

Please sign in to comment.