Skip to content

Commit

Permalink
Supports core 1.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
origami-z committed May 3, 2024
1 parent 1d0b637 commit 8736639
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { react1210 } from "./migration/core1210.js";
import { react1230 } from "./migration/core1230.js";
import { react1240 } from "./migration/core1240.js";
import { react1250 } from "./migration/core1250.js";
import { react1270 } from "./migration/core1270.js";

const {
tsconfig,
Expand Down Expand Up @@ -83,6 +84,7 @@ const v1230 = parse("1.23.0");
const v1240 = parse("1.24.0");
const v1250 = parse("1.25.0");
// nothing needed for 1.26.0
const v1270 = parse("1.27.0");
// NOTE: don't forget to modify `LATEST_SUPPORTED_VERSION`

const fromVersion = parse(fromInput) || parse(DEFAULT_FROM_VERSION);
Expand Down Expand Up @@ -222,6 +224,10 @@ if (mode === undefined || mode === "ts") {
react1250(file);
}

if (gt(v1270, fromVersion) && lte(v1270, toVersion)) {
react1270(file);
}

if (organizeImports) {
file.organizeImports();
}
Expand Down
23 changes: 23 additions & 0 deletions migration/core1270.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { moveNamedImports } from "./utils.js";

// https://github.com/jpmorganchase/salt-ds/releases/tag/%40salt-ds%2Fcore%401.27.0
export function react1270(file) {
[
"Menu",
"MenuProps",
"MenuItem",
"MenuItemProps",
"MenuTrigger",
"MenuTriggerProps",
"MenuPanel",
"MenuPanelProps",
"MenuGroup",
"MenuGroupProps",
].forEach((x) => {
moveNamedImports(file, {
namedImportText: x,
from: "@salt-ds/lab",
to: "@salt-ds/core",
});
});
}
2 changes: 1 addition & 1 deletion utils/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _yargs from "yargs";
import { hideBin } from "yargs/helpers";
const yargs = _yargs(hideBin(process.argv));

export const LATEST_SUPPORTED_VERSION = "1.26.0";
export const LATEST_SUPPORTED_VERSION = "1.27.0";
export const DEFAULT_FROM_VERSION = "1.0.0";

export const parsedArgs = await yargs
Expand Down

0 comments on commit 8736639

Please sign in to comment.