From 315d5f44f301424de595873f93c102a5c184ab46 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Wed, 16 Oct 2024 13:18:46 +0900 Subject: [PATCH] docs(watch): document `--include` flag Co-authored-by: Kingston Tam --- docs/watch-mode.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/watch-mode.md b/docs/watch-mode.md index 7e99718aa..d9901163e 100644 --- a/docs/watch-mode.md +++ b/docs/watch-mode.md @@ -21,12 +21,22 @@ 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 @@ -34,7 +44,7 @@ tsx watch --ignore ./ignore-me.js --ignore ./ignore-me-too.js ./file.ts 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