Skip to content

feat!: redesigns vue upgrade, supports code migration #4090

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

Merged
merged 23 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3611ff6
feat: [WIP] add MigratorAPI for `vue upgrade` usage
haoqunjiang May 22, 2019
768c280
refactor: move readFiles to a separate file
haoqunjiang Jun 14, 2019
b48c98c
refactor: unify get registry logic
haoqunjiang Jun 14, 2019
d89976f
chore: merge branch 'dev' into migrations
haoqunjiang Jun 17, 2019
369e9ca
feat: implement update package.json only
haoqunjiang Jun 18, 2019
bc7be7e
refactor: make the code conciser
haoqunjiang Jun 18, 2019
30a4f8a
refactor: replace installPackage with updatePackage
haoqunjiang Jun 20, 2019
ff8bba4
feat: add cache for metadata
haoqunjiang Jun 20, 2019
e805dd2
feat: implement checkForUpdates
haoqunjiang Jun 20, 2019
0082d67
chore: use `chalk.underline` to draw the border line
haoqunjiang Jun 21, 2019
582b1f1
fix: fix runtime bugs
haoqunjiang Jun 24, 2019
0dd33c0
chore: remove legacy @vue/cli-upgrade pacakage
haoqunjiang Jun 28, 2019
185aec0
chore: mark `vue upgrade` as experimental
haoqunjiang Jun 28, 2019
776a21a
chore: setup test for upgrade command
haoqunjiang Jun 28, 2019
c24b18c
chore: merge branch 'dev' into migrations
haoqunjiang Jun 28, 2019
52720f2
chore: merge branch 'dev' into migrations
haoqunjiang Jun 28, 2019
1336e7b
test: fix migrator test setup
haoqunjiang Jun 30, 2019
0d7bb2c
feat: implement `vue upgrade --all`
haoqunjiang Jul 1, 2019
b84950e
feat: allow short plugin id
haoqunjiang Jul 1, 2019
68630df
chore: remove outdated comment
haoqunjiang Jul 1, 2019
2ffad89
feat: babel migrator
haoqunjiang Jul 1, 2019
83c6f5f
chore: rename test folder
haoqunjiang Jul 1, 2019
82acd41
fix: fix forceNewVersion
haoqunjiang Jul 2, 2019
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
26 changes: 26 additions & 0 deletions packages/@vue/cli-plugin-babel/migrator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { chalk } = require('@vue/cli-shared-utils')

module.exports = (api) => {
// TODO: backport this part to v3
// if (api.fromVersion('<=3.5.3')) {
// // add core-js@2 as dependency
// api.extendPackage({
// dependencies: {
// 'core-js': '^2.6.5'
// }
// })
// }

if (api.fromVersion('^3')) {
api.extendPackage({
dependencies: {
'core-js': '^3.1.2'
}
}, true)

// TODO: implement a codemod to migrate polyfills
api.exitLog(`core-js has been upgraded from v2 to v3.
If you have any custom polyfills defined in ${chalk.yellow('babael.config.js')}, please be aware their names may have been changed.
For more complete changelog, see https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300---20190319`)
}
}
1 change: 1 addition & 0 deletions packages/@vue/cli-plugin-typescript/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = (api, {
tsLint,
lintOn = []
}, _, invoking) => {
debugger
if (typeof lintOn === 'string') {
lintOn = lintOn.split(',')
}
Expand Down
1 change: 1 addition & 0 deletions packages/@vue/cli-shared-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@

exports.chalk = require('chalk')
exports.execa = require('execa')
exports.semver = require('semver')
4 changes: 4 additions & 0 deletions packages/@vue/cli-shared-utils/lib/spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ exports.resumeSpinner = () => {
spinner.start()
}

exports.failSpinner = (text) => {
spinner.fail(text)
}

// silent all logs except errors during tests and keep record
if (process.env.VUE_CLI_TEST) {
require('./_silence')('spinner', exports)
Expand Down
8 changes: 4 additions & 4 deletions packages/@vue/cli-ui/apollo-server/connectors/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function install ({ id, type, range }, context) {
arg = id
}

await installPackage(cwd.get(), getCommand(cwd.get()), null, arg, type === 'devDependencies')
await installPackage(cwd.get(), getCommand(cwd.get()), arg, type === 'devDependencies')

logs.add({
message: `Dependency ${id} installed`,
Expand Down Expand Up @@ -239,7 +239,7 @@ function uninstall ({ id }, context) {

const dep = findOne(id, context)

await uninstallPackage(cwd.get(), getCommand(cwd.get()), null, id)
await uninstallPackage(cwd.get(), getCommand(cwd.get()), id)

logs.add({
message: `Dependency ${id} uninstalled`,
Expand All @@ -265,7 +265,7 @@ function update ({ id }, context) {

const dep = findOne(id, context)
const { current, wanted } = await getVersion(dep, context)
await updatePackage(cwd.get(), getCommand(cwd.get()), null, id)
await updatePackage(cwd.get(), getCommand(cwd.get()), id)

logs.add({
message: `Dependency ${id} updated from ${current} to ${wanted}`,
Expand Down Expand Up @@ -310,7 +310,7 @@ function updateAll (context) {
args: [updatedDeps.length]
})

await updatePackage(cwd.get(), getCommand(cwd.get()), null, updatedDeps.map(
await updatePackage(cwd.get(), getCommand(cwd.get()), updatedDeps.map(
p => p.id
).join(' '))

Expand Down
8 changes: 4 additions & 4 deletions packages/@vue/cli-ui/apollo-server/connectors/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function install (id, context) {
if (process.env.VUE_CLI_DEBUG && isOfficialPlugin(id)) {
mockInstall(id, context)
} else {
await installPackage(cwd.get(), getCommand(cwd.get()), null, id)
await installPackage(cwd.get(), getCommand(cwd.get()), id)
}
await initPrompts(id, context)
installationStep = 'config'
Expand Down Expand Up @@ -412,7 +412,7 @@ function uninstall (id, context) {
if (process.env.VUE_CLI_DEBUG && isOfficialPlugin(id)) {
mockUninstall(id, context)
} else {
await uninstallPackage(cwd.get(), getCommand(cwd.get()), null, id)
await uninstallPackage(cwd.get(), getCommand(cwd.get()), id)
}
currentPluginId = null
installationStep = null
Expand Down Expand Up @@ -520,7 +520,7 @@ function update ({ id, full }, context) {
if (localPath) {
await updateLocalPackage({ cwd: cwd.get(), id, localPath, full }, context)
} else {
await updatePackage(cwd.get(), getCommand(cwd.get()), null, id)
await updatePackage(cwd.get(), getCommand(cwd.get()), id)
}

logs.add({
Expand Down Expand Up @@ -583,7 +583,7 @@ async function updateAll (context) {
args: [updatedPlugins.length]
})

await updatePackage(cwd.get(), getCommand(cwd.get()), null, updatedPlugins.map(
await updatePackage(cwd.get(), getCommand(cwd.get()), updatedPlugins.map(
p => p.id
).join(' '))

Expand Down
3 changes: 0 additions & 3 deletions packages/@vue/cli-upgrade/bin/vue-cli-upgrade.js

This file was deleted.

38 changes: 0 additions & 38 deletions packages/@vue/cli-upgrade/get-upgradable-version.js

This file was deleted.

153 changes: 0 additions & 153 deletions packages/@vue/cli-upgrade/index.js

This file was deleted.

30 changes: 0 additions & 30 deletions packages/@vue/cli-upgrade/package.json

This file was deleted.

Loading