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

@darkobits/nlink

v3.1.8

Published

An improved 'npm link'.

Downloads

24

Readme

This tool is intended to be a suppliment to npm link in certain exotic cases where npm link doesn't do exactly what you want it to do.

It is especially useful for local development in large monorepos.

Install

npm install --save-dev @darkobits/nlink

Use

CLI

nlink has the same API as npm link, which has two modes of operation:

nlink [options]

Like npm link, this command should be run from a package you wish to link-to elsewhere.

Unlike npm link, which symlinks the entire package folder, nlink creates a folder and then symlinks only the following items into it:

  • packge.json
  • node_modules
  • Anything declared in "files" in package.json.
  • Anything declared in "bin" in package.json.

This creates a more "production-like" environment for the linked package, which helps to avoid issues that can sometimes arise when the entire project's source folder is linked.

To create a linkable package, but skip linking binaries:

nlink --bin=false

These behaviors are configurable. For a full list of options, see --help.

nlink <packageOrPattern>

Like npm link <package name>, but supports globbing to link several packages at once.

Patterns are matched against the contents of package-lock.json. If the project does not have a package-lock.json, or if the provided input does not match any dependencies therein, nlink will fall-back to treating the input as an explicit package name. In this case, if the input is a valid NPM package name, nlink will attempt to link to it. If an invalid name or glob pattern was provided, nlink will abort.

Because nlink matches against a project's lockfile, it is possible to link to transitive dependencies.

Note: This command uses minimatch under the hood, which was designed to work primarily with filesystems. Therefore, treat scoped packages like a directory structure.

For example, to match all @babel-scoped packages, you will need a globstar:

nlink '@babel/**'

To link @babel/core and any Babel plugins, but no other Babel packages:

nlink '@babel/{core,plugin*}'

Node API

Both functions used by the CLI are available for programmatic use. Please refer to the source for specifics.

Debugging

This package respects the LOG_LEVEL environment variable, and uses the standard NPM log levels. For more verbose output, try LOG_LEVEL=silly nlink ....

Additionally, you may pass --dry-run to either form of the command, which will automatically enable more verbose logging.