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://cnpmjs.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 a7df8b3
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 env: {module_name}_BINARY_HOST_MIRROR
// e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25
// > export PROFILER_BINARY_HOST_MIRROR=https://cnpmjs.org/mirrors/node-inspector/
var host = process.env[opts.module_name.toUpperCase() + '_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 a7df8b3

Please sign in to comment.