npm script命令

发布于:2023-08-24 ⋅ 阅读:(60) ⋅ 点赞:(0)

1 串行/并行执行命令

//串行
npm-run-all text test
npm run text && npm run test
//并行改成&
npm-run-all --parallel text test
npm run text & npm run test

2 传递参数

{
	"lint": "eslint js/*.js",
	"lint:fix""eslint js/* .js --fix"
}

npm script使用--传递参数。
运行时输入npm run lint或者npm run lint – --fix

3 npm script钩子执行的生命周期

以下命令按顺序执行(pre、post为前缀):

  • prelint
  • lint
  • postlint

网站公告

今日签到

点亮在社区的每一天
去签到