Skip to content

Commit

Permalink
fix(ui): fix "update all plugins/dependencies" utility (#5395)
Browse files Browse the repository at this point in the history
  • Loading branch information
motla committed May 8, 2020
1 parent c64afc3 commit e2f00d2
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions packages/@vue/cli/lib/util/ProjectPackageManager.js
Expand Up @@ -290,20 +290,26 @@ class PackageManager {
}

async upgrade (packageName) {
const realname = stripVersion(packageName)
if (
isTestOrDebug &&
(packageName === '@vue/cli-service' || isOfficialPlugin(resolvePluginId(realname)))
) {
// link packages in current repo for test
const src = path.resolve(__dirname, `../../../../${realname}`)
const dest = path.join(this.context, 'node_modules', realname)
await fs.remove(dest)
await fs.symlink(src, dest, 'dir')
return
// manage multiple packages separated by spaces
const packageNamesArray = []

for (const packname of packageName.split(' ')) {
const realname = stripVersion(packname)
if (
isTestOrDebug &&
(packname === '@vue/cli-service' || isOfficialPlugin(resolvePluginId(realname)))
) {
// link packages in current repo for test
const src = path.resolve(__dirname, `../../../../${realname}`)
const dest = path.join(this.context, 'node_modules', realname)
await fs.remove(dest)
await fs.symlink(src, dest, 'dir')
} else {
packageNamesArray.push(packname)
}
}

return await this.runCommand('add', [packageName])
if (packageNamesArray.length) return await this.runCommand('add', packageNamesArray)
}
}

Expand Down

0 comments on commit e2f00d2

Please sign in to comment.