简体   繁体   中英

Run two scripts from package.json

My package.json:

  "scripts": {
    "dev": "cross-env NODE_ENV=development nodemon src $NODE_DEBUG_OPTION --exec babel-node",
    "build": "babel src -s -D -d dist",
    "tsc:w": "tsc -w"
  }

I have to run two commands:

npm run dev

And

npm run tsc:w

Is it possible to include the typescript watcher in the dev ?

You can use pre and post scripts that will run before and after your intended script.

This should run tsc on .ts files, and then browserify on the compiled .js files:

"scripts": {
    "prebuild": "tsc",
    "build": "browserify dev/main.js -o docs/js/main.js"
}

In terminal:

npm run build

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM