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

npmlink-cp

v0.1.1

Published

Simulates npm link by copying the filtered files using the same rules than npm publish/npm install

Downloads

2

Readme

npmlink-cp

An extremely lightweight (less than 100 lines of code) but powerful Node.js tool that simulates npm link by copying the files using the same rules of filtering than npm publish and npm install use[1].

It's all done inside the code without any third dependencies[2].

Background (why)

There are situations when your awesome-package becomes unstable using npm link when you tries to use a library of your own that it's not as mature as you'd like, so you need to make one or two fixes on it once a while.

This has happened to me in packages that use module bundlers/uglifiers and libraries that depends on database drivers.

Alternative solutions

There are several workarounds to this issue.

Use npm

Execute npm publish+npm install or npm pack+tar -x everytime you make any alterations on your dependencies.

  • Pros: You don't have to install anything additional (perhaps tar).
  • Cons: Too slow.

Create your own script

Create a shell script top copy the exact files that npm would create by itself.

  • Pros: You don't have to install anything additional.
  • Cons: You need to create different scripts for each linked dependency (or a complex script that accepts different file lists or then parsing the package.json, .npmignore, etc.).

Install some third party tools

There are some tools that already do this work for you.

  • Pros: You only have to make a npm install -g ...
  • Cons:
    • Most of these tools depend on several other packages, populating your global space with potential version problems or at least occuping more space than necessary.
    • Most of them don't follow the rules to include or ignore files that npm use, making a copy of all files (except node_modules).

Installation

$ npm install -g npmlink-cp

Usage

$ npmlink-cp <path to package1> [<path to package2>]...]

Footnotes

[1]: bundledDependencies are not yet supported.

[2]: NodeJs 10+ is required. To test it, we're using mock-fs, jasmine, and istanbul.