Skip to content

Commit

Permalink
Simplify use of binaries off a local artifactory
Browse files Browse the repository at this point in the history
Allow installing a package with many dependent packages using node-pre-gyp binaries off the same local artifactory.

Avoid erasing the subpath in the mirror value.
  • Loading branch information
ilatypov committed Aug 31, 2018
1 parent d606a69 commit dffeb29
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ module.exports.evaluate = function(package_json,options,napi_build_version) {
// support host mirror with npm config `--{module_name}_binary_host_mirror`
// e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25
// > npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host;
var host = process.env.npm_config_binary_host_mirror || process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host;
opts.host = fix_slashes(eval_template(host,opts));
opts.module_path = eval_template(package_json.binary.module_path,opts);
// now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably
Expand All @@ -322,6 +322,9 @@ module.exports.evaluate = function(package_json,options,napi_build_version) {
}
opts.module = path.join(opts.module_path,opts.module_name + '.node');
opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path,opts))) : default_remote_path;
if (opts.remote_path.charAt(0) == "/") {
opts.remote_path = opts.remote_path.substr(1);
}
var package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name;
opts.package_name = eval_template(package_name,opts);
opts.staged_tarball = path.join('build/stage',opts.remote_path,opts.package_name);
Expand Down

0 comments on commit dffeb29

Please sign in to comment.