npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

instafork

v0.2.0

Published

Eject npm module source into a project locally

Downloads

5

Readme

instafork

Instantly copy the source of an npm module locally

Build Status

:warning: Use with caution. Instafork is pre-1.0.0 and the api will likely change :warning:

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