From 9b4eceba4769fc744e7954136f68ae638af826b9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Sep 2017 00:49:38 +0800 Subject: [PATCH] support setting binary mirror host for all packages --- README.md | 6 +++++- lib/util/versioning.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c18467a5..54e0dd8e 100644 --- a/README.md +++ b/README.md @@ -576,10 +576,14 @@ The options are visible in the code at 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 envPrefix = 'npm_config'; + var envSuffix = 'binary_host_mirror'; + var moduleMirrorHost = process.env[envPrefix + '_' + opts.module_name + '_' + envSuffix]; + var globalMirrorHost = process.env[envPrefix + '_' + envSuffix]; + var host = moduleMirrorHost || globalMirrorHost || 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