让前端飞Web前端之路

npm script工作流(三)传递参数

2020-08-04  本文已影响0人  ZoranLee

从eslint看传参

{
"script":{
 "lint:js": "eslint *.js",
 "lint:js:fix": "npm run lint:js -- --fix"
}
}

--fix 参数前面的 -- 分隔符,意指要给 npm run lint:js 实际指向的命令传递额外的参数

给 npm script 添加注释

{
   "//":"运行所有代码检查和单元测试",
    "test":"npm-run-all --parallel lint:* mocha"
}

{
"test": "npm-run-all --parallel lint:* mocha",
"test": "# 运行所有代码检查和单元测试 \n    npm-run-all --parallel lint:* mocha"
}

npm script 运行时日志输出

上一篇下一篇

猜你喜欢

热点阅读