npm-spawn
v0.1.0
Published
- Use npm programmatically
Downloads
1
Readme
npm-spawn
Use npm programmatically
In Cli
npm install
In npm-spawn
var npmCmd = require('npm-spawn');
npmCmd(['install'], options)
Examples
npm install => npmCmd(['install'])
npm run build => npmCmd(['run','build])
args
npm install ['install']
npm run build ['run', 'build']
Options
format like below:
var options = {cwd:'src'};
- command The command to run
- args List of string arguments
- options
- cwd Current working directory of the child process
- env Environment key-value pairs
- stdio | Child's stdio configuration. (See options.stdio)
- detached Prepare child to run independently of its parent process. Specific behavior depends on the platform, see options.detached)
- uid Sets the user identity of the process. (See setuid(2).)
- gid Sets the group identity of the process. (See setgid(2).)
- shell | If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and 'cmd.exe' on Windows. A different shell can be specified as a string. The shell should understand the -c switch on UNIX, or /s /c on Windows. Defaults to false (no shell).