How can you use packages being developed locally in other projects - without publishing them to npm repository?
NPM Packages Make Life Exciting
NPM makes it really easy to create packages and reuse them across projects.
I am not even talking about big, useful libraries like Vue, Loadash etc. - just the routine problems across our projects.
For example -
- I use a module to validate a bunch of things and start user subscription for an app
- I use similar starter theme for sites across projects
It is easier to create NPM packages and reuse them instead of copying the code everywhere and starting the great struggle for its maintenance.
All we need to do is to go the project folder and do -
Lo and behold - your package is ready for reuse.
While publishing packages is all dandy, what if you are creating a product that has multiple repositories and developing stuff simultaneously?
The most basic way to solve this will be -
- Make changes. Publish
- Retrieve package from the consuming application. Rejoice
This may be fine if you are looking at version controlling changes ** after ** development. But the crazy iterations that make up dev/testing may make this arrangement counter productive.
While publishing to some sort of repository or initiating a build process from GitHub should be the considered options for teams, crazy individuals may have an easier way out.
Let’s say you are developing
awesub has a dependency on
Navigate to the project folder of
aweval. Do -
This will create a locally available package called
Now, go to the project folder for
awesub. Do -
npm link aweval
This will link the
awesub project to the locally available
Any changes in
aweval do not need to be published anymore. You can just start
awesub and see the latest features available - as quick as that.
I want more features