How can I make a command in the package.json file, that executes two commands for the terminal (console) one after another?
node [path to the file that runs the server]
npm start
localhost: 8080
cd webdir
node [path to the file that runs the Web server]
"scripts": {
"start": "node (...)/node_modules/http-server/bin/http-server"
},
The syntax I'm aware of involves using &&
to separate the commands, i.e.
"cd webdir && node ..."
This should work both on Windows and on Unix based systems.
For example, jQuery uses such combined statements in its deploy scripts:
"build": "npm install && grunt",
"start": "grunt watch",
"test": "grunt && grunt test:slow",
"precommit": "grunt lint:newer",
"commitmsg": "node node_modules/commitplease"
See https://github.com/jquery/jquery/blob/master/package.json