Preinstall script for NodeJS packages that enforces dependency module versions across multiple projects.
This is designed as a utility script that will automatically enforce module versions across multiple Node projects.
It is intended to be invoked by the preinstall hook of node-install found in a packages.json file.
Inside of the modules.js, modify the RUN function's argument to specify module names as keys with the version as their respective values.
Any package.json dependencies found that match anything found within RUN function's argument will be installed according to the specified version.
...
"scripts" {
"preinstall": "node ../modules.js"
...
}
...
...
"scripts" {
"preinstall": "node ../modules.js mobx,react-scripts,d3"
...
}
...