Skip to content

Commit

Permalink
Add a variant for config get registry (#4530)
Browse files Browse the repository at this point in the history
* Update shouldUseTaobao.js

* Fixes linting
  • Loading branch information
arcanis authored and pksunkara committed Oct 11, 2019
1 parent 5cce80c commit 3aa513a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/@vue/cli/lib/util/shouldUseTaobao.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ module.exports = async function shouldUseTaobao (command) {
return val
}

const userCurrent = (await execa(command, ['config', 'get', 'registry'])).stdout
const defaultRegistry = registries[command]
let userCurrent
try {
userCurrent = (await execa(command, ['config', 'get', 'registry'])).stdout
} catch (registryError) {
try {
// Yarn 2 uses `npmRegistryServer` instead of `registry`
userCurrent = (await execa(command, ['config', 'get', 'npmRegistryServer'])).stdout
} catch (npmRegistryServerError) {
return save(false)
}
}

const defaultRegistry = registries[command]
if (removeSlash(userCurrent) !== removeSlash(defaultRegistry)) {
// user has configured custom registry, respect that
return save(false)
Expand Down

0 comments on commit 3aa513a

Please sign in to comment.