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

[WIP] feat: add MigratorAPI for `vue upgrade` usage #4090

Draft
wants to merge 6 commits into
base: dev
from

Conversation

Projects
None yet
1 participant
@sodatea
Copy link
Member

commented Jun 2, 2019

The basic idea

Inspired by https://nodepackjs.com/guide/app-migrations.html and https://github.com/angular/angular-cli/blob/master/docs/specifications/update.md


The new vue upgrade command

Usage: upgrade [options] [package-name]

upgrade vue cli service / plugins

Options:
  -t, --to <version>    upgrade to a version that is not latest
  -r, --registry <url>  Use specified npm registry when installing dependencies

The old command is only an adapter for npm install and only takes care of core plugins.

After this change, third-party plugins can also benefit from this command.

In the future, we may also extend this utility for core package migrations (if possible) (e.g. vue upgrade vuex --to 4.0.0)


The new MigratorAPI:

Basically the same as GeneratorAPI, except for one more method: fromVersion and it's triggered on plugin upgrade only.
Migrator implementation should be located under ./migrator directory.

The idea is to provide a minimal API interface for migration utilities and to be fully programmable/customizable.

Later I'd also like to add a few handy helper methods to both GeneratorAPI and MigratorAPI, such as api.move and api.remove.


TODOs in this PR:

  • clean the code (there're all kinds of TODOs and FIXMEs in it and many functionalities are broken)
  • interactive "upgrade all" command
  • tests
  • documentation
  • an example migrator (in the babel plugin)

A few ideas with regard to the GeneratorAPI:

@sodatea sodatea requested review from yyx990803 and removed request for yyx990803 Jun 2, 2019

sodatea added some commits Jun 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.