Function
Static Public Summary | ||
public |
Runs npm-scripts which are matched with given patterns. |
Static Private Summary | ||
private |
The main process of |
|
private |
matchTasks(taskList: string[], patterns: string[]): string[] Enumerates tasks which matches with given patterns. |
|
private |
Parses arguments, then run specified npm-scripts. |
|
private |
Print a help text. |
|
private |
printVersion(output: stream.Writable): Promise Print a version text. |
|
private |
Reads |
|
private |
runTask(task: string, stdin: stream.Readable | null, stdout: stream.Writable | null, stderr: stream.Writable | null, prefixOptions: string[]): Promise Run a npm-script of a given name. |
|
private |
runTasksInParallel(tasks: string, stdin: stream.Readable | null, stdout: stream.Writable | null, stderr: stream.Writable | null, prefixOptions: string[]): Promise Run npm-scripts of given names in parallel. |
|
private |
runTasksInSequencial(tasks: string, stdin: stream.Readable | null, stdout: stream.Writable | null, stderr: stream.Writable | null, prefixOptions: string[]): Promise Run npm-scripts of given names in sequencial. |
|
private |
Launches a new process with the given command. |
|
private |
Launches a new process with the given command. |
|
private |
Gets a file path of |
Static Public
public npmRunAll(patternOrPatterns: string | string[], options: object | undefined): Promise source
import npmRunAll from 'npm-run-all/lib/npm-run-all.js'
Runs npm-scripts which are matched with given patterns.
Params:
Name | Type | Attribute | Description |
patternOrPatterns | string | string[] | Patterns to run. A pattern is a npm-script name or a Glob-like pattern. |
|
options | object | undefined |
|
Optional. |
options.parallel | boolean | If this is |
|
options.stdin | stream.Readable | null | A readable stream to send messages to stdin of child process.
If this is |
|
options.stdout | stream.Writable | null | A writable stream to receive messages from stdout of child process.
If this is |
|
options.stderr | stream.Writable | null | A writable stream to receive messages from stderr of child process.
If this is |
|
options.taskList | string[] | Actual name list of npm-scripts.
This function search npm-script names in this list.
If this is |
|
options.packageConfig | object | null | A map-like object to overwrite package configs.
Keys are package names.
Every value is a map-like object (Pairs of variable name and value).
e.g. |
|
options.silent | boolean | The flag to set |
Static Private
private main(args: string[], stdout: stream.Writable, stderr: stream.Writable): Promise source
import main from 'npm-run-all/bin/npm-run-all.js'
The main process of npm-run-all
command.
Params:
Name | Type | Attribute | Description |
args | string[] | Arguments to parse. |
|
stdout | stream.Writable | A writable stream to print logs. |
|
stderr | stream.Writable | A writable stream to print errors. |
private matchTasks(taskList: string[], patterns: string[]): string[] source
import matchTasks from 'npm-run-all/lib/match-tasks.js'
Enumerates tasks which matches with given patterns.
private npmRunAll(args: string[], stdout: stream.Writable, stderr: stream.Writable): Promise source
import npmRunAll from 'npm-run-all/bin/main.js'
Parses arguments, then run specified npm-scripts.
Params:
Name | Type | Attribute | Description |
args | string[] | Arguments to parse. |
|
stdout | stream.Writable | A writable stream to print logs. |
|
stderr | stream.Writable | A writable stream to print errors. |
private printHelp(output: stream.Writable): Promise source
import printHelp from 'npm-run-all/bin/help.js'
Print a help text.
Params:
Name | Type | Attribute | Description |
output | stream.Writable | A writable stream to print. |
private printVersion(output: stream.Writable): Promise source
import printVersion from 'npm-run-all/bin/version.js'
Print a version text.
Params:
Name | Type | Attribute | Description |
output | stream.Writable | A writable stream to print. |
private readTasks(): string[] source
import readTasks from 'npm-run-all/lib/read-tasks.js'
Reads package.json
in current directry, and gets all npm-scripts names.
If package.json
has not found, throws an error.
private runTask(task: string, stdin: stream.Readable | null, stdout: stream.Writable | null, stderr: stream.Writable | null, prefixOptions: string[]): Promise source
import runTask from 'npm-run-all/lib/run-task.js'
Run a npm-script of a given name.
The return value is a promise which has an extra method: abort()
.
The abort()
kills the child process to run the npm-script.
Params:
Name | Type | Attribute | Description |
task | string | A npm-script name to run. |
|
stdin | stream.Readable | null | A readable stream to send messages to stdin of child process.
If this is |
|
stdout | stream.Writable | null | A writable stream to receive messages from stdout of child process.
If this is |
|
stderr | stream.Writable | null | A writable stream to receive messages from stderr of child process.
If this is |
|
prefixOptions | string[] | An array of options which are inserted before the task name. |
Return:
Promise | A promise object which becomes fullfilled when the npm-script is completed.
This promise object has an extra method: |
private runTasksInParallel(tasks: string, stdin: stream.Readable | null, stdout: stream.Writable | null, stderr: stream.Writable | null, prefixOptions: string[]): Promise source
import runTasksInParallel from 'npm-run-all/lib/run-tasks-in-parallel.js'
Run npm-scripts of given names in parallel.
If a npm-script exited with a non-zero code, this aborts other all npm-scripts.
Params:
Name | Type | Attribute | Description |
tasks | string | A list of npm-script name to run in parallel. |
|
stdin | stream.Readable | null | A readable stream to send messages to stdin of child process.
If this is |
|
stdout | stream.Writable | null | A writable stream to receive messages from stdout of child process.
If this is |
|
stderr | stream.Writable | null | A writable stream to receive messages from stderr of child process.
If this is |
|
prefixOptions | string[] | An array of options which are inserted before the task name. |
private runTasksInSequencial(tasks: string, stdin: stream.Readable | null, stdout: stream.Writable | null, stderr: stream.Writable | null, prefixOptions: string[]): Promise source
import runTasksInSequencial from 'npm-run-all/lib/run-tasks-in-sequencial.js'
Run npm-scripts of given names in sequencial.
If a npm-script exited with a non-zero code, this aborts subsequent npm-scripts.
Params:
Name | Type | Attribute | Description |
tasks | string | A list of npm-script name to run in sequencial. |
|
stdin | stream.Readable | null | A readable stream to send messages to stdin of child process.
If this is |
|
stdout | stream.Writable | null | A writable stream to receive messages from stdout of child process.
If this is |
|
stderr | stream.Writable | null | A writable stream to receive messages from stderr of child process.
If this is |
|
prefixOptions | string[] | An array of options which are inserted before the task name. |
private spawn(command: string, args: string[], options: object): ChildProcess source
import spawn from 'npm-run-all/lib/spawn-posix.js'
Launches a new process with the given command.
This is almost same as child_process.spawn
.
This returns a ChildProcess
instance.
kill
method of the instance kills the new process and its sub processes.
Return:
ChildProcess | A ChildProcess instance of new process. |
private spawn(command: string, args: string[], options: object): ChildProcess source
import spawn from 'npm-run-all/lib/spawn-win32.js'
Launches a new process with the given command.
This is almost same as child_process.spawn
.
This returns a ChildProcess
instance.
kill
method of the instance kills the new process and its sub processes forcibly.
Return:
ChildProcess | A ChildProcess instance of new process. |