-
Notifications
You must be signed in to change notification settings - Fork 16
/
nodemon.node.txt
106 lines (88 loc) · 7.17 KB
/
nodemon.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
NODEMON
VERSION ==> #CLI/Node (3.0.1)
/=+===============================+=\
/ : : \
)==: CONF :==(
\ :_______________________________: /
\=+===============================+=/
CONF #Either:
# - CLI flags
# - CONF_FILE:
# - camelcase instead of dasherized
# - can use {{pwd}} or {{filename}}
# - def: nodemon.json
# - specified by:
# - --config
# - $PWD
# - $HOME
# - package.json OBJ.nodemonConfig
/=+===============================+=\
/ : : \
)==: CLI :==(
\ :_______________________________: /
\=+===============================+=/
nodemon [SCRIPT] [-- ...] #Like node SCRIPT [...] except:
# - it redoes node SCRIPT (even if has already exit) if either:
# - any ./*.EXTENSION files are changed
# - using command line "rs" (on same terminal as nodemon), or --restartable "COMMAND"
#To use in development/testing/debugging an app, not in production.
#Def SCRIPT: stdin (unless --no-stdin)
#To do graceful exit, intercept SIGUSR2 signal:
# process.once("SIGUSR2", function(){ ... process.kill(process.pid, "SIGUSR2"); })
#Nodemon itself (not SCRIPT) can be restarted with SIGHUP
--exec "COMMAND_WITH_OPTIONS" #Uses COMMAND (e.g. python) instead of node --harmony (def)
#Can also use execMap: { EXTENSION: COMMAND_WITH_OPTIONS } in config file, which will use
#COMMAND if SCRIPT has EXTENSION. Def: { py: "python", rb: "ruby", ts: "ts-node" }
--watch DIR|FILE #DIR to watch recursively (can specify several times for several DIR) (def: $PWD)
#FILE can use globbing if quoted.
--on-change-only #Only execute on watch change, not on startup
--ignore DIR|FILE #Inverse. Def: .git/, node_modules/, bower_components/, .sass-cache/, coverage/
--ext EXTENSION... #Extensions to watch (def: .js, .cjs, .json, .[lit]coffee)
#Can use *
--delay DOUBLE #Restarts SCRIPT only after DOUBLE seconds. If new file changes, reset the delay.
#Goal is when changing several files in a batch, to avoid restarting several times.
--quiet|verbose #
--no-update-notifier #No notification that package can be updated
--no-colors #
--exitcrash #Necessary when using forever too (but forever should be used in production, not nodemon)
#Should do forever start -c "nodemon --exitcrash" SCRIPT
--signal #Def: 'SIGUSR2'
--spawn #Use spawn() instead of fork()
CONF.events.EVENT 'COMMAND' #Command to fire on EVENTs.
#EVENTs are also available on NODEMONOBJ (which is a EVENTEMITTER):
# - start()
# - quit()
# - restart('FILE'_ARR)
# - crash()
# - config:update(OBJ2) with OBJ2:
# - options OBJ
# - command.string STR: e.g. "node FILE"
# - run BOOL
# - dirs DIR_ARR
# - log(OBJ): OBJ has: type, message, colour
# - stdout|err()
# - readable(): data is ready to read using NODEMONOBJ.stdout|err OSTREAM
# - message()
CONF.env.ENVVAR VAL #
/=+===============================+=\
/ : : \
)==: NODE :==(
\ :_______________________________: /
\=+===============================+=/
NODEMON(OBJ|STR) #Runs nodeman as Node module.
#STR is command line arguments to nodemon. OBJ:
# - script STR
# - nodeArgs STR_ARR (e.g. "--debug")
# - any options (e.g. ext STR). List are space-separated STR
# - stdout false: no output on console
#Returns NODEMONOBJ
GULP-NODEMON(...) #Fires NODEMON(...). Version 1.0.4
#Returns NODEMONOBJ, not GULP object, with members:
# - on(NODEMONEVENT, FUNC(...)|TASKS[_ARR])
#Adds NODEMONEVENT "change" (a file changed)
#Can be combined with GULP.watch():
# - GULP.watch() watches most things and rebuild parts when changed
# - GULP-NODEMON should only watch server file (use watch: FILE, not only script: FILE): it will
# relaunch it when changed