Era*_*hel 20 javascript json npm package.json yarnpkg
我使用Terraform的一个项目,我在我的两个任务package.json来启动terraform plan和terraform apply.
"scripts": {
    "tf:apply": "terraform apply",
    "tf:plan": "terraform plan"
}
对于这两个命令,我需要先执行terraform get.我想pretask两个人都只有一个.
我试着用:
"scripts": {
    "pretf:*": "terraform get",
    "tf:apply": "terraform apply",
    "tf:plan": "terraform plan"
}
但它不起作用.
是否有任何方法可以使用NPM或Yarn 仅使用?或者我是否被迫为这两项任务编写完全相同的预处理?
我通常会这样:
"scripts": {
    "tf:get": "terraform get",
    "tf:apply": "npm run tf:get && terraform apply",
    "tf:plan": "npm run tf:get && terraform plan"
}
这是另一种假装"tf:*"预备的选择.只是为了模糊神秘的npm忍者而不是建议的:
"scripts": {
    "pretf": "terraform get",
    "tf": "terraform",
    "tf:apply": "npm run tf -- apply",
    "tf:plan": "npm run tf -- plan"
}
(npm run tf:plan与任何参数一起使用或直接使用npm run tf -- whathever)
| 归档时间: | 
 | 
| 查看次数: | 953 次 | 
| 最近记录: |