[英]How to pass dynamic file name in npm run command
I want to npm run a command to generate a dynamic output file from the file name I pass in the command line.我想在 npm 运行命令,从我在命令行中传递的文件名生成动态 output 文件。 But I am not able to generate that from the below command但我无法从以下命令生成它
In my package.json in the script I have added the command:在我的 package.json 脚本中,我添加了命令:
scripts:{
"gen-out":"some_cmd src/app/parser/$npm_config_filene.st -o src/app/parser/$npm_config_filene.j"
}
and after running并在运行后
npm run gen-out --filene=myfile
it produces a file with the name $npm_config_filene.js instead of myfile.js它生成一个名为 $npm_config_filene.js 而不是 myfile.js 的文件
could anyone help, please?有人可以帮忙吗?
for windows platform use this format:对于 windows 平台,使用以下格式:
scripts:{
"gen-out":"some_cmd src/app/parser/%npm_config_filene%.st -o src/app/parser/%npm_config_filene%.j"
}
npm run gen-out --filene=myfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.