app.py 这个文件,那么将默认支持
.py 这种扩展类型。另外文档里还写了别的。nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of .js if there’s no nodemon.json:
nodemon --exec "python -v" ./app.pyNow nodemon will runapp.py with python in verbose mode (note that if you’re not passing args to the exec program, you don’t need the quotes), and look for new or modified files with the .py extension.
这里说明,除了默认支持的扩展,通过这个配置,可以支持和正在运行的脚本一样的扩展。并且,如果扩展程序不需要传参数的话,可以不写单引号。
综上所述,一个命令用于增加支持的文件类型,一个配置用来执行和监视其他类型的程序。
至于
---watch 这个参数。By default nodemon monitors the current working directory. If you want to take control of that option, use the –watch option to add specific paths:
nodemon --watch app --watch libs app/server.jsNow nodemon will only restart if there are changes in the ./app or ./libs directory. By default nodemon will traverse sub-directories, so there’s no need in explicitly including sub-directories.
Don’t use unix globbing to pass multiple directories, e.g –watch ./lib/*, it won’t work. You need a –watch flag per directory watched.
这里面需要注意的有两点,一是
nodemon 会默认监视当前脚本文件执行的文件夹,另一个就是如果要指定具体的文件夹时,需要些详细的路径,比如绝对路径或者相对路径,绝对不要使用 通配符 。因此我命令行中的使用是无效且违反规则的,然而非要这样写也不影响运行。原本到这也就结束了,然而昨天用了一个npm包,我想看看怎么运行的,于是遇到了
debugger 的问题,这也是迫使我去认真弄懂这段命令的原因。
npm run debugger基本的调试方式网上到处都有,我就不说了,问题还是导入typescript之后,让一切都混乱起来。我最开始尝试了以下几种命令:
'nodemon --inspect --watch ./app -e ts,tsx --exec ts-node ./app/index.ts'
'nodemon --watch --inspect ./app -e ts,tsx --exec ts-node ./app/index.ts'
'nodemon --watch ./app -e ts,tsx --exec ts-node --inspect ./app/index.ts'









