【发布时间】:2019-09-09 05:52:14
【问题描述】:
我想在我的 package.json 中定义以下脚本
scripts: {
"filter": "npm run jest -- -t $1",
"jest": "jest",
[...]
想法是我可以运行npm run filter -- my-filter来执行npm run jest -- -t my-filter
如果我跑:
npm run filter -- pattern
-->
npm run jest -- -t $1 "pattern"
$1 是字面的。如果我在脚本中取消 $1 ,它可以正常工作,看起来 npm 在句末传递了所有参数。我只想知道如何使用单个参数
【问题讨论】:
标签: node.js npm npm-scripts