Skip to content

Commit

Permalink
Support custom binary hosting mirror
Browse files Browse the repository at this point in the history
Like we setup a mirror site for node-inspector at
https://npm.taobao.org/mirrors/node-inspector/

These mirrors try to help people download binary files from China.
  • Loading branch information
fengmk2 committed Jul 10, 2015
1 parent ff72f35 commit bab7404
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ module.exports.evaluate = function(package_json,options) {
module_main: package_json.main,
toolset : options.toolset || '' // address https://github.com/mapbox/node-pre-gyp/issues/119
};
opts.host = fix_slashes(eval_template(package_json.binary.host,opts));
// 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=http://npm.taobao.org/mirrors/node-inspector/
var host = 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
if (options.module_root) {
Expand Down

0 comments on commit bab7404

Please sign in to comment.