Daksh Dutta
Daksh Dutta

Reputation: 193

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. But I am not able to generate that from the below command

In my package.json in the script I have added the command:

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

could anyone help, please?

Upvotes: 0

Views: 1892

Answers (1)

Hamid Taebi
Hamid Taebi

Reputation: 397

for windows platform use this format:

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 

Upvotes: 1

Related Questions