Skip to content

Instantly share code, notes, and snippets.

@lxynox
Last active November 19, 2019 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lxynox/6c5045f23ed02db6c6aded82895ffccf to your computer and use it in GitHub Desktop.
Save lxynox/6c5045f23ed02db6c6aded82895ffccf to your computer and use it in GitHub Desktop.
Various ways to test a local module before publishing

Always starts from changing node_modules/ directly, for more complex use cases

🔰🔰🔰

npm link

/path/to/lib $ npm link
/path/to/app $ npm link lib
  • creates global symlink

npm install <pkg>

/path/to/app $ npm install /path/to/lib
- "@node-config": "2.0.22",
+ "@node-config": "file:../node-config",
  • modifies package.json as file:/path/to/lib
  • creates local symlink
  • runs preinstall/postinstall

npm pack

Do

/path/to/lib $ npm pack | tail -n 1

before npm i <pkg> and replace pkg with the generated tarball(pkg-[version].tgz) instead.

@lxynox
Copy link
Author

lxynox commented Sep 15, 2019

@lxynox
Copy link
Author

lxynox commented Nov 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment