Npm allows the use of a custom git URL to specify a dependency (see npm install private github repositories by dependency in package.json).
However, these dependencies are usually packed and published to npm registry, so they can be installed by name. This publish process usually includes build files, minified files, etc. that are usually not available in github.
When installing the dependencies with a custom git URL, these build, minify, etc. files might be needed, however they will not be available.
To generate these files, npm scripts could be used to run a hook in the install lifecycle. However, I could not find the proper script for this task as:
prepare
and prepublishOnly
npm pack
and npm publish
and also when installing git dependencies (as explained in the documentation). However, it was not triggered when trying this script in a global install (node LTS version: v6.11.0, npm version (from node LTS): 3.10.10).Don't use install. Use a .gyp file for compilation, and prepublish for anything else. You should almost never have to explicitly set a preinstall or install script. If you are doing this, please consider if there is another option. The only valid use of install or preinstall scripts is for compilation which must be done on the target architecture.
prepare
node script does the trick. However this npm script is only available from npm v5.0.0
as explained here: https://github.com/npm/npm/blob/dcc4273cadebe70f853e6d948a425978bc42e045/CHANGELOG.md#feature-summary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With