Use env.npm_config_* for electron and upcoming npm #30
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.
I need this for
electron-builder
and the native addonffi-napi
, which recently started usingnode-gyp-build
for prebuilds (node-ffi-napi/node-ffi-napi#63) but I want to compile it from source. WithbuildDependenciesFromSource: true
you can instructelectron-builder
to do so, but this currently does not work withnode-gyp-build
.The problem is that the
electron-builder
tooling effectively callsnpm rebuild <dep>
and thennpm_config_argv
does not contain--build-from-source
. However,env.npm_config_build_from_source
does exist. Hooray!Incidentally, using
env.npm_config_*
is also the recommended approach by npm and works since npm 0.1.8 whilenpm_config_argv
will stop working in npm 7. See npm/rfcs#90.Related: digidem/mapeo-desktop#305