Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update cnpm mirror #627

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,11 @@ Using the `npm` config argument: `--{module_name}_binary_host_mirror` can downlo
e.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`.

```bash
$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
$ npm install v8-profiler --profiler_binary_host_mirror=https://registry.npmmirror.com/node-inspector/
```

e.g.: Install [canvas-prebuilt](https://www.npmjs.com/package/canvas-prebuilt) from `npm`.

```bash
$ npm install canvas-prebuilt --canvas_prebuilt_binary_host_mirror=https://npm.taobao.org/mirrors/canvas-prebuilt/
$ npm install canvas-prebuilt --canvas_prebuilt_binary_host_mirror=https://registry.npmmirror.com/canvas-prebuilt/
```
2 changes: 1 addition & 1 deletion lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,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/
// > npm install v8-profiler --profiler_binary_host_mirror=https://registry.npmmirror.com/node-inspector/
const validModuleName = opts.module_name.replace('-', '_');
const host = process.env['npm_config_' + validModuleName + '_binary_host_mirror'] || package_json.binary.host;
opts.host = fix_slashes(eval_template(host, opts));
Expand Down
8 changes: 4 additions & 4 deletions test/versioning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ test('should detect custom binary host from env', (t) => {
}
};
// mock npm_config_test_binary_host_mirror env
process.env.npm_config_test_binary_host_mirror = 'https://npm.taobao.org/mirrors/node-inspector/';
process.env.npm_config_test_binary_host_mirror = 'https://registry.npmmirror.com/node-inspector/';
const opts = versioning.evaluate(mock_package_json, {});
t.equal(opts.host, 'https://npm.taobao.org/mirrors/node-inspector/');
t.equal(opts.host, 'https://registry.npmmirror.com/node-inspector/');
delete process.env.npm_config_test_binary_host_mirror;
t.end();
});
Expand Down Expand Up @@ -242,9 +242,9 @@ test('should replace "-" with "_" in custom binary host', (t) => {
}
};

process.env.npm_config_canvas_prebuilt_binary_host_mirror = 'https://npm.taobao.org/mirrors/node-canvas-prebuilt/';
process.env.npm_config_canvas_prebuilt_binary_host_mirror = 'https://registry.npmmirror.com/node-canvas-prebuilt/';
const opts = versioning.evaluate(mock_package_json, {});
t.equal(opts.host, 'https://npm.taobao.org/mirrors/node-canvas-prebuilt/');
t.equal(opts.host, 'https://registry.npmmirror.com/node-canvas-prebuilt/');
delete process.env.npm_config_canvas_prebuilt_binary_host_mirror;
t.end();
});
Expand Down