1 | const { semver } = require('@vue/cli-shared-utils')
|
2 | const GeneratorAPI = require('./GeneratorAPI')
|
3 |
|
4 | class MigratorAPI extends GeneratorAPI {
|
5 | /**
|
6 | * @param {string} id - Id of the owner plugin
|
7 | * @param {Migrator} migrator - The invoking Migrator instance
|
8 | * @param {object} options - options passed to this plugin
|
9 | * @param {object} rootOptions - root options (the entire preset)
|
10 | */
|
11 | constructor (id, baseVersion, migrator, options, rootOptions) {
|
12 | super(id, migrator, options, rootOptions)
|
13 |
|
14 | this.baseVersion = baseVersion
|
15 | this.migrator = this.generator
|
16 | }
|
17 |
|
18 | fromVersion (range) {
|
19 | return semver.satisfies(this.baseVersion, range)
|
20 | }
|
21 | }
|
22 |
|
23 | module.exports = MigratorAPI
|