-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(migrate): Expose dependent path migration
BREAKING CHANGE: rename result properties, default path migrations
- Loading branch information
1 parent
622145b
commit cac93f1
Showing
13 changed files
with
98 additions
and
49 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
7 changes: 4 additions & 3 deletions
7
packages/migrate/src/util/default-migrations/component-file.js
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import renameFile from "./rename-file"; | ||
import updatePaths from "./update-paths"; | ||
import componentFile from "./component-file"; | ||
export default function addFileMigrations(ctx, migratedFiles, renamedFiles) { | ||
renameFile(ctx, migratedFiles, renamedFiles); | ||
componentFile(ctx, migratedFiles); | ||
export default function addFileMigrations(ctx, result) { | ||
updatePaths(ctx, result); | ||
componentFile(ctx, result); | ||
} |
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
packages/migrate/src/util/default-migrations/update-paths.js
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,18 @@ | ||
export default function addComponentMigration( | ||
ctx, | ||
{ fileNames, dependentPaths } | ||
) { | ||
ctx.addMigration({ | ||
name: "updateFilePath", | ||
apply(_, { from, to }) { | ||
fileNames[from] = to; | ||
} | ||
}); | ||
|
||
ctx.addMigration({ | ||
name: "updateDependentPaths", | ||
apply(_, { from, to }) { | ||
dependentPaths[from] = to; | ||
} | ||
}); | ||
} |
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
3 changes: 3 additions & 0 deletions
3
packages/migrate/test/fixtures/single-widget-rename-and-dependent-paths/marko.json
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,3 @@ | ||
{ | ||
"migrator": "./migrator" | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/migrate/test/fixtures/single-widget-rename-and-dependent-paths/migrator.js
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,14 @@ | ||
const path = require("path"); | ||
|
||
module.exports = (root, context) => { | ||
const widgetFile = path.join(context.dirname, "index.js"); | ||
const newWidgetFile = path.join(context.dirname, "component.js"); | ||
context.addMigration({ | ||
apply(helper) { | ||
return helper.run("updateDependentPaths", { | ||
from: widgetFile, | ||
to: newWidgetFile | ||
}); | ||
} | ||
}); | ||
}; |
6 changes: 6 additions & 0 deletions
6
...es/migrate/test/fixtures/single-widget-rename-and-dependent-paths/snapshot-expected.marko
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,6 @@ | ||
<!-- packages/migrate/test/fixtures/single-widget-rename-and-dependent-paths/template.marko --> | ||
|
||
<div/> | ||
|
||
|
||
<!-- dependents: packages/migrate/test/fixtures/single-widget-rename-and-dependent-paths/index.js => packages/migrate/test/fixtures/single-widget-rename-and-dependent-paths/component.js --> |
1 change: 1 addition & 0 deletions
1
packages/migrate/test/fixtures/single-widget-rename-and-dependent-paths/template.marko
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 @@ | ||
<div/> |
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