Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Sending command line arguments to npm script (https://www.warriorforum.com/programming/1455183-sending-command-line-arguments-npm-script.html)

NamanRathore 12th July 2022 07:33 AM

Sending command line arguments to npm script
 
The scripts portion of my package.json currently looks like this:

Code:

"scripts": {
    "start": "node ./script.js server"
}

which means I can run npm start to start the server. So far so good.

However, I would like to be able to run something like npm start 8080 and have the argument(s) passed to script.js (e.g. npm start 8080 => nodes ./script.js server 8080). Is this conceivable?

valina g 23rd August 2022 03:27 PM

RE: Sending command line arguments to npm script
 
The 'vumper' package takes in a command line argument (such as 'dv'). What I would like to be able to do is have a command that runs both of these in succession.


All times are GMT -6. The time now is 06:12 PM.