Node application and several Node modules being developed simultaneously, using npm-link

I am creating a node.js application and also developing the modules needed for the application at the same time. Some of the modules have peerDependencies, and I'm struggling to figure out how to best structure my dev environment.

What I still have:

/node-projects |--/myApp |----/node_modules |------/symlink to module1 |------/symlink to module2 | |--/module1 | |--/module2 

I am using npm link to create a symbolic link in my node_modules application for modules in my root project. This allows me to easily git pop individual modules as well as my application.

However, if module2 indicates module1 as peerDependency, my application will not start reporting an error that module2 cannot find module1. I assume this is because they are not actually in the node_modules directory.

Is there a piece of the puzzle that I'm missing that will allow sym2 sym2 to recognize the symbolic link module1? Or is this what I'm trying to do now with npm? Is there a better strategy for keeping my custom modules in sync with git / github, as well as them in the main application?

+7
git npm require
source share
1 answer

After doing some more research, it seems that what I'm trying to accomplish is currently not possible using only npm link , and there seems to be no simple answer to the fact that this workflow is configured using only npm.

Reading through this issue in npm github repo. I see others experiencing the same disappointments, without any possible solutions.

I also stumbled upon the npm-workspace module, which seems to completely satisfy my question, although I have yet to try it.

Another possibility is to use Git submodules . However, when we read about git submodules, I see a lot of complaints that they are hard to configure correctly, and it seems incredibly easy to accidentally include your helper modules in your main git repository.

I will wait to accept my own answer until I have the opportunity to check the npm workspace, and at the same time, maybe someone will call back with a better solution.

+3
source share

All Articles