Skip to content

Commit

Permalink
Migrations: Add migration for 1.59
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed Sep 21, 2023
1 parent 531cb73 commit 0868bfd
Show file tree
Hide file tree
Showing 4 changed files with 724 additions and 2,343 deletions.
35 changes: 35 additions & 0 deletions migrations/1.59.0/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { API, FileInfo, Transform } from "jscodeshift";
import { renameJSXProp } from "../utils";

// https://astexplorer.net/#/gist/16933aa3bbb241249cc33c65329da028/c548ce21d18d22015c5ab5a02c9984df496bd9fa
const transform: Transform = (file: FileInfo, api: API) => {
const j = api.jscodeshift;
const root = j(file.source);

renameJSXProp(
j,
root,
["Action", "CopyToClipboard"],
"transient",
"concealed"
);

root
.find(j.CallExpression, {
callee: {
type: "MemberExpression",
object: { type: "Identifier", name: "Clipboard" },
property: { name: "copy" },
},
})
.find(j.Property, { key: { name: "transient" } })
.forEach((p) => {
if (p.node.key.type !== "Identifier") {
return;
}
p.node.key.name = "concealed";
});
return root.toSource();
};

export default transform;
Loading

0 comments on commit 0868bfd

Please sign in to comment.