I post a solution here. It doesn't explain how to shrinkwrap symlinks but I found a better workaround to develop multiple modules at once with dependencies between those modules.
The solution is to use an alternative to npm link
to handle the modules relations during development: Instead of having a folder A linked to another folder B (aka symlink), the solution is to have the modified files from B copied in folder A. This solution is very powerful because it avoid getting node module shrinkwrapping error due to unwanted modules from B. How to do it:
On Mac
You can use wml: Wml listens to changes in some folder (using Watchman) and copies changed files into another folder. I never use it but my teammate using Mac use it every day.
On Window
I use DSynchronize (after clicking this link, scroll down to see the executable). DSynchronize is a stand-alone utility that let you periodically synchronize two or more folders. You can exclude from copying some folders (like node_modules
) or include others (like lib
). The configuration file DSynchronize.ini
can be edited with a text editor. For example:
Source0000=-C:\DEV\workspace\js-common
Destination0000=-C:\DEV\workspace\connexme\node_modules\js-common
Filter0000=
VolumeSerialOri0000=407325536
VolumeSerialDest0000=407325536
ExcludeFilter0000=0
NoSubDirectory0000=0
NoFilterDirectory0000=1
DateBeforeToExcludeFiles0000=00:00:00
FilterFolder0000=\.git|\.vscode|\node_modules
This configuration will copy file from C:\DEV\workspace\js-common
to C:\DEV\workspace\connexme\node_modules\js-common
. This way, when I npm shrinkwrap
my project connexme, I'll doesn't get extraneous bad folder from js-common
folder.
Just a three last things about editing DSynchronize.ini
for DSynchronize configuration:
- Using it or closing it will save the configuration in
DSynchronize.ini
so be careful when editing DSynchronize.ini
and the closing it. It will override DSynchronize.ini
.
- Make sure each variables is unique. Example:
Source0000
, Source0001
...
- Make sure to have all the variables present for each Source/Destinations (see example above).