@carbon/upgrade 11.42.0 → 11.43.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/README.md +53 -1
- package/cli.js +247 -133
- package/package.json +4 -4
- package/transforms/__testfixtures__/enable-v12-release-aliased.input.tsx +20 -0
- package/transforms/__testfixtures__/enable-v12-release-aliased.output.tsx +22 -0
- package/transforms/__testfixtures__/enable-v12-release.input.tsx +22 -0
- package/transforms/__testfixtures__/enable-v12-release.output.tsx +30 -0
- package/transforms/__tests__/enable-v12-release-test.js +35 -0
- package/transforms/enable-v12-release.js +406 -0
package/README.md
CHANGED
|
@@ -81,6 +81,44 @@ The following codemods help you adopt changes introduced by feature flags in
|
|
|
81
81
|
preparation for Carbon v12. Each codemod transforms your code to work with
|
|
82
82
|
specific feature flags enabled.
|
|
83
83
|
|
|
84
|
+
### Enable v12 release
|
|
85
|
+
|
|
86
|
+
Enables the complete Carbon v12 experience for a React application.
|
|
87
|
+
|
|
88
|
+
**Usage:**
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx @carbon/upgrade migrate enable-v12-release --write
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This codemod wraps the application passed to a React root with
|
|
95
|
+
`<FeatureFlags enableV12Release>` and adds or updates the necessary
|
|
96
|
+
`@carbon/react` import. It supports modern `createRoot` and `hydrateRoot` entry
|
|
97
|
+
points as well as legacy `ReactDOM.render`.
|
|
98
|
+
|
|
99
|
+
**Example:**
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
// Before
|
|
103
|
+
import { createRoot } from 'react-dom/client';
|
|
104
|
+
import App from './App';
|
|
105
|
+
|
|
106
|
+
const root = createRoot(document.getElementById('root'));
|
|
107
|
+
root.render(<App />);
|
|
108
|
+
|
|
109
|
+
// After
|
|
110
|
+
import { createRoot } from 'react-dom/client';
|
|
111
|
+
import { FeatureFlags } from '@carbon/react';
|
|
112
|
+
import App from './App';
|
|
113
|
+
|
|
114
|
+
const root = createRoot(document.getElementById('root'));
|
|
115
|
+
root.render(
|
|
116
|
+
<FeatureFlags enableV12Release>
|
|
117
|
+
<App />
|
|
118
|
+
</FeatureFlags>
|
|
119
|
+
);
|
|
120
|
+
```
|
|
121
|
+
|
|
84
122
|
### Enable v12 tile default icons
|
|
85
123
|
|
|
86
124
|
Enables default icons for Tile components.
|
|
@@ -128,7 +166,7 @@ npx @carbon/upgrade migrate enable-v12-overflowmenu --write
|
|
|
128
166
|
2. API migration only (for apps already using FeatureFlags at the root):
|
|
129
167
|
|
|
130
168
|
```bash
|
|
131
|
-
npx @carbon/upgrade migrate enable-v12-overflowmenu --
|
|
169
|
+
npx @carbon/upgrade migrate enable-v12-overflowmenu --wrapWithFeatureFlag=false --write
|
|
132
170
|
```
|
|
133
171
|
|
|
134
172
|
This codemod:
|
|
@@ -235,6 +273,20 @@ This codemod:
|
|
|
235
273
|
</StructuredListWrapper>
|
|
236
274
|
```
|
|
237
275
|
|
|
276
|
+
### Known limitations
|
|
277
|
+
|
|
278
|
+
- The tile default icons, tile radio icons, and OverflowMenu codemods generate a
|
|
279
|
+
`FeatureFlags` import from `@carbon/feature-flags`. The JSX component is
|
|
280
|
+
exported by `@carbon/react`; correct the generated import before using the
|
|
281
|
+
result.
|
|
282
|
+
- The tile default icons codemod targets `Tile`, while the v12 default icon
|
|
283
|
+
behavior affects `ClickableTile`. Review its target coverage before using it.
|
|
284
|
+
- The OverflowMenu codemod updates item components and item props, but it does
|
|
285
|
+
not update parent props such as `aria-label` to `label`. Review each migrated
|
|
286
|
+
`OverflowMenu` against the v12 API.
|
|
287
|
+
- The structured list codemod changes React markup only. It does not update the
|
|
288
|
+
application's Sass feature flag configuration.
|
|
289
|
+
|
|
238
290
|
## Other V12 Codemods
|
|
239
291
|
|
|
240
292
|
### Light to layer
|