@gemini-suite/vera-codemod__react 0.2.9-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit guidelines.
4
+
5
+ <!-- MONOWEAVE:BELOW -->
6
+
7
+ ## [0.2.8](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.7...@gemini-suite/vera-codemod__react@0.2.8) "@gemini-suite/vera-codemod__react" (2026-02-12)
8
+
9
+
10
+
11
+
12
+ ## [0.2.7](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.6...@gemini-suite/vera-codemod__react@0.2.7) "@gemini-suite/vera-codemod__react" (2026-01-28)
13
+
14
+
15
+
16
+
17
+ ## [0.2.6](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.5...@gemini-suite/vera-codemod__react@0.2.6) "@gemini-suite/vera-codemod__react" (2025-12-04)
18
+
19
+
20
+
21
+
22
+ ## [0.2.5](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.4...@gemini-suite/vera-codemod__react@0.2.5) "@gemini-suite/vera-codemod__react" (2025-12-02)
23
+
24
+
25
+
26
+
27
+ ## [0.2.4](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.3...@gemini-suite/vera-codemod__react@0.2.4) "@gemini-suite/vera-codemod__react" (2025-11-07)
28
+
29
+
30
+
31
+
32
+ ## [0.2.3](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.2...@gemini-suite/vera-codemod__react@0.2.3) "@gemini-suite/vera-codemod__react" (2025-10-17)
33
+
34
+
35
+
36
+
37
+ ## [0.2.2](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.1...@gemini-suite/vera-codemod__react@0.2.2) "@gemini-suite/vera-codemod__react" (2025-10-16)
38
+
39
+
40
+
41
+
42
+ ## [0.2.1](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.2.0...@gemini-suite/vera-codemod__react@0.2.1) "@gemini-suite/vera-codemod__react" (2025-07-16)
43
+
44
+
45
+
46
+
47
+ ## [0.2.0](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.1.0...@gemini-suite/vera-codemod__react@0.2.0) "@gemini-suite/vera-codemod__react" (2025-05-28)
48
+
49
+
50
+ ### Features
51
+
52
+ * add codemods for v1.1 ([366c48c](https://github.com/Volue/vera/commit/366c48c28a0dbf5ce5abe969c705794713bac278))
53
+
54
+
55
+
56
+
57
+ ## [0.1.0](https://github.com/Volue/vera/compare/@gemini-suite/vera-codemod__react@0.1.0-next.0...@gemini-suite/vera-codemod__react@0.1.0) "@gemini-suite/vera-codemod__react" (2025-04-08)
58
+
59
+
60
+ ### Features
61
+
62
+ * add codemods for `@gemini-suite/vera-react` ([154ad13](https://github.com/Volue/vera/commit/154ad138bbf62627a16259070182743940d5fe95))
63
+ * add v1 codemod transform for renaming `Label.Dot` to `LabelDot` ([a957f73](https://github.com/Volue/vera/commit/a957f73c3575fe7b9b64e9350bcc208ed570ddb2))
64
+
65
+
66
+
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # `@gemini-suite/vera-codemod__react`
2
+
3
+ Codemods for migration to the newer version of the `@gemini-suite/vera-react` library.
4
+
5
+ These codemods utilize [jscodeshift](https://github.com/facebook/jscodeshift) library for transformations and [Hypermod.io CLI tool](https://www.hypermod.io/docs/tools/cli) for downloading and running them against your codebase.
6
+
7
+ ## Install
8
+
9
+ No installation of this package is necessary.
10
+ Downloading and running codemods can be done via `npx @hypermod/cli`.
11
+
12
+ ## Usage
13
+
14
+ ### Considerations
15
+
16
+ - You should run codemods on a separate Git branch, then manually review the changes before deploying them.
17
+ - Codemods are designed to do the heavy lifting, but they may not be perfect, so some manual work may still be required in order to successfully migrate.
18
+ - Codemods might output code that doesn’t follow your coding style. Make sure to run your code formatter and/or linter before committing the changes.
19
+
20
+ ### Examples
21
+
22
+ Running the following command will print a list of all version transforms to choose form:
23
+
24
+ ```sh
25
+ npx @hypermod/cli --experimental-loader --packages @gemini-suite/vera-codemod__react /project/src/**/*.tsx
26
+ ```
27
+
28
+ To run a transform for version `1.0.0` of `@gemini-suite/vera-react`, use one of the following commands:
29
+
30
+ ```sh
31
+ # Transform multiple files
32
+ npx @hypermod/cli --experimental-loader --packages @gemini-suite/vera-codemod__react@1.0.0 /project/src/**/*.tsx
33
+
34
+ # Transform single file
35
+ npx @hypermod/cli --experimental-loader --packages @gemini-suite/vera-codemod__react@1.0.0 /project/src/path/to/file
36
+ ```
37
+
38
+ To run all transforms for `@gemini-suite/vera-react` in sequence from version `1.0.0` to the latest, add `--sequence` flag:
39
+
40
+ ```sh
41
+ npx @hypermod/cli --sequence --packages @gemini-suite/vera-codemod__react@1.0.0 /project/src/**/*.tsx
42
+ ```
43
+
44
+ [See the Hypermod CLI docs for more information and examples](https://www.hypermod.io/docs/tools/cli)
package/dist/index.cjs ADDED
@@ -0,0 +1,197 @@
1
+ 'use strict';
2
+
3
+ var utils = require('@hypermod/utils');
4
+
5
+ const componentsSet = /* @__PURE__ */ new Set([
6
+ "ActionBar",
7
+ "Anchor",
8
+ "AppFrame",
9
+ "Avatar",
10
+ "ButtonGroup",
11
+ "Card",
12
+ "Checkbox",
13
+ "Collapsible",
14
+ "CollapsibleCard",
15
+ "Combobox",
16
+ "DataItem",
17
+ "DataList",
18
+ "DatePicker",
19
+ "Dialog",
20
+ "Drawer",
21
+ "FormField",
22
+ "HeaderNavList",
23
+ "Menu",
24
+ "MultiSelectMenu",
25
+ "Notification",
26
+ "Pagination",
27
+ "Popover",
28
+ "Positioner",
29
+ "Radio",
30
+ "RovingFocusGroup",
31
+ "SelectMenu",
32
+ "SidebarNavigation",
33
+ "SingleSelectMenu",
34
+ "Switch",
35
+ "Table",
36
+ "Tabs",
37
+ "ToggleButtonGroup",
38
+ "TreeView"
39
+ ]);
40
+ function addRootToMultipartComps(j, ast) {
41
+ const componentsToTransform = [];
42
+ ast.find(j.ImportDeclaration, {
43
+ source: { value: "@gemini-suite/vera-react" }
44
+ }).forEach((path) => {
45
+ path.node.specifiers?.forEach((specifier) => {
46
+ if (specifier.type === "ImportSpecifier") {
47
+ const importedName = String(specifier.imported.name);
48
+ if (componentsSet.has(importedName)) {
49
+ componentsToTransform.push(importedName);
50
+ }
51
+ }
52
+ });
53
+ });
54
+ if (componentsToTransform.length === 0) {
55
+ return;
56
+ }
57
+ componentsToTransform.forEach((componentName) => {
58
+ ast.find(j.JSXOpeningElement, {
59
+ name: {
60
+ type: "JSXIdentifier",
61
+ name: componentName
62
+ }
63
+ }).forEach((openingTagPath) => {
64
+ if (openingTagPath.node.name.type === "JSXIdentifier") {
65
+ openingTagPath.node.name.name = `${componentName}.Root`;
66
+ }
67
+ });
68
+ ast.find(j.JSXClosingElement, {
69
+ name: {
70
+ type: "JSXIdentifier",
71
+ name: componentName
72
+ }
73
+ }).forEach((closingTagPath) => {
74
+ if (closingTagPath.node.name.type === "JSXIdentifier") {
75
+ closingTagPath.node.name.name = `${componentName}.Root`;
76
+ }
77
+ });
78
+ ast.find(j.TSTypeQuery, {
79
+ exprName: {
80
+ type: "Identifier",
81
+ name: componentName
82
+ }
83
+ }).replaceWith(
84
+ j.tsTypeQuery(
85
+ j.tsQualifiedName(j.identifier(componentName), j.identifier("Root"))
86
+ )
87
+ );
88
+ });
89
+ }
90
+
91
+ function renameLabelDot(j, ast) {
92
+ const waveImports = ast.find(j.ImportDeclaration, {
93
+ source: { value: "@gemini-suite/vera-react" }
94
+ });
95
+ const labelImports = waveImports.find(j.ImportSpecifier, {
96
+ imported: { name: "Label" }
97
+ });
98
+ if (labelImports.size() === 0) {
99
+ return;
100
+ }
101
+ const labelDotElements = ast.find(j.JSXElement, {
102
+ openingElement: {
103
+ name: {
104
+ type: "JSXMemberExpression",
105
+ object: {
106
+ type: "JSXIdentifier",
107
+ name: "Label"
108
+ },
109
+ property: {
110
+ type: "JSXIdentifier",
111
+ name: "Dot"
112
+ }
113
+ }
114
+ }
115
+ });
116
+ if (labelDotElements.size() === 0) {
117
+ return;
118
+ }
119
+ labelDotElements.forEach((path) => {
120
+ path.value.openingElement.name = j.jsxIdentifier("LabelDot");
121
+ if (path.value.closingElement) {
122
+ path.value.closingElement.name = j.jsxIdentifier("LabelDot");
123
+ }
124
+ });
125
+ waveImports.forEach((path) => {
126
+ const labelDotSpecifier = j.importSpecifier(j.identifier("LabelDot"));
127
+ if (path.node.specifiers) {
128
+ path.node.specifiers.push(labelDotSpecifier);
129
+ } else {
130
+ path.node.specifiers = [labelDotSpecifier];
131
+ }
132
+ });
133
+ }
134
+
135
+ function transformer$1(file, api, options) {
136
+ const { jscodeshift: j } = api;
137
+ const ast = j(file.source);
138
+ if (!utils.hasImportDeclaration(j, ast, "@gemini-suite/vera-react")) {
139
+ return file.source;
140
+ }
141
+ utils.applyMotions(j, ast, [addRootToMultipartComps, renameLabelDot]);
142
+ return ast.toSource(options.printOptions);
143
+ }
144
+
145
+ function renameAppFrame(j, ast) {
146
+ const waveImports = ast.find(j.ImportDeclaration, {
147
+ source: { value: "@gemini-suite/vera-react" }
148
+ });
149
+ const appFrameImports = waveImports.find(j.ImportSpecifier, {
150
+ imported: { name: "AppFrame" }
151
+ });
152
+ if (appFrameImports.size() === 0) {
153
+ return;
154
+ }
155
+ appFrameImports.replaceWith(
156
+ j.importSpecifier(j.identifier("AppFrameWithSidebar"))
157
+ );
158
+ ast.find(j.JSXMemberExpression, {
159
+ object: {
160
+ type: "JSXIdentifier",
161
+ name: "AppFrame"
162
+ }
163
+ }).forEach((path) => {
164
+ if (path.node.object.type === "JSXIdentifier") {
165
+ path.node.object.name = "AppFrameWithSidebar";
166
+ }
167
+ });
168
+ ast.find(j.MemberExpression, {
169
+ object: {
170
+ type: "Identifier",
171
+ name: "AppFrame"
172
+ }
173
+ }).forEach((path) => {
174
+ if (path.node.object.type === "Identifier") {
175
+ path.node.object.name = "AppFrameWithSidebar";
176
+ }
177
+ });
178
+ }
179
+
180
+ function transformer(file, api, options) {
181
+ const { jscodeshift: j } = api;
182
+ const ast = j(file.source);
183
+ if (!utils.hasImportDeclaration(j, ast, "@gemini-suite/vera-react")) {
184
+ return file.source;
185
+ }
186
+ utils.applyMotions(j, ast, [renameAppFrame]);
187
+ return ast.toSource(options.printOptions);
188
+ }
189
+
190
+ var index = {
191
+ transforms: {
192
+ "1.0.0": transformer$1,
193
+ "1.1.0": transformer
194
+ }
195
+ };
196
+
197
+ module.exports = index;
@@ -0,0 +1,14 @@
1
+ import { FileInfo, API, Options } from 'jscodeshift';
2
+
3
+ declare function transformer$1(file: FileInfo, api: API, options: Options): string;
4
+
5
+ declare function transformer(file: FileInfo, api: API, options: Options): string;
6
+
7
+ declare const _default: {
8
+ transforms: {
9
+ '1.0.0': typeof transformer$1;
10
+ '1.1.0': typeof transformer;
11
+ };
12
+ };
13
+
14
+ export { _default as default };
@@ -0,0 +1,14 @@
1
+ import { FileInfo, API, Options } from 'jscodeshift';
2
+
3
+ declare function transformer$1(file: FileInfo, api: API, options: Options): string;
4
+
5
+ declare function transformer(file: FileInfo, api: API, options: Options): string;
6
+
7
+ declare const _default: {
8
+ transforms: {
9
+ '1.0.0': typeof transformer$1;
10
+ '1.1.0': typeof transformer;
11
+ };
12
+ };
13
+
14
+ export { _default as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,195 @@
1
+ import { hasImportDeclaration, applyMotions } from '@hypermod/utils';
2
+
3
+ const componentsSet = /* @__PURE__ */ new Set([
4
+ "ActionBar",
5
+ "Anchor",
6
+ "AppFrame",
7
+ "Avatar",
8
+ "ButtonGroup",
9
+ "Card",
10
+ "Checkbox",
11
+ "Collapsible",
12
+ "CollapsibleCard",
13
+ "Combobox",
14
+ "DataItem",
15
+ "DataList",
16
+ "DatePicker",
17
+ "Dialog",
18
+ "Drawer",
19
+ "FormField",
20
+ "HeaderNavList",
21
+ "Menu",
22
+ "MultiSelectMenu",
23
+ "Notification",
24
+ "Pagination",
25
+ "Popover",
26
+ "Positioner",
27
+ "Radio",
28
+ "RovingFocusGroup",
29
+ "SelectMenu",
30
+ "SidebarNavigation",
31
+ "SingleSelectMenu",
32
+ "Switch",
33
+ "Table",
34
+ "Tabs",
35
+ "ToggleButtonGroup",
36
+ "TreeView"
37
+ ]);
38
+ function addRootToMultipartComps(j, ast) {
39
+ const componentsToTransform = [];
40
+ ast.find(j.ImportDeclaration, {
41
+ source: { value: "@gemini-suite/vera-react" }
42
+ }).forEach((path) => {
43
+ path.node.specifiers?.forEach((specifier) => {
44
+ if (specifier.type === "ImportSpecifier") {
45
+ const importedName = String(specifier.imported.name);
46
+ if (componentsSet.has(importedName)) {
47
+ componentsToTransform.push(importedName);
48
+ }
49
+ }
50
+ });
51
+ });
52
+ if (componentsToTransform.length === 0) {
53
+ return;
54
+ }
55
+ componentsToTransform.forEach((componentName) => {
56
+ ast.find(j.JSXOpeningElement, {
57
+ name: {
58
+ type: "JSXIdentifier",
59
+ name: componentName
60
+ }
61
+ }).forEach((openingTagPath) => {
62
+ if (openingTagPath.node.name.type === "JSXIdentifier") {
63
+ openingTagPath.node.name.name = `${componentName}.Root`;
64
+ }
65
+ });
66
+ ast.find(j.JSXClosingElement, {
67
+ name: {
68
+ type: "JSXIdentifier",
69
+ name: componentName
70
+ }
71
+ }).forEach((closingTagPath) => {
72
+ if (closingTagPath.node.name.type === "JSXIdentifier") {
73
+ closingTagPath.node.name.name = `${componentName}.Root`;
74
+ }
75
+ });
76
+ ast.find(j.TSTypeQuery, {
77
+ exprName: {
78
+ type: "Identifier",
79
+ name: componentName
80
+ }
81
+ }).replaceWith(
82
+ j.tsTypeQuery(
83
+ j.tsQualifiedName(j.identifier(componentName), j.identifier("Root"))
84
+ )
85
+ );
86
+ });
87
+ }
88
+
89
+ function renameLabelDot(j, ast) {
90
+ const waveImports = ast.find(j.ImportDeclaration, {
91
+ source: { value: "@gemini-suite/vera-react" }
92
+ });
93
+ const labelImports = waveImports.find(j.ImportSpecifier, {
94
+ imported: { name: "Label" }
95
+ });
96
+ if (labelImports.size() === 0) {
97
+ return;
98
+ }
99
+ const labelDotElements = ast.find(j.JSXElement, {
100
+ openingElement: {
101
+ name: {
102
+ type: "JSXMemberExpression",
103
+ object: {
104
+ type: "JSXIdentifier",
105
+ name: "Label"
106
+ },
107
+ property: {
108
+ type: "JSXIdentifier",
109
+ name: "Dot"
110
+ }
111
+ }
112
+ }
113
+ });
114
+ if (labelDotElements.size() === 0) {
115
+ return;
116
+ }
117
+ labelDotElements.forEach((path) => {
118
+ path.value.openingElement.name = j.jsxIdentifier("LabelDot");
119
+ if (path.value.closingElement) {
120
+ path.value.closingElement.name = j.jsxIdentifier("LabelDot");
121
+ }
122
+ });
123
+ waveImports.forEach((path) => {
124
+ const labelDotSpecifier = j.importSpecifier(j.identifier("LabelDot"));
125
+ if (path.node.specifiers) {
126
+ path.node.specifiers.push(labelDotSpecifier);
127
+ } else {
128
+ path.node.specifiers = [labelDotSpecifier];
129
+ }
130
+ });
131
+ }
132
+
133
+ function transformer$1(file, api, options) {
134
+ const { jscodeshift: j } = api;
135
+ const ast = j(file.source);
136
+ if (!hasImportDeclaration(j, ast, "@gemini-suite/vera-react")) {
137
+ return file.source;
138
+ }
139
+ applyMotions(j, ast, [addRootToMultipartComps, renameLabelDot]);
140
+ return ast.toSource(options.printOptions);
141
+ }
142
+
143
+ function renameAppFrame(j, ast) {
144
+ const waveImports = ast.find(j.ImportDeclaration, {
145
+ source: { value: "@gemini-suite/vera-react" }
146
+ });
147
+ const appFrameImports = waveImports.find(j.ImportSpecifier, {
148
+ imported: { name: "AppFrame" }
149
+ });
150
+ if (appFrameImports.size() === 0) {
151
+ return;
152
+ }
153
+ appFrameImports.replaceWith(
154
+ j.importSpecifier(j.identifier("AppFrameWithSidebar"))
155
+ );
156
+ ast.find(j.JSXMemberExpression, {
157
+ object: {
158
+ type: "JSXIdentifier",
159
+ name: "AppFrame"
160
+ }
161
+ }).forEach((path) => {
162
+ if (path.node.object.type === "JSXIdentifier") {
163
+ path.node.object.name = "AppFrameWithSidebar";
164
+ }
165
+ });
166
+ ast.find(j.MemberExpression, {
167
+ object: {
168
+ type: "Identifier",
169
+ name: "AppFrame"
170
+ }
171
+ }).forEach((path) => {
172
+ if (path.node.object.type === "Identifier") {
173
+ path.node.object.name = "AppFrameWithSidebar";
174
+ }
175
+ });
176
+ }
177
+
178
+ function transformer(file, api, options) {
179
+ const { jscodeshift: j } = api;
180
+ const ast = j(file.source);
181
+ if (!hasImportDeclaration(j, ast, "@gemini-suite/vera-react")) {
182
+ return file.source;
183
+ }
184
+ applyMotions(j, ast, [renameAppFrame]);
185
+ return ast.toSource(options.printOptions);
186
+ }
187
+
188
+ var index = {
189
+ transforms: {
190
+ "1.0.0": transformer$1,
191
+ "1.1.0": transformer
192
+ }
193
+ };
194
+
195
+ export { index as default };
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@gemini-suite/vera-codemod__react",
3
+ "version": "0.2.9-next.0",
4
+ "description": "Codemods for Wave React library",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/Volue/vera",
9
+ "directory": "codemods/react"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "main": "./dist/index.cjs",
18
+ "module": "./dist/index.mjs",
19
+ "types": "./dist/index.d.cts",
20
+ "exports": {
21
+ ".": {
22
+ "require": {
23
+ "types": "./dist/index.d.cts",
24
+ "default": "./dist/index.cjs"
25
+ },
26
+ "import": {
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
29
+ }
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "sideEffects": false,
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "scripts": {
38
+ "jest": "jest",
39
+ "lint": "eslint . --cache",
40
+ "lint:fix": "yarn run lint --fix",
41
+ "lint:types": "tsc",
42
+ "_prettier": "prettier \"**/*.{json,md,yml}\"",
43
+ "format": "yarn run _prettier --write",
44
+ "test": "run-p lint:types lint \"_prettier --check\" jest",
45
+ "clean": "premove dist",
46
+ "build": "yarn run clean && pkgroll",
47
+ "prepack": "yarn run build"
48
+ },
49
+ "devDependencies": {
50
+ "@jest/types": "30.2.0",
51
+ "@types/jest": "30.0.0",
52
+ "@volue/eslint-config": "1.3.12",
53
+ "eslint": "9.39.2",
54
+ "jest": "30.2.0",
55
+ "npm-run-all2": "8.0.4",
56
+ "pkgroll": "2.24.1",
57
+ "premove": "4.0.0",
58
+ "prettier": "3.8.1",
59
+ "ts-jest": "29.4.6",
60
+ "typescript": "5.9.3"
61
+ },
62
+ "dependencies": {
63
+ "@hypermod/utils": "0.7.1",
64
+ "@types/jscodeshift": "17.3.0",
65
+ "jscodeshift": "17.3.0"
66
+ }
67
+ }