Run pnpm/npm/yarn scripts in sequential or in parallel, cross-platform. This is a hard fork of npm-run-all
with the following enhancements:
- Rewrite in Typescript, with esbuild bundling
- Automated dependencies upkeep with renovate bot
- Run logic are decoupled between syncronous vs asyncronous, allowing much cleaner spawn code, audit it here
Install the package as a dev dependency, swapping pnpm
with your preferred package manager:
pnpm i -D @plasmohq/rps
Then, in your package.json scripts, you can replace sequential script with run-s
:
- "prepare": "pnpm run clean && pnpm run build"
+ "prepare": "run-s clean build"
Or parallel script with run-p
:
- "start": "pnpm run watch & pnpm run serve"
+ "start": "run-p watch serve"
You can also use glob patterns:
"build": "run-s build:* compile",
"build:codegen": "node ./scripts/codegen.mjs",
"build:docs": "node ./scripts/docs.mjs",
"build:lint": "node ./scripts/lint.mjs",
"compile": "run-p compile:*",
"compile:linux": "node ./scripts/linux.mjs",
"compile:macosx": "node ./scripts/macosx.mjs",
"compile:win32": "node ./scripts/win32.mjs",
You can import the runners from this module and use it like so:
#!/usr/bin/env node
import { run } from "@plasmohq/rps"
run(["clean", "build"]) // sequential
run(["watch", "serve"], true) // parallel