NPM-LINK(3)

πŸ“¦ version 1.2.1, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

npm-link β€” symlink a package folder. That's the whole name vibe: link up a package folder so your local code and your global install can hold hands. 🫢

✨ SYNOPSIS ✨

         npm.commands.link(callback)
         npm.commands.link(packages, callback)

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so package linking? It is literally a two-step process. No cap. ✨

  • Without parameters, link will create a globally-installed symbolic link from prefix/package-name to the current folder. Global link, current folder, slay. πŸ”₯
  • With parameters, link will create a symlink from the local node_modules folder to the global symlink. Local node_modules meets global symlink, and they're linked. πŸ’œ

When creating tarballs for npm publish, the linked packages are "snapshotted" to their current state by resolving the symbolic links. Important little detail, bestie: the snapshot happens by resolving those symbolic links. πŸŽ€

This is handy for installing your own stuff, so that you can work on it and test it iteratively without having to continually rebuild. Obsessed β€” iterative testing without the endless rebuild loop. πŸŒ€

For example:

         npm.commands.link(cb)           # creates global link from the cwd
                                         # (say redis package)
         npm.commands.link('redis', cb)  # link-install the package

Now, any changes to the redis package will be reflected in the package in the current working directory. That's the whole linked-package moment, iykyk. 🌈


πŸŽ€ That's the manual NPM-LINK(3), dated March 2017 β€” source/version and date all wrapped up with a bow. Go symlink something iconic. πŸ’–πŸŽ€
πŸ“¦ where this page comes from