## What?
Last updated a year ago by exogen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install npm-extends 
SYNC missed versions from official npm registry.

npm-extends ????


This abuses npm’s onload-script option, which can be set on a per-project basis, to poison the require.cache entry for npm’s run-script command with a cooler version that runs a custom CLI of your choosing if the specified script isn’t in package.json.

Should I use this?


But how would I use it, in theory?

Install npm-extends in your project, then add an .npmrc file to your project with this line:


(Yes, unfortunately this will not work when you run npm from directories below your package.json. You could probably make it work by installing npm-extends globally.)

Add an npm:extends script to scripts in your package.json file that runs the command you’d like to use instead of npm run when a script isn’t found. It will be passed the script name and arguments.

  "scripts": {
    "npm:extends": "your-cli",
    "boring-script": "echo This is boring!"

Now you can run scripts that aren’t in there, but are supported by your tool!

$ npm run boring-script

> echo BooOoOOOriing


$ npm run cool-script

> your-cli "cool-script"

WaaAAaay cooler!

Current Tags

  • 0.1.5                                ...           latest (a year ago)

6 Versions

  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © |