All Projects → timoxley → Npm Run

timoxley / Npm Run

Licence: mit
Run locally-installed node module executables.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Npm Run

Yarnhook
Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically
Stars: ✭ 177 (-1.67%)
Mutual labels:  command-line, npm
Nls
Missing inspector for npm packages.
Stars: ✭ 44 (-75.56%)
Mutual labels:  npm-scripts, npm
Ntl
Node Task List: Interactive cli to list and run package.json scripts
Stars: ✭ 800 (+344.44%)
Mutual labels:  command-line, npm
Npm Run All
A CLI tool to run multiple npm-scripts in parallel or sequential.
Stars: ✭ 4,496 (+2397.78%)
Mutual labels:  npm-scripts, npm
Postinstall Build
Helper for conditionally building your npm package on postinstall
Stars: ✭ 87 (-51.67%)
Mutual labels:  npm-scripts, npm
Better Npm Run
🏃‍♂️ Better NPM scripts runner
Stars: ✭ 635 (+252.78%)
Mutual labels:  npm-scripts, npm
Yarpm
CLI tool to run npm scripts with either npm or yarn, depending on how it was started
Stars: ✭ 13 (-92.78%)
Mutual labels:  npm-scripts, npm
Ultra Runner
🏃⛰ Ultra fast monorepo script runner and build tool
Stars: ✭ 496 (+175.56%)
Mutual labels:  npm-scripts, npm
Redrun
✨🐌 🐎✨ fastest npm scripts runner
Stars: ✭ 85 (-52.78%)
Mutual labels:  npm-scripts, npm
Npm Compare
Compare npm packages from your terminal
Stars: ✭ 55 (-69.44%)
Mutual labels:  command-line, npm
Dep
A little Node.js dependency installer
Stars: ✭ 186 (+3.33%)
Mutual labels:  command-line, npm
Npm Introspect
🔎 Introspect is a tool to traverse the NPM ecosystem and identify quality modules. Use the CLI to upload and examine your project's dependencies.
Stars: ✭ 95 (-47.22%)
Mutual labels:  command-line, npm
Npm Script Naming Ideas
Ideas for naming npm scripts
Stars: ✭ 12 (-93.33%)
Mutual labels:  npm-scripts, npm
Awesome Node Utils
some useful npm packages for nodejs itself
Stars: ✭ 51 (-71.67%)
Mutual labels:  npm-scripts, npm
Nps
NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
Stars: ✭ 1,285 (+613.89%)
Mutual labels:  npm-scripts, npm
Cryptocurrency Cli
💰 Cryptocurrency Portfolio On The Command Line 💰
Stars: ✭ 99 (-45%)
Mutual labels:  command-line, npm
Projectman
ProjectMan is a command line tool to easily save/open your favorite projects right from command line. `pm add` to add projects and `pm open` to open them from anywhere you want🦸
Stars: ✭ 172 (-4.44%)
Mutual labels:  npm
Magicli
Automagically generates command-line interfaces (CLI) for any module. Expected options and help sections are created automatically based on parameters names, with support to async.
Stars: ✭ 178 (-1.11%)
Mutual labels:  command-line
Mandown
man-page inspired Markdown viewer
Stars: ✭ 173 (-3.89%)
Mutual labels:  command-line
Demo
A framework for performing live pre-recorded command line demos in the wild 📼
Stars: ✭ 179 (-0.56%)
Mutual labels:  command-line

npm-run

NPM NPM

Build Status

Run executables in node_modules from the command-line

Use npm-run to ensure you're using the same version of a package on the command-line and in package.json scripts.

Any executable available to an npm lifecycle script is available to npm-run.

Usage

> npm install mocha # mocha installed in ./node_modules
> npm-run mocha test/* # uses locally installed mocha executable 
> npm-run --help
Usage: npm-run command [...args]
Options:
  --version  Display version & exit.
  --help     Display this help & exit.

Hint: to print augmented path use:
npm-run node -p process.env.PATH

Installation

> npm install -g npm-run

Programmatic API

The API of npm-run basically wraps core child_process methods (exec, spawn, etc) such that locally install package executables will be on the PATH when the command runs.

npmRun(command[, options], callback)

Alias of npmRun.exec.

npmRun.exec(command[, options], callback)

Takes same arguments as node's exec.

npmRun.exec('mocha --debug-brk --sort', {cwd: __dirname + '/tests'}, function (err, stdout, stderr) {
  // err Error or null if there was no error
  // stdout Buffer|String
  // stderr Buffer|String
})

npmRun.sync(command[, options])

Alias of npmRun.execSync

npmRun.execSync(command[, options])

Takes same arguments as node's execSync.

var stdout = npmRun.execSync(
  'mocha --debug-brk --sort',
  {cwd: __dirname + '/tests'}
)
stdout // command output as Buffer|String

npmRun.spawnSync(command[, args][, options])

Takes same arguments as node's spawnSync.

var child = npmRun.spawnSync(
  'mocha',
  '--debug-brk --sort'.split(' '),
  {cwd: __dirname + '/tests'}
)
child.stdout // stdout Buffer|String
child.stderr // stderr Buffer|String
child.status // exit code

npmRun.spawn(command[, args][, options])

Takes same arguments as node's spawn.

var child = npmRun.spawn(
  'mocha',
  '--debug-brk --sort'.split(' '),
  {cwd: __dirname + '/tests'}
)
child.stdout // stdout Stream
child.stderr // stderr Stream
child.on('exit', function (code) {
  code // exit code
})

Why

Due to npm's install algorithm node_modules/.bin is not guaranteed to contain your executable. npm-run uses the same mechanism npm uses to locate the correct executable.

See Also

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].