Skip to content
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

feat: vue upgrade monorepo support, --from option, and a new vue migrate --from command #5091

Merged
merged 11 commits into from Jan 28, 2020

Conversation

sodatea
Copy link
Member

@sodatea sodatea commented Jan 18, 2020

This PR contains several features, but they are all to solve the vue upgrade usability problem in complex environments, so I put them into a single PR.

  1. I refactored the getInstalledVersion function to use the loadModule utility, this is to support monorepo.
  2. vue upgrade --from option can be used as an escape hatch if the user forgets or doesn't want to run npm install before upgrading, or if even loadModule failed to locate the installed plugin.
  3. vue migrate --from is for those who previously failed to run vue upgrade and 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.
  4. resolveFrom option 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)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

@sodatea sodatea merged commit 02a0e8a into vuejs:dev Jan 28, 2020
@sodatea sodatea deleted the feat-upgrade-from branch January 28, 2020 08:32
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant