Skip to content

Latest commit

 

History

History
103 lines (65 loc) · 1.95 KB

readme.md

File metadata and controls

103 lines (65 loc) · 1.95 KB

npm-exec

A util for just running a npm script

1. Install

$ npm install --save standalone-npm-exec

2. Usage

const npmExec = require('npm-exec');

npmExec(script, args, pkgdata, wd, function (er) {
  if (er) {
    // Something bad happened
  }
  // Yay!
});

3. API

3.1. npmExec(name, argsForScript, pkgdata, wd, cb)

3.1.1. input

Type: string

The script name to execute. Can either be a script defined in pkgdata or the name of a file in wd/node_modules/.bin.

3.1.2. argsForScript

Type: Array<string>

Any args for the script you are running.

3.1.3. pkgdata

Type: Object

The parsed package.json data for where the script should be executed.

3.1.4. wd

Type: path

The working directory of where to find executables and where to execute the scripts.

3.1.5. cb

Type: function(err)

The function to be called when it is done.

4. CLI

$ npm install --global npm-exec
$ npm-exec --help
Usage
npm-exec [name] [args...]

Arguments
  name: Name of script to run or executable
    If not provided, npm-exec will prompt you to give it a name
  args: Arguments for the script [Default: None]

Examples
  $ npm-exec
  $ npm-exec test
  $ npm-exec eslint *.js

5. License

MIT © legodude17