I am developing a npm package. Lets call it my-library. I publish this package to a private npm repository which is pulled by many of my projects. How can I quickly develop the code in my-library without having to publish a new version of my-library every time I make a small change?
Take the following workflow for example:
my-library. The change is still in development so I don't want to publish it to all my consumers yet, but I do want to test it locally.npm pack to create a local .tgz file.my-consumer I update the package.json to reference this local .tgz file. "my-library": "file:../some/path/my-package.tgz"npm install in my-consumer and my local package is not installed and I can test my app.Now, there isn't anything apparently wrong with the aforementioned steps, but say I am very quickly iterating on my-library and I want to make and test changes very quickly. Is there any way I can make the above process go faster? Running pack and install for every little change takes time and is much slower than if this were hot-reloading. Can I configure my package.json in my-consumer to use a cached version of my-library that is not in the node_modules folder and skip some of the above steps? I also don't want this to introduce any dependency issues.
I'm using npm/yarm link for that. it allows you to symlink your library to your project, and therefore have the most updated code without any publish and install.
Basically the syntax is:
cd /path/to/lib
yarn link
cd /path/to/project
yarn link myLibName
Take a look at the yarn link docs.