(This project is deprecated and not maintained. See FAQ.
Instantly copy the source of an npm module locally
Injects package content into your file system. Think of it like a fork, except there is no publish step since all module files are in your project source. This means a package is immediately editable for quick iteration.
npm install --global instafork
Usage
$ instafork <npm module name>
Examples
$ instafork express
//=> Eject contents of express in current directory
$ mkdir src && instafork express
//=> Eject contents of express into ./src instead if it exists
-
What operating systems are supported?
- Unix and Linux. Windows is not supported because it handles
tar
files different from how *nix systems, so that is left out. PR's welcome.
- Unix and Linux. Windows is not supported because it handles
-
Why eject to
./src
if that directory exists?- If you have a
src
directory in your current file location, it's likely you're using some type of build process like babel. Because of this, you can collocate and transpile your newly instaforked module all fromsrc
.
- If you have a
Instafork accepts a custom logger object for if you want to log it's usage. The logger passed in has to have a log
method that will be called with three arguments:
/**
* @param {string} packageName The name of a package that is being ejected.
* @param {string} errorMessage The error message if any while ejecting a package.
* @param {Function} cb A callback function that needs to be called
*/
class Logger {
log(packageName, errorMessage, cb) {
console.log(package, errorMessage);
cb();
}
}
Create a wrapper on top of instafork and pass in your custom Logger:
const instafork = require('instafork');
const logger = new Logger();
instafork(cliInput, cliOptions, logger);
This project was developed with flow and yarn. Ensure that flow check
passes in your contribution. It's included in npm test
for you already.
Adding a new dependency:
yarn add <new dep>
MIT