Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(migrator): wip migrate (currently only in create)
- Loading branch information
Showing
47 changed files
with
1,040 additions
and
331 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exports.Migrator = require('./lib/Migrator') | ||
exports.MigratorPlugin = require('./lib/MigratorPlugin') | ||
exports.MigrationOperationFile = require('./lib/MigrationOperationFile') | ||
exports.writeFileTree = require('./util/writeFileTree') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** @typedef {import('../../types/MigrationOptions').MigrationOptions} MigrationOptions */ | ||
/** @typedef {import('./Migrator')} Migrator */ | ||
/** @typedef {import('./MigratorPlugin')} MigratorPlugin */ | ||
|
||
module.exports = class MigrationAPI { | ||
/** | ||
* @param {MigratorPlugin} plugin | ||
* @param {Migrator} migrator | ||
*/ | ||
constructor (plugin, migrator) { | ||
this.plugin = plugin | ||
this.migrator = migrator | ||
} | ||
|
||
/** | ||
* Register a migration that may be run during plugin install or dev build. | ||
* | ||
* @param {MigrationOptions} options | ||
*/ | ||
register (options) { | ||
this.migrator.migrations.push({ | ||
plugin: this.plugin, | ||
options, | ||
}) | ||
} | ||
|
||
/** | ||
* Called once after all migration operations are completed. | ||
* | ||
* @param {function} cb | ||
*/ | ||
onComplete (cb) { | ||
this.migrator.completeCbs.push(cb) | ||
} | ||
} |
This file contains 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
Oops, something went wrong.