【问题标题】:NPM/ Yarn Pass entire command dynamically to a script value as an argument/parameterNPM/ Yarn 将整个命令作为参数/参数动态传递给脚本值
【发布时间】:2017-11-23 05:01:53
【问题描述】:

包.json

 {
        custom: "",
        "build:xapp": "webpack ....",
        "test:xapp": "karma ....",
        "build:yapp": "webpack ....",
        "test:yapp": "karma ...."
         ... n number of apps
 }

如果想将自定义脚本的整个命令作为参数传递,我该怎么做?

类似的东西

yarn custom ---"yarn build:xapp,yarn build:yapp,yarn test:xapp"

【问题讨论】:

    标签: node.js npm webpack gulp yarnpkg


    【解决方案1】:

    您似乎想要运行 package.json 中定义的多个 npm 脚本。我认为 npm-run-all 就是你要找的东西:https://www.npmjs.com/package/npm-run-all

    安装后,您可以运行npm-run-all build:xapp build:yapp test:xapp

    如果您正在寻找传递命令行参数,这里已经回答了这个问题:Sending command line arguments to npm script

    【讨论】:

      猜你喜欢
      • 2018-02-28
      • 2018-11-22
      • 1970-01-01
      • 1970-01-01
      • 2020-05-09
      • 2016-05-27
      • 1970-01-01
      相关资源
      最近更新 更多