Skip to content

Commit 9f4deca

Browse files
committed
2 parents 8e1dc84 + 623ae9d commit 9f4deca

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Look up flags and options can be used [in ts-node's docs](https://github.com/Typ
5555
- `--watch` - Explicitly add arbitrary files or folders to watch and restart on change (list separated by commas, [chokidar](https://github.com/paulmillr/chokidar) patterns)
5656
- `--exit-child` - Adds 'SIGTERM' exit handler in a child process.
5757
- `--rs` - Allow to restart with "rs" line entered in stdio, disabled by default.
58+
- `--no-notify` - Do not display desktop-notifications (Notifications are only displayed if `node-notifier` is installed).
5859

5960
**Caveats and points of notice:**
6061

lib/notify.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
var path = require('path');
2-
var notifier = require('node-notifier');
2+
var notifier = null;
3+
try {
4+
notifier = require('node-notifier');
5+
} catch (error) {
6+
notifier = null;
7+
}
38

49
function icon(level) {
510
return path.resolve(__dirname, '../icons/node_' + level + '.png');
@@ -12,7 +17,7 @@ module.exports = function (cfg, log) {
1217
return function (title, msg, level) {
1318
level = level || 'info';
1419
log([title, msg].filter(_ => _).join(': '), level);
15-
if (cfg.notify) {
20+
if (notifier !== null && cfg.notify) {
1621
notifier.notify({
1722
title: title || 'node.js',
1823
icon: icon(level),

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
"test-docker": "docker-compose up",
4545
"ci": "yarn test",
4646
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",
47-
"manual": "node ./bin/ts-node-dev --rt 5 --exit-child --tree-kill --clear -r tsconfig-paths/register -r ./test/manual/add-require -r ./test/manual/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/manual/test-script test-arg --fd"
47+
"manual": "node ./bin/ts-node-dev --rt 5 --exit-child --tree-kill --clear -r tsconfig-paths/register -r ./test/manual/add-require -r ./test/manual/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/manual/test-script test-arg --fd",
48+
"postinstall": "echo If you want desktop-notifications you can run \"npm i node-notifier@^5.4.0\"!"
4849
},
4950
"dependencies": {
5051
"chokidar": "^3.4.0",
5152
"dateformat": "~1.0.4-1.2.3",
5253
"dynamic-dedupe": "^0.3.0",
5354
"minimist": "^1.2.5",
5455
"mkdirp": "^1.0.4",
55-
"node-notifier": "^5.4.0",
5656
"resolve": "^1.0.0",
5757
"rimraf": "^2.6.1",
5858
"source-map-support": "^0.5.12",
@@ -81,6 +81,7 @@
8181
"typescript": "^3.9.5"
8282
},
8383
"peerDependencies": {
84+
"node-notifier": "^5.4.0",
8485
"typescript": "*"
8586
}
8687
}

0 commit comments

Comments
 (0)