How to run multiple npm scripts

Today I have to need to run the fake API at the same time my vue app runs, the API was using json-server.

I don’t like to execute the command vue serve for spa and in json-server /db.json in the terminal and another option was use && but if tomorrow I should need start another program will be like:

npm run lint && npm run build && npm run api && npm run whereverthing :P

Then I found npm-run-all is node package, it allows to run all scripts defined in npm in sequential or parallel each one in parallel.

"scripts": {
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "lint": "vue-cli-service lint",
        "api": "json-server src/db.json",
        "all": "npm-run-all --parallel serve api"

My API and Vue app is running with a single command 🙂

Happy NPM!