【发布时间】:2018-06-09 16:53:33
【问题描述】:
有没有简单的方法来提供 npm 脚本的使用信息?
理想情况下,当我运行npm run 时,我会得到这样的输出(注意每个任务底部的描述):
Lifecycle scripts included in product-discovery-service:
start
node server.js
available via `npm run-script`:
watch
run-p watch:build watch:run
Run in development mode and rebuild/restart when changes are made
watch:build
npm run build:dev -- --watch
Probably don't need this (would be nice to be able to omit tasks like this)
watch:run
nodemon --watch build/ --inspect
Probably don't need this (would be nice to be able to omit tasks like this)
prewatch:run
wait-on --log build/server.js
Probably don't need this (would be nice to be able to omit tasks like this)
build
babel server.js --out-dir build/
Build the project
prebuild
rimraf build/
Probably don't need this (would be nice to be able to omit tasks like this)
build:dev
npm run build -- --source-maps
Probably don't need this (would be nice to be able to omit tasks like this)
看起来 npm 不支持这个,但也许有第三方提供解决方案?我找到了npm-scripts-help,但感觉很笨重。
【问题讨论】:
标签: npm command-line-interface npm-scripts