feat: vue upgrade monorepo support, --from option, and a new vue migrate --from command - #5091
Merged
Merged
Conversation
…path This also fixes support for monorepo. (TODO: tests)
mactanxin
pushed a commit
to mactanxin/vue-cli
that referenced
this pull request
Feb 11, 2020
… migrate --from` command (vuejs#5091) * refactor(migrator): rename `installed` to `baseVersion` * feat: `vue upgrade --from` option and a new `vue migrate` command * fix: fix support for `vuePlugins.resolveFrom` option * chore: add a fixme comment * fix: use loadModule instead of manually calculating the package.json path This also fixes support for monorepo. (TODO: tests) * fix: treat `resolveFrom` as `context`, fixing edge cases * fix: use read-pkg instead of loadModule, avoid messing up require cache * fix: getInstalledVersion still requires `loadModule` to support monorepo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains several features, but they are all to solve the
vue upgradeusability problem in complex environments, so I put them into a single PR.getInstalledVersionfunction to use theloadModuleutility, this is to support monorepo.vue upgrade --fromoption can be used as an escape hatch if the user forgets or doesn't want to runnpm installbefore upgrading, or if evenloadModulefailed to locate the installed plugin.vue migrate --fromis for those who previously failed to runvue upgradeand then upgraded the plugin version anyway, they might still want to benefit from the automated migration script. Or, because we previously used^version range in the templates, users may have installed the latest plugin unintentionally; in this case, if they want to automatically migrate to the latest template setup, they can use this command.resolveFromoption is now respected in all these commands.TODO: these changes haven't been thoroughly tested yet.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Other information: