简体   繁体   English

npm将命令行参数传递给命令

[英]npm pass command line argument to command

I have in my npm package the following scripts property: 我的npm包中有以下脚本属性:

"scripts": {
    "test": "jasmine-node spec/",
    "install": "browserify api-client.js -o ../www/components/global/api-client.js"
  }

How can I do something like 我该怎么做

npm run install --param differentOutput

so as not to hardcode the '../www/components/global/api-client.js' path 以免硬编码“ ../www/components/global/api-client.js”路径

您可以使用选项--

npm run install -- --param differentOutput

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM