I have a javascript file, do-stuff.js, which does stuff with the arguments received from command line
// do-stuff.js
doSomething(process.argv[2]);
doSomethingElse(process.argv[3]);
I can execute do-stuff with an npm script like this
"scripts": {
"do-stuff": "node do-stuff"
}
I call the script from command line and everything works fine
npm run do-stuff -- --firstArg=abc --secondArg=123
Now I create a second file, do-more-stuff.js which I want to execute sequentially, after having executed do-stuff.js.
So I create a second script
"scripts": {
"do-stuff": "node do-stuff",
"do-more-stuff": "npm run do-stuff && npm run do-more-stuff",
}
But now, if I call do-more-stuff with the same arguments as before
npm run do-more-stuff -- --firstArg=abc --secondArg=123
I see that the parameters are not passed to do-stuff.
Is there a way to make an npm script which executes commands sequentially to be able to receive arguments from command line?