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

Update ProjectPackageManager.js upgrade() method: manage multiple package names separated by spaces #5395

Merged
merged 2 commits into from May 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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