Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

uber-archive/instafork

Repository files navigation

instafork

(This project is deprecated and not maintained. See FAQ.

Instantly copy the source of an npm module locally

Build Status

⚠️ Use with caution. Instafork is pre-1.0.0 and the api will likely change ⚠️

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.

Installation

npm install --global instafork

Usage

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

FAQ

  • 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.
  • 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 from src.

API

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);

Development

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>

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published