Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-run-all

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-run-all - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

docs/node-api.md

7

bin/common/bootstrap.js

@@ -27,2 +27,9 @@ /**

default:
// https://github.com/mysticatea/npm-run-all/issues/105
// Avoid MaxListenersExceededWarnings.
process.stdout.setMaxListeners(0)
process.stderr.setMaxListeners(0)
process.stdin.setMaxListeners(0)
// Main
return require(`../${name}/main`)(

@@ -29,0 +36,0 @@ argv,

12

bin/common/parse-cli-args.js

@@ -46,3 +46,3 @@ /**

Object.keys(process.env).forEach(key => {
for (const key of Object.keys(process.env)) {
const m = PACKAGE_CONFIG_PATTERN.exec(key)

@@ -52,3 +52,3 @@ if (m != null) {

}
})
}

@@ -67,3 +67,3 @@ return retv

groups.push(Object.assign(
{parallel: false, patterns: []},
{ parallel: false, patterns: [] },
initialValues || {}

@@ -180,2 +180,6 @@ ))

case "--aggregate-output":
set.aggregateOutput = true
break
case "-p":

@@ -186,3 +190,3 @@ case "--parallel":

}
addGroup(set.groups, {parallel: true})
addGroup(set.groups, { parallel: true })
break

@@ -189,0 +193,0 @@

@@ -36,2 +36,4 @@ /**

unlimited.
--aggregate-output - Avoid interleaving output by delaying printing of
each command's output until it has finished.
--npm-path <string> - - - Set the path to npm. Default is the value of

@@ -38,0 +40,0 @@ environment variable npm_execpath.

@@ -31,3 +31,3 @@ /**

const stdin = process.stdin
const argv = parseCLIArgs(args, {parallel: true}, {singleMode: true})
const argv = parseCLIArgs(args, { parallel: true }, { singleMode: true })
const group = argv.lastGroup

@@ -56,2 +56,3 @@

npmPath: argv.npmPath,
aggregateOutput: argv.aggregateOutput,
}

@@ -58,0 +59,0 @@ )

@@ -31,3 +31,3 @@ /**

const stdin = process.stdin
const argv = parseCLIArgs(args, {parallel: false}, {singleMode: true})
const argv = parseCLIArgs(args, { parallel: false }, { singleMode: true })
const group = argv.lastGroup

@@ -34,0 +34,0 @@

@@ -41,3 +41,3 @@ /**

const packagePath = packageInfo.path
const color = isTTY ? chalk.styles.gray : {open: "", close: ""}
const color = isTTY ? chalk.styles.gray : { open: "", close: "" }

@@ -44,0 +44,0 @@ return `

@@ -48,7 +48,7 @@ /**

* @param {string|Buffer} chunk - A chunk to be transformed.
* @param {string} encoding - The encoding of the chunk.
* @param {string} _encoding - The encoding of the chunk.
* @param {function} callback - A callback function that is called when done.
* @returns {void}
*/
_transform(chunk, encoding, callback) {
_transform(chunk, _encoding, callback) {
const prefix = this.prefix

@@ -55,0 +55,0 @@ const nPrefix = `\n${prefix}`

@@ -113,11 +113,11 @@ /**

Object.keys(config).forEach(packageName => {
for (const packageName of Object.keys(config)) {
const packageConfig = config[packageName]
Object.keys(packageConfig).forEach(variableName => {
for (const variableName of Object.keys(packageConfig)) {
const value = packageConfig[variableName]
options.push(`--${packageName}:${variableName}=${value}`)
})
})
}
}

@@ -212,3 +212,3 @@ return options

*/
module.exports = function npmRunAll(patternOrPatterns, options) {
module.exports = function npmRunAll(patternOrPatterns, options) { //eslint-disable-line complexity
const stdin = (options && options.stdin) || null

@@ -228,2 +228,3 @@ const stdout = (options && options.stdout) || null

const maxParallel = parallel ? ((options && options.maxParallel) || 0) : 1
const aggregateOutput = Boolean(options && options.aggregateOutput)
const npmPath = options && options.npmPath

@@ -254,3 +255,3 @@ try {

if (taskList != null) {
return {taskList, packageInfo: null}
return { taskList, packageInfo: null }
}

@@ -280,2 +281,3 @@ return readPackageJson()

npmPath,
aggregateOutput,
})

@@ -282,0 +284,0 @@ })

@@ -20,3 +20,3 @@ /**

const COLON_OR_SLASH = /[:/]/g
const CONVERT_MAP = {":": "/", "/": ":"}
const CONVERT_MAP = { ":": "/", "/": ":" }

@@ -50,3 +50,3 @@ /**

return {match, task, args}
return { match, task, args }
}

@@ -102,6 +102,6 @@

// Take tasks while keep the order of patterns.
filters.forEach(filter => {
for (const filter of filters) {
let found = false
candidates.forEach(candidate => {
for (const candidate of candidates) {
if (filter.match(candidate)) {

@@ -114,3 +114,3 @@ found = true

}
})
}

@@ -125,3 +125,3 @@ // Built-in tasks should be allowed.

}
})
}

@@ -128,0 +128,0 @@ const unknownTasks = Object.keys(unknownSet)

@@ -29,4 +29,4 @@ /**

taskList: Object.keys(body.scripts || {}),
packageInfo: {path, body},
packageInfo: { path, body },
}))
}

@@ -36,4 +36,4 @@ /**

for (const i in taskName) {
hash = ((hash << 5) - hash) + taskName.charCodeAt(i)
for (const c of taskName) {
hash = ((hash << 5) - hash) + c
hash |= 0

@@ -128,3 +128,3 @@ }

const stderrKind = detectStreamKind(stderr, process.stderr)
const spawnOptions = {stdio: [stdinKind, stdoutKind, stderrKind]}
const spawnOptions = { stdio: [stdinKind, stdoutKind, stderrKind] }

@@ -169,6 +169,6 @@ // Print task name.

if (stdoutKind === "pipe") {
cp.stdout.pipe(stdout, {end: false})
cp.stdout.pipe(stdout, { end: false })
}
if (stderrKind === "pipe") {
cp.stderr.pipe(stderr, {end: false})
cp.stderr.pipe(stderr, { end: false })
}

@@ -183,3 +183,3 @@

cp = null
resolve({task, code})
resolve({ task, code })
})

@@ -186,0 +186,0 @@ })

@@ -13,2 +13,3 @@ /**

const streams = require("memory-streams")
const NpmRunAllError = require("./npm-run-all-error")

@@ -56,4 +57,4 @@ const runTask = require("./run-task")

const results = tasks.map(task => ({name: task, code: undefined}))
const queue = tasks.map((task, index) => ({name: task, index}))
const results = tasks.map(task => ({ name: task, code: undefined }))
const queue = tasks.map((task, index) => ({ name: task, index }))
const promises = []

@@ -90,3 +91,5 @@ let error = null

else {
promises.forEach(p => p.abort())
for (const p of promises) {
p.abort()
}
Promise.all(promises).then(done, reject)

@@ -110,4 +113,13 @@ }

}
const originalOutputStream = options.stdout
const optionsClone = Object.assign({}, options)
const writer = new streams.WritableStream()
if (options.aggregateOutput) {
optionsClone.stdout = writer
}
const task = queue.shift()
const promise = runTask(task.name, options)
const promise = runTask(task.name, optionsClone)

@@ -122,2 +134,6 @@ promises.push(promise)

if (options.aggregateOutput) {
originalOutputStream.write(writer.toString())
}
// Save the result.

@@ -124,0 +140,0 @@ results[task.index].code = result.code

@@ -31,3 +31,3 @@ /**

descendent.forEach(child => {
for (const child of descendent) {
try {

@@ -39,3 +39,3 @@ process.kill(child.PID)

}
})
}
})

@@ -42,0 +42,0 @@ }

{
"name": "npm-run-all",
"version": "4.0.2",
"version": "4.1.0",
"description": "A CLI tool to run multiple npm-scripts in parallel or sequential.",

@@ -13,3 +13,4 @@ "bin": {

"bin",
"lib"
"lib",
"docs"
],

@@ -32,6 +33,7 @@ "engines": {

"dependencies": {
"chalk": "^1.1.3",
"cross-spawn": "^5.0.1",
"minimatch": "^3.0.2",
"ps-tree": "^1.0.1",
"chalk": "^2.1.0",
"cross-spawn": "^5.1.0",
"memory-streams": "^0.1.2",
"minimatch": "^3.0.4",
"ps-tree": "^1.1.0",
"read-pkg": "^2.0.0",

@@ -42,13 +44,14 @@ "shell-quote": "^1.6.1",

"devDependencies": {
"@types/node": "^4.0.30",
"@types/node": "^4.2.20",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-power-assert": "^1.0.0",
"babel-register": "^6.4.3",
"codecov": "^1.0.1",
"eslint": "^3.12.2",
"eslint-config-mysticatea": "^7.0.1",
"jsdoc": "^3.4.0",
"mocha": "^3.2.0",
"nyc": "^10.0.0",
"power-assert": "^1.2.0",
"rimraf": "^2.4.4"
"babel-register": "^6.26.0",
"codecov": "^2.3.0",
"eslint": "^4.5.0",
"eslint-config-mysticatea": "^12.0.0",
"jsdoc": "^3.5.4",
"mocha": "^3.5.0",
"nyc": "^11.1.0",
"power-assert": "^1.4.4",
"rimraf": "^2.6.1"
},

@@ -55,0 +58,0 @@ "repository": "mysticatea/npm-run-all",

@@ -15,11 +15,10 @@ | index | [npm-run-all] | [run-s] | [run-p] | [Node API] |

```
$ npm-run-all clean lint build:*
```
## ⤴️ Motivation
```
$ npm-run-all --parallel watch:*
```
- **Simplify.** The official `npm run-script` command cannot run multiple scripts, so if we want to run multiple scripts, it's redundant a bit. Let's shorten it by glob-like patterns.<br>
Before: `npm run clean && npm run build:css && npm run build:js && npm run build:html`<br>
After: `npm-run-all clean build:*`
- **Cross platform.** We sometimes use `&` to run multiple command in parallel, but `cmd.exe` (`npm run-script` uses it by default) does not support the `&`. Half of Node.js users is using it on Windows, so the use of `&` might block contributions. `npm-run-all --parallel` works well on Windows as well.
## Installation
## 💿 Installation

@@ -33,6 +32,7 @@ ```bash

- It requires `Node@>=4`.
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.
## CLI Commands
## 📖 Usage
### CLI Commands
This `npm-run-all` package provides 3 CLI commands.

@@ -51,4 +51,8 @@

## Node API
#### Yarn Compatibility
If a script is invoked with Yarn, `npm-run-all` will correctly use Yarn to execute the plan's child scripts.
### Node API
This `npm-run-all` package provides Node API.

@@ -58,9 +62,9 @@

## Changelog
## 📰 Changelog
- https://github.com/mysticatea/npm-run-all/releases
## Contributing
## 🍻 Contributing
Thank you for contributing!
Welcome♡

@@ -77,3 +81,3 @@ ### Bug Reports or Feature Requests

### Feature Implementing
### Implementing

@@ -83,9 +87,7 @@ Please use GitHub Pull Requests.

There are some npm-scripts to help developments.
Those work on Windows, Mac, or Linux (by the way, I'm developping `npm-run-all` on Windows).
- **npm test** - Run tests and collect coverage.
- **npm run build** - Make `lib` directory from `src` directory.
- **npm run clean** - Delete directories (folders) which are created by other commands.
- **npm run clean** - Delete temporary files.
- **npm run lint** - Run ESLint.
- **npm run watch** - Run tests (not collect coverage) when each file was modified.
- **npm run watch** - Run tests (not collect coverage) on every file change.

@@ -92,0 +94,0 @@ [npm-run-all]: docs/npm-run-all.md

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc