Skip to content

Commit

Permalink
fix(upgrade): correctly update version range in package.json (#4546)
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Sep 6, 2019
1 parent 4aba6e1 commit b799b83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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

0 comments on commit b799b83

Please sign in to comment.