mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-09-29 16:57:06 +08:00
feat(upgrade): prevent changing the structure of package.json file during upgrade (#7167)
Co-authored-by: blzsaa <blzsaa@users.noreply.github.com>
This commit is contained in:
@@ -192,7 +192,8 @@ module.exports = class Generator {
|
||||
|
||||
async generate ({
|
||||
extractConfigFiles = false,
|
||||
checkExisting = false
|
||||
checkExisting = false,
|
||||
sortPackageJson = true
|
||||
} = {}) {
|
||||
await this.initPlugins()
|
||||
|
||||
@@ -203,7 +204,9 @@ module.exports = class Generator {
|
||||
// wait for file resolve
|
||||
await this.resolveFiles()
|
||||
// set package.json
|
||||
this.sortPkg()
|
||||
if (sortPackageJson) {
|
||||
this.sortPkg()
|
||||
}
|
||||
this.files['package.json'] = JSON.stringify(this.pkg, null, 2) + '\n'
|
||||
// write/update file tree to disk
|
||||
await writeFileTree(this.context, this.files, initialFiles, this.filesModifyRecord)
|
||||
|
||||
@@ -31,7 +31,8 @@ async function runMigrator (context, plugin, pkg = getPkg(context)) {
|
||||
log(`🚀 Running migrator of ${plugin.id}`)
|
||||
await migrator.generate({
|
||||
extractConfigFiles: true,
|
||||
checkExisting: true
|
||||
checkExisting: true,
|
||||
sortPackageJson: false
|
||||
})
|
||||
|
||||
const newDeps = migrator.pkg.dependencies
|
||||
|
||||
Reference in New Issue
Block a user