mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-14 11:20:20 -06:00
* 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
24 lines
697 B
JavaScript
24 lines
697 B
JavaScript
const { semver } = require('@vue/cli-shared-utils')
|
|
const GeneratorAPI = require('./GeneratorAPI')
|
|
|
|
class MigratorAPI extends GeneratorAPI {
|
|
/**
|
|
* @param {string} id - Id of the owner plugin
|
|
* @param {Migrator} migrator - The invoking Migrator instance
|
|
* @param {object} options - options passed to this plugin
|
|
* @param {object} rootOptions - root options (the entire preset)
|
|
*/
|
|
constructor (id, baseVersion, migrator, options, rootOptions) {
|
|
super(id, migrator, options, rootOptions)
|
|
|
|
this.baseVersion = baseVersion
|
|
this.migrator = this.generator
|
|
}
|
|
|
|
fromVersion (range) {
|
|
return semver.satisfies(this.baseVersion, range)
|
|
}
|
|
}
|
|
|
|
module.exports = MigratorAPI
|