npminstall
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -15,3 +15,3 @@ #!/usr/bin/env node | ||
const utils = require('../lib/utils'); | ||
const config = require('../lib/config'); | ||
const globalConfig = require('../lib/config'); | ||
const installLocal = require('..').installLocal; | ||
@@ -26,2 +26,3 @@ const installGlobal = require('..').installGlobal; | ||
'forbidden-licenses', | ||
'custom-china-mirror-url', | ||
], | ||
@@ -112,6 +113,8 @@ boolean: [ | ||
const inChina = argv.china || !!process.env.npm_china; | ||
// if exists, override default china mirror url | ||
const customChinaMirrorUrl = argv['custom-china-mirror-url']; | ||
let registry = argv.registry || process.env.npm_registry; | ||
if (inChina) { | ||
registry = registry || config.chineseRegistry; | ||
registry = registry || globalConfig.chineseRegistry; | ||
} | ||
@@ -128,4 +131,7 @@ // for env.npm_config_registry | ||
if (inChina) { | ||
for (const key in config.chineseMirrorEnv) { | ||
env[key] = config.chineseMirrorEnv[key]; | ||
for (const key in globalConfig.chineseMirrorEnv) { | ||
env[key] = globalConfig.chineseMirrorEnv[key]; | ||
if (customChinaMirrorUrl) { | ||
env[key] = env[key].replace(globalConfig.chineseMirrorUrl, customChinaMirrorUrl); | ||
} | ||
} | ||
@@ -149,2 +155,12 @@ } | ||
binaryMirrors = yield utils.getBinaryMirrors(registry); | ||
if (customChinaMirrorUrl) { | ||
for (const key in binaryMirrors) { | ||
const item = binaryMirrors[key]; | ||
if (item.host) { | ||
item.host = item.host.replace(globalConfig.chineseMirrorUrl, customChinaMirrorUrl); | ||
} | ||
} | ||
console.log('Use custom china mirror %j instead of %j', | ||
customChinaMirrorUrl, globalConfig.chineseMirrorUrl); | ||
} | ||
} | ||
@@ -151,0 +167,0 @@ |
2.0.0-beta.3 / 2016-07-28 | ||
================== | ||
* fix: ensure always can find node-gyp (#103) | ||
* feat: support custom china mirror url (#101) | ||
* chore: fix a typo, excute -> execute (#100) | ||
2.0.0-beta.2 / 2016-07-26 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -9,2 +9,3 @@ 'use strict'; | ||
}, | ||
chineseMirrorUrl: 'https://npm.taobao.org/mirrors', | ||
chineseMirrorEnv: { | ||
@@ -11,0 +12,0 @@ NODEJS_ORG_MIRROR: 'https://npm.taobao.org/mirrors/node', |
@@ -274,3 +274,3 @@ 'use strict'; | ||
if (options.postInstallTasks.length) { | ||
options.console.log(chalk.yellow('excute post install scripts...')); | ||
options.console.log(chalk.yellow('execute post install scripts...')); | ||
} | ||
@@ -301,3 +301,3 @@ for (const task of options.postInstallTasks) { | ||
} catch (err) { | ||
// If post install excute error, make sure this package won't be skipped during next installation. | ||
// If post install execute error, make sure this package won't be skipped during next installation. | ||
try { | ||
@@ -304,0 +304,0 @@ yield utils.rimraf(donefile); |
@@ -125,5 +125,5 @@ 'use strict'; | ||
env.PATH = [ | ||
path.join(__dirname, '../node-gyp-bin'), | ||
path.join(options.root, 'node_modules', '.bin'), | ||
path.join(pkgDir, 'node_modules', '.bin'), | ||
path.join(__dirname, '..', 'node_modules', '.bin'), | ||
process.env.PATH, | ||
@@ -130,0 +130,0 @@ ].join(path.delimiter); |
{ | ||
"name": "npminstall", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Let npm install fast and easy", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
83897
1927