Skip to content

Commit 8074d2e

Browse files
committed
readme --watch update
1 parent 538212a commit 8074d2e

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ tsnd --respawn server.ts
4040
- `--ignore-watch` (default: []) - files/folders to be [ignored by `node-dev`](https://github.com/fgnass/node-dev#ignore-paths). **But also this behaviour enhanced:** it will also make up `new RegExp` of passed ignore string and check absolute paths of required files for match.
4141
So, to ignore everything in `node_modules`, just pass `--ignore-watch node_modules`.
4242

43-
- `--debug` - some additional debug output.
44-
- `--interval` Polling interval (ms)
45-
- `--debounce` Debounce file change events (ms, non-polling mode)
43+
- `--debug` - Some additional debug output.
44+
- `--interval` - Polling interval (ms)
45+
- `--debounce` - Debounce file change events (ms, non-polling mode)
46+
-- `--clear` (`--cls`) Will clear screen on restart
47+
-- `--watch` - Explicitly add files or folders to watch (list separated by commas)
4648

4749
**Caveats and points of notice:**
4850

@@ -58,8 +60,6 @@ tsnd --respawn server.ts
5860

5961
- The good thing is that `ts-node-dev` watches used `tsconfig.json` file, and will reinitialize compilation on its change, but you have to restart the process manually when you update used version of `typescript` or make any other changes that may effect compilation results.
6062

61-
- In some rare cases `ts-node-dev` may fail to terminate an application by sending `SIGTERM` signal, this maybe be caused by the app having running heavy child process or something. But the app should get the signal anyway and it can be explicitly processed there: `process.on('SIGTERM', () => process.exit())`.
62-
6363
## License
6464

6565
WTF.

lib/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = function(script, scriptArgs, nodeArgs, opts) {
4242
interval: parseInt(opts.interval),
4343
debounce: parseInt(opts.debounce),
4444
recursive: true
45-
})
45+
})
4646
var starting = false
4747
watcher.on('change', function(file) {
4848
if (file === compiler.tsConfigPath) {
@@ -90,8 +90,7 @@ module.exports = function(script, scriptArgs, nodeArgs, opts) {
9090
tsVersion
9191
)
9292
for (let watched of (opts.watch || '').split(',')) {
93-
console.log('add watch', watched)
94-
watcher.add(watched)
93+
if (watched) watcher.add(watched)
9594
}
9695
var cmd = nodeArgs.concat(wrapper, script, scriptArgs)
9796
var childHookPath = compiler.getChildHookPath()

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-node-dev",
3-
"version": "1.0.0-pre.40",
3+
"version": "1.0.0-pre.41",
44
"description": "Compiles your TS app and restarts when files are modified.",
55
"keywords": [
66
"restart",
@@ -39,7 +39,7 @@
3939
"scripts": {
4040
"ts-node-dev": "node ./bin/ts-node-dev",
4141
"test-node-dev": "tap test/*.js",
42-
"test": "node ./bin/ts-node-dev --tree-kill -r tsconfig-paths/register -r ./test/ts/add-require.js -r ./test/ts/add-require-2.js -r esm -O \"{\\\"module\\\": \\\"es6\\\"}\" --preserve-symlinks --respawn --ignore-watch 'lib' --ignore-watch bin --prefer-ts --debug --poll --interval 1000 --cache-directory .ts-node --inspect -- test/ts/test-script test-arg --fd",
42+
"test": "node ./bin/ts-node-dev --tree-kill --clear -r tsconfig-paths/register -r ./test/ts/add-require -r ./test/ts/add-require-2 -r esm -O \"{\\\"module\\\": \\\"es6\\\"}\" --preserve-symlinks --respawn --ignore-watch 'lib' --ignore-watch bin --prefer-ts --debug --poll --interval 1000 --cache-directory .ts-node --inspect -- test/ts/test-script test-arg --fd",
4343
"test-docker": "docker run --rm -v ${PWD}:/app mhart/alpine-node:8.7.0 sh -c 'cd app && node ./bin/ts-node-dev --cache-directory .ts-node test/ts/big'"
4444
},
4545
"dependencies": {

test/ts/add-require-2.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/ts/add-require-2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('second node --require')

0 commit comments

Comments
 (0)