Programmatically run package.json scripts.
Scripts will automatically run with the correct package manager (yarn, npm, or pnpm) if a lockfile is present.
For npm, if a the given script exists in packge.json it will be run using npm run
.
Otherwise, npx --no-install
will be used.
Installation
yarn add package-run
npm install package-run
API
Usage
; run, ; // Equivalent of:// yarn run babel ./src --out-dir ./build --config-file ./babel.config.json --watch// npx --no-install babel ./src --out-dir ./build --config-file ./babel.config.json --watch// pnpm run babel ./src --out-dir ./build --config-file ./babel.config.json --watch executableToString; // "yarn run babel ./src --out-dir ./build --config-file ./babel.config.json --watch"
Types
; ; ; ;
- @bconnorwhite/exec: Execute commands while keeping flags easily configurable as an object
- as-typed-array: Make any value an array, and maintain types
- has-script: Check if package.json contains a script
- which-pm-lockfile: Check if a project uses yarn, npm, or pnpm. Supports yarn workspaces.
- @bconnorwhite/bob: Bob is a toolkit for TypeScript projects
- jest: Delightful JavaScript Testing.