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

fix(upgrade): correctly update version range in package.json #4546

Merged
merged 1 commit into from
Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(upgrade): correctly update version range in package.json
  • Loading branch information
haoqunjiang committed Sep 6, 2019
commit 2b4d37dc2147ed9080a889f024c8fa95c06f69cc
3 changes: 3 additions & 0 deletions packages/@vue/cli/__tests__/Upgrader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ test('upgrade: plugin-babel v3.5', async () => {
expect(updatedPkg.dependencies).toHaveProperty('core-js')

expect(logs.log.some(([msg]) => msg.match('core-js has been upgraded'))).toBe(true)

// should have updated the version range in package.json
expect(updatedPkg.devDependencies['@vue/cli-plugin-babel']).not.toMatch('3.5.3')
})

test('upgrade: plugin-babel with core-js 2', async () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/@vue/cli/lib/Upgrader.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ module.exports = class Upgrader {
log(`Upgrading ${packageName} from ${installed} to ${targetVersion}`)
await this.pm.upgrade(`${packageName}@^${targetVersion}`)

// the cached `pkg` field won't automatically update after running `this.pm.upgrade`
this.pkg[depEntry][packageName] = `^${targetVersion}`
await this.runMigrator(packageName, { installed })
}

Expand Down