Skip to content

Commit 867c6ea

Browse files
authored
feat!: redesigns vue upgrade, supports code migration (#4090)
1 parent 273d05f commit 867c6ea

29 files changed

+619
-304
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { chalk } = require('@vue/cli-shared-utils')
2+
3+
module.exports = (api) => {
4+
// TODO: backport this part to v3
5+
// if (api.fromVersion('<=3.5.3')) {
6+
// // add core-js@2 as dependency
7+
// api.extendPackage({
8+
// dependencies: {
9+
// 'core-js': '^2.6.5'
10+
// }
11+
// })
12+
// }
13+
14+
if (api.fromVersion('^3')) {
15+
api.extendPackage({
16+
dependencies: {
17+
'core-js': '^3.1.2'
18+
}
19+
}, true)
20+
21+
// TODO: implement a codemod to migrate polyfills
22+
api.exitLog(`core-js has been upgraded from v2 to v3.
23+
If you have any custom polyfills defined in ${chalk.yellow('babael.config.js')}, please be aware their names may have been changed.
24+
For more complete changelog, see https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300---20190319`)
25+
}
26+
}

packages/@vue/cli-plugin-typescript/generator/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = (api, {
33
tsLint,
44
lintOn = []
55
}, _, invoking) => {
6+
debugger
67
if (typeof lintOn === 'string') {
78
lintOn = lintOn.split(',')
89
}

packages/@vue/cli-shared-utils/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717

1818
exports.chalk = require('chalk')
1919
exports.execa = require('execa')
20+
exports.semver = require('semver')

packages/@vue/cli-shared-utils/lib/spinner.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ exports.resumeSpinner = () => {
4343
spinner.start()
4444
}
4545

46+
exports.failSpinner = (text) => {
47+
spinner.fail(text)
48+
}
49+
4650
// silent all logs except errors during tests and keep record
4751
if (process.env.VUE_CLI_TEST) {
4852
require('./_silence')('spinner', exports)

packages/@vue/cli-ui/apollo-server/connectors/dependencies.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function install ({ id, type, range }, context) {
211211
arg = id
212212
}
213213

214-
await installPackage(cwd.get(), getCommand(cwd.get()), null, arg, type === 'devDependencies')
214+
await installPackage(cwd.get(), getCommand(cwd.get()), arg, type === 'devDependencies')
215215

216216
logs.add({
217217
message: `Dependency ${id} installed`,
@@ -239,7 +239,7 @@ function uninstall ({ id }, context) {
239239

240240
const dep = findOne(id, context)
241241

242-
await uninstallPackage(cwd.get(), getCommand(cwd.get()), null, id)
242+
await uninstallPackage(cwd.get(), getCommand(cwd.get()), id)
243243

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

266266
const dep = findOne(id, context)
267267
const { current, wanted } = await getVersion(dep, context)
268-
await updatePackage(cwd.get(), getCommand(cwd.get()), null, id)
268+
await updatePackage(cwd.get(), getCommand(cwd.get()), id)
269269

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

313-
await updatePackage(cwd.get(), getCommand(cwd.get()), null, updatedDeps.map(
313+
await updatePackage(cwd.get(), getCommand(cwd.get()), updatedDeps.map(
314314
p => p.id
315315
).join(' '))
316316

packages/@vue/cli-ui/apollo-server/connectors/plugins.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ function install (id, context) {
334334
if (process.env.VUE_CLI_DEBUG && isOfficialPlugin(id)) {
335335
mockInstall(id, context)
336336
} else {
337-
await installPackage(cwd.get(), getCommand(cwd.get()), null, id)
337+
await installPackage(cwd.get(), getCommand(cwd.get()), id)
338338
}
339339
await initPrompts(id, context)
340340
installationStep = 'config'
@@ -412,7 +412,7 @@ function uninstall (id, context) {
412412
if (process.env.VUE_CLI_DEBUG && isOfficialPlugin(id)) {
413413
mockUninstall(id, context)
414414
} else {
415-
await uninstallPackage(cwd.get(), getCommand(cwd.get()), null, id)
415+
await uninstallPackage(cwd.get(), getCommand(cwd.get()), id)
416416
}
417417
currentPluginId = null
418418
installationStep = null
@@ -520,7 +520,7 @@ function update ({ id, full }, context) {
520520
if (localPath) {
521521
await updateLocalPackage({ cwd: cwd.get(), id, localPath, full }, context)
522522
} else {
523-
await updatePackage(cwd.get(), getCommand(cwd.get()), null, id)
523+
await updatePackage(cwd.get(), getCommand(cwd.get()), id)
524524
}
525525

526526
logs.add({
@@ -583,7 +583,7 @@ async function updateAll (context) {
583583
args: [updatedPlugins.length]
584584
})
585585

586-
await updatePackage(cwd.get(), getCommand(cwd.get()), null, updatedPlugins.map(
586+
await updatePackage(cwd.get(), getCommand(cwd.get()), updatedPlugins.map(
587587
p => p.id
588588
).join(' '))
589589

packages/@vue/cli-upgrade/bin/vue-cli-upgrade.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/@vue/cli-upgrade/get-upgradable-version.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/@vue/cli-upgrade/index.js

Lines changed: 0 additions & 153 deletions
This file was deleted.

packages/@vue/cli-upgrade/package.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)