WIP: Introduce optional dependencies to streamline platform-specific installation #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Our js-quic now published optional packages
I want to apply this to js-db too, so we can do streamline the installation and also be able to self-publish at least just the Linux one.
This involves replacing how we do our
prebuild.js
in particular and bringing in thescripts/prebuild.js
,scripts/prepublishOnly.js
andscripts/version.js
.We may also need to fix up our CI/CD scripts too.
Without the GitLab CI/CD we can only do the linux build and windows builds. So we can delay having the macos ones.
Note that we rely on
node-gyp-build
package for both detection and auto-building the local dependency when installed. We don't havenode-gyp-build
injs-quic
, thus there's no automatic compilation upon installation. Instead if none of the native dependencies can be found, it's necessary for the user to compile their own (which is a bit of a pain)... since compilation requires running a certain script, specificallynpm run prebuild
. However that's not really possible while we are installingjs-quic
as a dependency. We could do something similar with our own install script, but such a script/command has to exist in the packaged distribution and we actually ignore all/scripts
in our.npmignore
.At the end of the day, I'm not even sure if it makes sense to enable automatic compilation. Really if it is not available, they have to source it from somewhere and place it in the right location. Specifically the custom loader will look for it in just the local
prebuild/
directory. So figure out a compilation routine and then distribute it duringnpm install
. The problem with relying onnpm install
to compile the native binary is that there's no guarantee that all the tools are available to do this for the end user. So therefore one should think ofnpm install
as the final distribution here, for power users, they should be using the gitlab repository, possibly directly refer to it as a dependency, or submit a build for this opensource repo.Fixes #43
Fixes #44
Tasks
js-quic
node-gyp-build
with just your own loader script, copied fromjs-quic
.install
command ofnode-gyp-build
. It would not be necessary... as it simply detects if the binary already exists, and if not ends up calling a build to do a local compilation.Final checklist