Skip to content

Commit

Permalink
feat: use more faster cdn registry (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored May 24, 2019
1 parent 6ac8090 commit 48bbb04
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = {
npm_config_loglevel: 'http',
},
chineseMirrorUrl: 'https://npm.taobao.org/mirrors',
chineseRegistry: 'https://registry.npm.taobao.org',
chineseRegistry: 'https://r.npm.taobao.org',
};

module.exports = config;
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ exports.getTarballStream = async (url, options) => {

async function getRemotePackage(name, registry, globalOptions) {
const registries = [ registry ].concat([
'https://r.npm.taobao.org',
'https://registry.npm.taobao.org',
'https://r.cnpmjs.org',
'https://registry.npmjs.com',
Expand Down
2 changes: 1 addition & 1 deletion test/download.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('test/download.test.js', () => {
describe('mock tarball error', () => {
it('should throw sha1 error', async () => {
this.timeout = 15000;
const registry = process.env.npm_registry || 'https://registry.npm.taobao.org';
const registry = process.env.npm_registry || 'https://r.npm.taobao.org';
const res = await urllib.request(`${registry}/pedding`, { dataType: 'json', timeout: 10000 });
const pkg = res.data;
pkg.versions['1.0.0'].dist.shasum = '00098d60307b4ef7240c3d693cb20a9473c111';
Expand Down
2 changes: 1 addition & 1 deletion test/flow-bin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('test/flow-bin.test.js', () => {

it('should install flow-bin from china mirror', async () => {
if (!process.env.local) return;
const registry = process.env.local ? 'https://registry.npm.taobao.org' : 'https://registry.npmjs.org';
const registry = process.env.local ? 'https://r.npm.taobao.org' : 'https://registry.npmjs.org';
const binaryMirrors = await utils.getBinaryMirrors(registry);
await npminstall({
root: tmp,
Expand Down
2 changes: 1 addition & 1 deletion test/installRemote.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fs = require('mz/fs');
const npminstall = require('./npminstall');
const helper = require('./helper');

const registry = process.env.npm_china ? 'https://registry.npm.taobao.org' : 'https://registry.npmjs.org';
const registry = process.env.npm_china ? 'https://r.npm.taobao.org' : 'https://registry.npmjs.org';

describe('test/installRemote.test.js', () => {
const root = path.join(__dirname, 'fixtures', 'github');
Expand Down
2 changes: 1 addition & 1 deletion test/installSaveDeps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fs = require('mz/fs');
const coffee = require('coffee');
const helper = require('./helper');

const registry = process.env.npm_china ? 'https://registry.npm.taobao.org' : 'https://registry.npmjs.org';
const registry = process.env.npm_china ? 'https://r.npm.taobao.org' : 'https://registry.npmjs.org';

if (process.platform !== 'win32') {
describe('test/installSaveDeps.test.js', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/install_demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const npminstall = require('./npminstall');
// { name: 'express' },
],
// registry, default is https://registry.npmjs.org
registry: 'https://registry.npm.taobao.org',
registry: 'https://r.npm.taobao.org',
// debug: false,
// storeDir: root + '.npminstall',
});
Expand Down

0 comments on commit 48bbb04

Please sign in to comment.