@carbon/upgrade 11.22.0 → 11.23.0-rc.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/cli.js CHANGED
@@ -52673,6 +52673,62 @@ var upgrades = [
52673
52673
  });
52674
52674
  }
52675
52675
  },
52676
+ {
52677
+ name: "enable-v12-tile-radio-icons",
52678
+ description: `
52679
+ Wrap RadioTile components with FeatureFlags enableV12TileRadioIcons
52680
+
52681
+ Transforms:
52682
+
52683
+ 1. TileGroup with RadioTile:
52684
+ <TileGroup>
52685
+ <RadioTile>...</RadioTile>
52686
+ </TileGroup>
52687
+
52688
+ Into:
52689
+ <FeatureFlags enableV12TileRadioIcons>
52690
+ <TileGroup>
52691
+ <RadioTile>...</RadioTile>
52692
+ </TileGroup>
52693
+ </FeatureFlags>
52694
+
52695
+ 2. Standalone RadioTile:
52696
+ <RadioTile>...</RadioTile>
52697
+
52698
+ Into:
52699
+ <FeatureFlags enableV12TileRadioIcons>
52700
+ <RadioTile>...</RadioTile>
52701
+ </FeatureFlags>
52702
+ `,
52703
+ migrate: async (options) => {
52704
+ const transform = import_path2.default.join(
52705
+ TRANSFORM_DIR,
52706
+ "enable-v12-tile-radio-icons.js"
52707
+ );
52708
+ const paths = Array.isArray(options.paths) && options.paths.length > 0 ? options.paths : await (0, import_fast_glob2.default)(["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"], {
52709
+ cwd: options.workspaceDir,
52710
+ ignore: [
52711
+ "**/es/**",
52712
+ "**/lib/**",
52713
+ "**/umd/**",
52714
+ "**/node_modules/**",
52715
+ "**/storybook-static/**",
52716
+ "**/dist/**",
52717
+ "**/build/**",
52718
+ "**/*.d.ts",
52719
+ "**/coverage/**"
52720
+ ]
52721
+ });
52722
+ await run2({
52723
+ dry: !options.write,
52724
+ transform,
52725
+ paths,
52726
+ verbose: options.verbose,
52727
+ parser: "tsx"
52728
+ // Enable parsing of TSX files
52729
+ });
52730
+ }
52731
+ },
52676
52732
  {
52677
52733
  name: "refactor-to-callout",
52678
52734
  description: "Rewrites imports and usages of StaticNotification to Callout",
@@ -52696,6 +52752,61 @@ var upgrades = [
52696
52752
  });
52697
52753
  }
52698
52754
  },
52755
+ {
52756
+ name: "enable-v12-tile-default-icons",
52757
+ description: `
52758
+ Wrap Tile and TileGroup components with FeatureFlags enableV12TileDefaultIcons
52759
+
52760
+ Transforms:
52761
+ 1. TileGroup with Tiles:
52762
+ <TileGroup>
52763
+ <Tile>...</Tile>
52764
+ </TileGroup>
52765
+
52766
+ Into:
52767
+ <FeatureFlags enableV12TileDefaultIcons>
52768
+ <TileGroup>
52769
+ <Tile>...</Tile>
52770
+ </TileGroup>
52771
+ </FeatureFlags>
52772
+
52773
+ 2. Standalone Tile:
52774
+ <Tile>...</Tile>
52775
+
52776
+ Into:
52777
+ <FeatureFlags enableV12TileDefaultIcons>
52778
+ <Tile>...</Tile>
52779
+ </FeatureFlags>
52780
+ `,
52781
+ migrate: async (options) => {
52782
+ const transform = import_path2.default.join(
52783
+ TRANSFORM_DIR,
52784
+ "enable-v12-tile-default-icons.js"
52785
+ );
52786
+ const paths = Array.isArray(options.paths) && options.paths.length > 0 ? options.paths : await (0, import_fast_glob2.default)(["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"], {
52787
+ cwd: options.workspaceDir,
52788
+ ignore: [
52789
+ "**/es/**",
52790
+ "**/lib/**",
52791
+ "**/umd/**",
52792
+ "**/node_modules/**",
52793
+ "**/storybook-static/**",
52794
+ "**/dist/**",
52795
+ "**/build/**",
52796
+ "**/*.d.ts",
52797
+ "**/coverage/**"
52798
+ ]
52799
+ });
52800
+ await run2({
52801
+ dry: !options.write,
52802
+ transform,
52803
+ paths,
52804
+ verbose: options.verbose,
52805
+ parser: "tsx"
52806
+ // Enable parsing of TSX files
52807
+ });
52808
+ }
52809
+ },
52699
52810
  {
52700
52811
  name: "ibm-products-update-http-errors",
52701
52812
  description: "Rewrites HttpError403, HttpError404, HttpErrorOther to FullPageError",
@@ -52775,7 +52886,7 @@ var upgrades = [
52775
52886
  var package_default = {
52776
52887
  name: "@carbon/upgrade",
52777
52888
  description: "A tool for upgrading Carbon versions",
52778
- version: "11.22.0",
52889
+ version: "11.23.0-rc.0",
52779
52890
  license: "Apache-2.0",
52780
52891
  bin: {
52781
52892
  "carbon-upgrade": "./bin/carbon-upgrade.js"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/upgrade",
3
3
  "description": "A tool for upgrading Carbon versions",
4
- "version": "11.22.0",
4
+ "version": "11.23.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
7
7
  "carbon-upgrade": "./bin/carbon-upgrade.js"
@@ -61,5 +61,5 @@
61
61
  "@ibm/telemetry-js": "^1.5.0",
62
62
  "jscodeshift": "^17.0.0"
63
63
  },
64
- "gitHead": "97fc2e65d5d78f3bc191f036cb669b072db1d85f"
64
+ "gitHead": "9cf96c5f68ef9216d1c73a5dfb7bdb3bd007b0c1"
65
65
  }
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { TileGroup, Tile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ function TestComponent() {
6
+ return (
7
+ <div>
8
+ {/* Case 1: Unwrapped TileGroup */}
9
+ <TileGroup legend="TestGroup" name="test">
10
+ <Tile>Option 1</Tile>
11
+ <Tile>Option 2</Tile>
12
+ </TileGroup>
13
+
14
+ {/* Wrapped standalone missing flag prop */}
15
+ <FeatureFlags>
16
+ <TileGroup legend="Missing Attribute" name="wrapped">
17
+ <Tile>Already Wrapped Option 1</Tile>
18
+ <Tile>Already Wrapped Option 2</Tile>
19
+ </TileGroup>
20
+ </FeatureFlags>
21
+
22
+ {/* Case 3: Already wrapped with other attributes */}
23
+ <FeatureFlags enable-v12-tile-radio-icons>
24
+ <TileGroup legend="Other Attribute" name="other-wrapped">
25
+ <Tile>Other Flag Option 1</Tile>
26
+ </TileGroup>
27
+ </FeatureFlags>
28
+
29
+ {/* Case 4: Already wrapped with correct attribute */}
30
+ <FeatureFlags enableV12TileDefaultIcons>
31
+ <TileGroup legend="Correct Wrapped" name="correct">
32
+ <Tile>Correctly Wrapped Option</Tile>
33
+ </TileGroup>
34
+ </FeatureFlags>
35
+
36
+ {/* Case 5: Standalone Tiles with different scenarios */}
37
+ <Stack>
38
+ {/* Unwrapped standalone */}
39
+ <Tile>Standalone Tile</Tile>
40
+
41
+ {/* Wrapped standalone missing flag prop */}
42
+ <FeatureFlags>
43
+ <Tile>Wrapped Standalone</Tile>
44
+ </FeatureFlags>
45
+
46
+ {/* Wrapped standalone with other flag */}
47
+ <FeatureFlags enable-v12-tile-radio-icons>
48
+ <Tile>Other Flag Standalone</Tile>
49
+ </FeatureFlags>
50
+
51
+ {/* Correctly wrapped standalone */}
52
+ <FeatureFlags enableV12TileDefaultIcons>
53
+ <Tile>Correct Standalone</Tile>
54
+ </FeatureFlags>
55
+ </Stack>
56
+
57
+ {/* Case 6: Nested structures */}
58
+ <div className="nested">
59
+ <TileGroup legend="Nested Group" name="nested">
60
+ <div className="wrapper">
61
+ <Tile>Nested Option 1</Tile>
62
+ </div>
63
+ <Tile>Nested Option 2</Tile>
64
+ </TileGroup>
65
+ </div>
66
+ </div>
67
+ );
68
+ }
69
+
70
+ export default TestComponent;
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import { TileGroup, Tile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ const TestComponent: React.FC = () => {
6
+ return (
7
+ //prettier-ignore
8
+ <div>
9
+ {/* Case 1: Unwrapped TileGroup */}
10
+ <TileGroup legend="TestGroup" name="test">
11
+ <Tile id="test-1">Option 1</Tile>
12
+ <Tile id="test-2">Option 2</Tile>
13
+ </TileGroup>
14
+
15
+ {/* Wrapped standalone missing flag prop */}
16
+ <FeatureFlags>
17
+ <TileGroup legend="Missing Attribute" name="wrapped">
18
+ <Tile id="wrapped-1">Already Wrapped Option 1</Tile>
19
+ <Tile id="wrapped-2">Already Wrapped Option 2</Tile>
20
+ <Tile id="wrapped-3">Already Wrapped Option 3</Tile>
21
+ </TileGroup>
22
+ </FeatureFlags>
23
+
24
+ {/* Case 3: Already wrapped with other flags */}
25
+ <FeatureFlags enable-v12-tile-radio-icons>
26
+ <TileGroup legend="Other Attribute" name="other-wrapped">
27
+ <Tile id="other-1">Other Flag Option 1</Tile>
28
+ </TileGroup>
29
+ </FeatureFlags>
30
+
31
+ {/* Case 4: Already wrapped with correct flag */}
32
+ <FeatureFlags enableV12TileDefaultIcons>
33
+ <TileGroup legend="Correct Wrapped" name="correct">
34
+ <Tile id="correct-1">Correctly Wrapped Option</Tile>
35
+ </TileGroup>
36
+ </FeatureFlags>
37
+
38
+ {/* Case 5: Standalone Tiles with different scenarios */}
39
+ <Stack>
40
+ {/* Unwrapped standalone */}
41
+ <Tile id="standalone">Standalone Tile</Tile>
42
+
43
+ {/* Wrapped standalone missing flag prop */}
44
+ <FeatureFlags>
45
+ <Tile id="wrapped-standalone">Wrapped Standalone</Tile>
46
+ </FeatureFlags>
47
+
48
+ {/* Wrapped standalone with other flag */}
49
+ <FeatureFlags enable-v12-tile-radio-icons>
50
+ <Tile id="other-standalone">Other Flag Standalone</Tile>
51
+ </FeatureFlags>
52
+
53
+ {/* Correctly wrapped standalone */}
54
+ <FeatureFlags enableV12TileDefaultIcons>
55
+ <Tile id="correct-standalone">Correct Standalone</Tile>
56
+ </FeatureFlags>
57
+ </Stack>
58
+
59
+ {/* Case 6: Nested structures */}
60
+ <div className="nested">
61
+ <TileGroup legend="Nested Group" name="nested">
62
+ <div className="wrapper">
63
+ <Tile id="nested-1">Nested Option 1</Tile>
64
+ </div>
65
+ <Tile id="nested-2">Nested Option 2</Tile>
66
+ </TileGroup>
67
+ </div>
68
+ </div>
69
+ );
70
+ };
71
+
72
+ export default TestComponent;
@@ -0,0 +1,89 @@
1
+ import React from 'react';
2
+ import { TileGroup, Tile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ function TestComponent() {
6
+ return (
7
+ (<div>
8
+ {/* Case 1: Unwrapped TileGroup */}
9
+ <FeatureFlags enableV12TileDefaultIcons><TileGroup legend="TestGroup" name="test">
10
+ <Tile>
11
+ Option 1
12
+ </Tile>
13
+ <Tile>
14
+ Option 2
15
+ </Tile>
16
+ </TileGroup></FeatureFlags>
17
+ {/* Wrapped standalone missing flag prop */}
18
+ <FeatureFlags enableV12TileDefaultIcons>
19
+ <TileGroup legend="Missing Attribute" name="wrapped">
20
+ <Tile>
21
+ Already Wrapped Option 1
22
+ </Tile>
23
+ <Tile>
24
+ Already Wrapped Option 2
25
+ </Tile>
26
+ </TileGroup>
27
+ </FeatureFlags>
28
+ {/* Case 3: Already wrapped with other attributes */}
29
+ <FeatureFlags enable-v12-tile-radio-icons enableV12TileDefaultIcons>
30
+ <TileGroup legend="Other Attribute" name="other-wrapped">
31
+ <Tile>
32
+ Other Flag Option 1
33
+ </Tile>
34
+ </TileGroup>
35
+ </FeatureFlags>
36
+ {/* Case 4: Already wrapped with correct attribute */}
37
+ <FeatureFlags enableV12TileDefaultIcons>
38
+ <TileGroup legend="Correct Wrapped" name="correct">
39
+ <Tile>
40
+ Correctly Wrapped Option
41
+ </Tile>
42
+ </TileGroup>
43
+ </FeatureFlags>
44
+ {/* Case 5: Standalone Tiles with different scenarios */}
45
+ <Stack>
46
+ {/* Unwrapped standalone */}
47
+ <FeatureFlags enableV12TileDefaultIcons><Tile>
48
+ Standalone Tile
49
+ </Tile></FeatureFlags>
50
+
51
+ {/* Wrapped standalone missing flag prop */}
52
+ <FeatureFlags enableV12TileDefaultIcons>
53
+ <Tile>
54
+ Wrapped Standalone
55
+ </Tile>
56
+ </FeatureFlags>
57
+
58
+ {/* Wrapped standalone with other flag */}
59
+ <FeatureFlags enable-v12-tile-radio-icons enableV12TileDefaultIcons>
60
+ <Tile>
61
+ Other Flag Standalone
62
+ </Tile>
63
+ </FeatureFlags>
64
+
65
+ {/* Correctly wrapped standalone */}
66
+ <FeatureFlags enableV12TileDefaultIcons>
67
+ <Tile>
68
+ Correct Standalone
69
+ </Tile>
70
+ </FeatureFlags>
71
+ </Stack>
72
+ {/* Case 6: Nested structures */}
73
+ <div className="nested">
74
+ <FeatureFlags enableV12TileDefaultIcons><TileGroup legend="Nested Group" name="nested">
75
+ <div className="wrapper">
76
+ <Tile>
77
+ Nested Option 1
78
+ </Tile>
79
+ </div>
80
+ <Tile>
81
+ Nested Option 2
82
+ </Tile>
83
+ </TileGroup></FeatureFlags>
84
+ </div>
85
+ </div>)
86
+ );
87
+ }
88
+
89
+ export default TestComponent;
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { TileGroup, Tile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ const TestComponent: React.FC = () => {
6
+ return (
7
+ //prettier-ignore
8
+ (<div>
9
+ {/* Case 1: Unwrapped TileGroup */}
10
+ <FeatureFlags enableV12TileDefaultIcons><TileGroup legend="TestGroup" name="test">
11
+ <Tile id="test-1">Option 1</Tile>
12
+ <Tile id="test-2">Option 2</Tile>
13
+ </TileGroup></FeatureFlags>
14
+ {/* Wrapped standalone missing flag prop */}
15
+ <FeatureFlags enableV12TileDefaultIcons>
16
+ <TileGroup legend="Missing Attribute" name="wrapped">
17
+ <Tile id="wrapped-1">Already Wrapped Option 1</Tile>
18
+ <Tile id="wrapped-2">Already Wrapped Option 2</Tile>
19
+ <Tile id="wrapped-3">Already Wrapped Option 3</Tile>
20
+ </TileGroup>
21
+ </FeatureFlags>
22
+ {/* Case 3: Already wrapped with other flags */}
23
+ <FeatureFlags enable-v12-tile-radio-icons enableV12TileDefaultIcons>
24
+ <TileGroup legend="Other Attribute" name="other-wrapped">
25
+ <Tile id="other-1">Other Flag Option 1</Tile>
26
+ </TileGroup>
27
+ </FeatureFlags>
28
+ {/* Case 4: Already wrapped with correct flag */}
29
+ <FeatureFlags enableV12TileDefaultIcons>
30
+ <TileGroup legend="Correct Wrapped" name="correct">
31
+ <Tile id="correct-1">Correctly Wrapped Option</Tile>
32
+ </TileGroup>
33
+ </FeatureFlags>
34
+ {/* Case 5: Standalone Tiles with different scenarios */}
35
+ <Stack>
36
+ {/* Unwrapped standalone */}
37
+ <FeatureFlags enableV12TileDefaultIcons><Tile id="standalone">Standalone Tile</Tile></FeatureFlags>
38
+
39
+ {/* Wrapped standalone missing flag prop */}
40
+ <FeatureFlags enableV12TileDefaultIcons>
41
+ <Tile id="wrapped-standalone">Wrapped Standalone</Tile>
42
+ </FeatureFlags>
43
+
44
+ {/* Wrapped standalone with other flag */}
45
+ <FeatureFlags enable-v12-tile-radio-icons enableV12TileDefaultIcons>
46
+ <Tile id="other-standalone">Other Flag Standalone</Tile>
47
+ </FeatureFlags>
48
+
49
+ {/* Correctly wrapped standalone */}
50
+ <FeatureFlags enableV12TileDefaultIcons>
51
+ <Tile id="correct-standalone">Correct Standalone</Tile>
52
+ </FeatureFlags>
53
+ </Stack>
54
+ {/* Case 6: Nested structures */}
55
+ <div className="nested">
56
+ <FeatureFlags enableV12TileDefaultIcons><TileGroup legend="Nested Group" name="nested">
57
+ <div className="wrapper">
58
+ <Tile id="nested-1">Nested Option 1</Tile>
59
+ </div>
60
+ <Tile id="nested-2">Nested Option 2</Tile>
61
+ </TileGroup></FeatureFlags>
62
+ </div>
63
+ </div>)
64
+ );
65
+ };
66
+
67
+ export default TestComponent;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { TileGroup, RadioTile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ function TestComponent() {
6
+ return (
7
+ //prettier-ignore
8
+ <div>
9
+ {/* Case 1: Unwrapped TileGroup */}
10
+ <TileGroup legend="TestGroup" name="test">
11
+ <RadioTile id="test-1" value="test-1">
12
+ Option 1
13
+ </RadioTile>
14
+ <RadioTile id="test-2" value="test-2">
15
+ Option 2
16
+ </RadioTile>
17
+ </TileGroup>
18
+ {/* Wrapped standalone missing flag prop */}
19
+ <FeatureFlags>
20
+ <TileGroup legend="Missing Attribute" name="wrapped">
21
+ <RadioTile id="wrapped-1" value="wrapped-1">
22
+ Already Wrapped Option 1
23
+ </RadioTile>
24
+ <RadioTile id="wrapped-2" value="wrapped-2">
25
+ Already Wrapped Option 2
26
+ </RadioTile>
27
+ </TileGroup>
28
+ </FeatureFlags>
29
+ {/* Case 3: Already wrapped with other attributes */}
30
+ <FeatureFlags enable-v12-tile-default-icons>
31
+ <TileGroup legend="Other Attribute" name="other-wrapped">
32
+ <RadioTile id="other-1" value="other-1">
33
+ Other Flag Option 1
34
+ </RadioTile>
35
+ </TileGroup>
36
+ </FeatureFlags>
37
+ {/* Case 4: Already wrapped with correct attribute */}
38
+ <FeatureFlags enableV12TileRadioIcons>
39
+ <TileGroup legend="Correct Wrapped" name="correct">
40
+ <RadioTile id="correct-1" value="correct-1">
41
+ Correctly Wrapped Option
42
+ </RadioTile>
43
+ </TileGroup>
44
+ </FeatureFlags>
45
+ {/* Case 5: Standalone RadioTiles with different scenarios */}
46
+ <Stack>
47
+ {/* Unwrapped standalone */}
48
+ <RadioTile id="standalone" value="standalone">
49
+ Standalone Tile
50
+ </RadioTile>
51
+ {/* Wrapped standalone missing flag prop */}
52
+ <FeatureFlags>
53
+ <RadioTile id="wrapped-standalone" value="wrapped-standalone">
54
+ Wrapped Standalone
55
+ </RadioTile>
56
+ </FeatureFlags>
57
+ {/* Wrapped standalone with other flag */}
58
+ <FeatureFlags enable-v12-tile-default-icons>
59
+ <RadioTile id="other-standalone" value="other-standalone">
60
+ Other Flag Standalone
61
+ </RadioTile>
62
+ </FeatureFlags>
63
+ {/* Correctly wrapped standalone */}
64
+ <FeatureFlags enableV12TileRadioIcons>
65
+ <RadioTile id="correct-standalone" value="correct-standalone">
66
+ Correct Standalone
67
+ </RadioTile>
68
+ </FeatureFlags>
69
+ </Stack>
70
+ {/* Case 6: Nested structures */}
71
+ <div className="nested">
72
+ <TileGroup legend="Nested Group" name="nested">
73
+ <div className="wrapper">
74
+ <RadioTile id="nested-1" value="nested-1">
75
+ Nested Option 1
76
+ </RadioTile>
77
+ </div>
78
+ <RadioTile id="nested-2" value="nested-2">
79
+ Nested Option 2
80
+ </RadioTile>
81
+ </TileGroup>
82
+ </div>
83
+ </div>
84
+ );
85
+ }
86
+
87
+ export default TestComponent;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { TileGroup, RadioTile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ const TestComponent: React.FC = () => {
6
+ return (
7
+ //prettier-ignore
8
+ <div>
9
+ {/* Case 1: Unwrapped TileGroup */}
10
+ <TileGroup legend="TestGroup" name="test">
11
+ <RadioTile id="test-1" value="test-1">
12
+ Option 1
13
+ </RadioTile>
14
+ <RadioTile id="test-2" value="test-2">
15
+ Option 2
16
+ </RadioTile>
17
+ </TileGroup>
18
+ {/* Wrapped standalone missing flag prop */}
19
+ <FeatureFlags>
20
+ <TileGroup legend="Missing Attribute" name="wrapped">
21
+ <RadioTile id="wrapped-1" value="wrapped-1">
22
+ Already Wrapped Option 1
23
+ </RadioTile>
24
+ <RadioTile id="wrapped-2" value="wrapped-2">
25
+ Already Wrapped Option 2
26
+ </RadioTile>
27
+ </TileGroup>
28
+ </FeatureFlags>
29
+ {/* Case 3: Already wrapped with other flags */}
30
+ <FeatureFlags enable-v12-tile-default-icons>
31
+ <TileGroup legend="Other Attribute" name="other-wrapped">
32
+ <RadioTile id="other-1" value="other-1">
33
+ Other Flag Option 1
34
+ </RadioTile>
35
+ </TileGroup>
36
+ </FeatureFlags>
37
+ {/* Case 4: Already wrapped with correct flag */}
38
+ <FeatureFlags enableV12TileRadioIcons>
39
+ <TileGroup legend="Correct Wrapped" name="correct">
40
+ <RadioTile id="correct-1" value="correct-1">
41
+ Correctly Wrapped Option
42
+ </RadioTile>
43
+ </TileGroup>
44
+ </FeatureFlags>
45
+ {/* Case 5: Standalone RadioTiles with different scenarios */}
46
+ <Stack>
47
+ {/* Unwrapped standalone */}
48
+ <RadioTile id="standalone" value="standalone">
49
+ Standalone Tile
50
+ </RadioTile>
51
+ {/* Wrapped standalone missing flag prop */}
52
+ <FeatureFlags>
53
+ <RadioTile id="wrapped-standalone" value="wrapped-standalone">
54
+ Wrapped Standalone
55
+ </RadioTile>
56
+ </FeatureFlags>
57
+ {/* Wrapped standalone with other flag */}
58
+ <FeatureFlags enable-v12-tile-default-icons>
59
+ <RadioTile id="other-standalone" value="other-standalone">
60
+ Other Flag Standalone radio
61
+ </RadioTile>
62
+ </FeatureFlags>
63
+ {/* Correctly wrapped standalone */}
64
+ <FeatureFlags enableV12TileRadioIcons>
65
+ <RadioTile id="correct-standalone" value="correct-standalone">
66
+ Correct Standalone
67
+ </RadioTile>
68
+ </FeatureFlags>
69
+ </Stack>
70
+ {/* Case 6: Nested structures */}
71
+ <div className="nested">
72
+ <TileGroup legend="Nested Group" name="nested">
73
+ <div className="wrapper">
74
+ <RadioTile id="nested-1" value="nested-1">
75
+ Nested Option 1
76
+ </RadioTile>
77
+ </div>
78
+ <RadioTile id="nested-2" value="nested-2">
79
+ Nested Option 2
80
+ </RadioTile>
81
+ </TileGroup>
82
+ </div>
83
+ </div>
84
+ );
85
+ };
86
+
87
+ export default TestComponent;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { TileGroup, RadioTile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ function TestComponent() {
6
+ return (
7
+ //prettier-ignore
8
+ (<div>
9
+ {/* Case 1: Unwrapped TileGroup */}
10
+ <FeatureFlags enableV12TileRadioIcons><TileGroup legend="TestGroup" name="test">
11
+ <RadioTile id="test-1" value="test-1">
12
+ Option 1
13
+ </RadioTile>
14
+ <RadioTile id="test-2" value="test-2">
15
+ Option 2
16
+ </RadioTile>
17
+ </TileGroup></FeatureFlags>
18
+ {/* Wrapped standalone missing flag prop */}
19
+ <FeatureFlags enableV12TileRadioIcons>
20
+ <TileGroup legend="Missing Attribute" name="wrapped">
21
+ <RadioTile id="wrapped-1" value="wrapped-1">
22
+ Already Wrapped Option 1
23
+ </RadioTile>
24
+ <RadioTile id="wrapped-2" value="wrapped-2">
25
+ Already Wrapped Option 2
26
+ </RadioTile>
27
+ </TileGroup>
28
+ </FeatureFlags>
29
+ {/* Case 3: Already wrapped with other attributes */}
30
+ <FeatureFlags enable-v12-tile-default-icons enableV12TileRadioIcons>
31
+ <TileGroup legend="Other Attribute" name="other-wrapped">
32
+ <RadioTile id="other-1" value="other-1">
33
+ Other Flag Option 1
34
+ </RadioTile>
35
+ </TileGroup>
36
+ </FeatureFlags>
37
+ {/* Case 4: Already wrapped with correct attribute */}
38
+ <FeatureFlags enableV12TileRadioIcons>
39
+ <TileGroup legend="Correct Wrapped" name="correct">
40
+ <RadioTile id="correct-1" value="correct-1">
41
+ Correctly Wrapped Option
42
+ </RadioTile>
43
+ </TileGroup>
44
+ </FeatureFlags>
45
+ {/* Case 5: Standalone RadioTiles with different scenarios */}
46
+ <Stack>
47
+ {/* Unwrapped standalone */}
48
+ <FeatureFlags enableV12TileRadioIcons><RadioTile id="standalone" value="standalone">
49
+ Standalone Tile
50
+ </RadioTile></FeatureFlags>
51
+ {/* Wrapped standalone missing flag prop */}
52
+ <FeatureFlags enableV12TileRadioIcons>
53
+ <RadioTile id="wrapped-standalone" value="wrapped-standalone">
54
+ Wrapped Standalone
55
+ </RadioTile>
56
+ </FeatureFlags>
57
+ {/* Wrapped standalone with other flag */}
58
+ <FeatureFlags enable-v12-tile-default-icons enableV12TileRadioIcons>
59
+ <RadioTile id="other-standalone" value="other-standalone">
60
+ Other Flag Standalone
61
+ </RadioTile>
62
+ </FeatureFlags>
63
+ {/* Correctly wrapped standalone */}
64
+ <FeatureFlags enableV12TileRadioIcons>
65
+ <RadioTile id="correct-standalone" value="correct-standalone">
66
+ Correct Standalone
67
+ </RadioTile>
68
+ </FeatureFlags>
69
+ </Stack>
70
+ {/* Case 6: Nested structures */}
71
+ <div className="nested">
72
+ <FeatureFlags enableV12TileRadioIcons><TileGroup legend="Nested Group" name="nested">
73
+ <div className="wrapper">
74
+ <RadioTile id="nested-1" value="nested-1">
75
+ Nested Option 1
76
+ </RadioTile>
77
+ </div>
78
+ <RadioTile id="nested-2" value="nested-2">
79
+ Nested Option 2
80
+ </RadioTile>
81
+ </TileGroup></FeatureFlags>
82
+ </div>
83
+ </div>)
84
+ );
85
+ }
86
+
87
+ export default TestComponent;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { TileGroup, RadioTile, Stack } from '@carbon/react';
3
+ import { FeatureFlags } from '@carbon/feature-flags';
4
+
5
+ const TestComponent: React.FC = () => {
6
+ return (
7
+ //prettier-ignore
8
+ (<div>
9
+ {/* Case 1: Unwrapped TileGroup */}
10
+ <FeatureFlags enableV12TileRadioIcons><TileGroup legend="TestGroup" name="test">
11
+ <RadioTile id="test-1" value="test-1">
12
+ Option 1
13
+ </RadioTile>
14
+ <RadioTile id="test-2" value="test-2">
15
+ Option 2
16
+ </RadioTile>
17
+ </TileGroup></FeatureFlags>
18
+ {/* Wrapped standalone missing flag prop */}
19
+ <FeatureFlags enableV12TileRadioIcons>
20
+ <TileGroup legend="Missing Attribute" name="wrapped">
21
+ <RadioTile id="wrapped-1" value="wrapped-1">
22
+ Already Wrapped Option 1
23
+ </RadioTile>
24
+ <RadioTile id="wrapped-2" value="wrapped-2">
25
+ Already Wrapped Option 2
26
+ </RadioTile>
27
+ </TileGroup>
28
+ </FeatureFlags>
29
+ {/* Case 3: Already wrapped with other flags */}
30
+ <FeatureFlags enable-v12-tile-default-icons enableV12TileRadioIcons>
31
+ <TileGroup legend="Other Attribute" name="other-wrapped">
32
+ <RadioTile id="other-1" value="other-1">
33
+ Other Flag Option 1
34
+ </RadioTile>
35
+ </TileGroup>
36
+ </FeatureFlags>
37
+ {/* Case 4: Already wrapped with correct flag */}
38
+ <FeatureFlags enableV12TileRadioIcons>
39
+ <TileGroup legend="Correct Wrapped" name="correct">
40
+ <RadioTile id="correct-1" value="correct-1">
41
+ Correctly Wrapped Option
42
+ </RadioTile>
43
+ </TileGroup>
44
+ </FeatureFlags>
45
+ {/* Case 5: Standalone RadioTiles with different scenarios */}
46
+ <Stack>
47
+ {/* Unwrapped standalone */}
48
+ <FeatureFlags enableV12TileRadioIcons><RadioTile id="standalone" value="standalone">
49
+ Standalone Tile
50
+ </RadioTile></FeatureFlags>
51
+ {/* Wrapped standalone missing flag prop */}
52
+ <FeatureFlags enableV12TileRadioIcons>
53
+ <RadioTile id="wrapped-standalone" value="wrapped-standalone">
54
+ Wrapped Standalone
55
+ </RadioTile>
56
+ </FeatureFlags>
57
+ {/* Wrapped standalone with other flag */}
58
+ <FeatureFlags enable-v12-tile-default-icons enableV12TileRadioIcons>
59
+ <RadioTile id="other-standalone" value="other-standalone">
60
+ Other Flag Standalone radio
61
+ </RadioTile>
62
+ </FeatureFlags>
63
+ {/* Correctly wrapped standalone */}
64
+ <FeatureFlags enableV12TileRadioIcons>
65
+ <RadioTile id="correct-standalone" value="correct-standalone">
66
+ Correct Standalone
67
+ </RadioTile>
68
+ </FeatureFlags>
69
+ </Stack>
70
+ {/* Case 6: Nested structures */}
71
+ <div className="nested">
72
+ <FeatureFlags enableV12TileRadioIcons><TileGroup legend="Nested Group" name="nested">
73
+ <div className="wrapper">
74
+ <RadioTile id="nested-1" value="nested-1">
75
+ Nested Option 1
76
+ </RadioTile>
77
+ </div>
78
+ <RadioTile id="nested-2" value="nested-2">
79
+ Nested Option 2
80
+ </RadioTile>
81
+ </TileGroup></FeatureFlags>
82
+ </div>
83
+ </div>)
84
+ );
85
+ };
86
+
87
+ export default TestComponent;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ const { defineTest } = require('jscodeshift/dist/testUtils');
11
+
12
+ defineTest(__dirname, 'enable-v12-tile-default-icons');
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ const { defineTest } = require('jscodeshift/dist/testUtils');
11
+
12
+ defineTest(__dirname, 'enable-v12-tile-radio-icons');
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * Migrate Tile components by wrapping them with FeatureFlags
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const defaultOptions = {
13
+ quote: 'single',
14
+ trailingComma: true,
15
+ };
16
+
17
+ function transform(fileInfo, api, options) {
18
+ const j = api.jscodeshift;
19
+ const root = j(fileInfo.source);
20
+ const printOptions = options.printOptions || defaultOptions;
21
+
22
+ // Early return if no Tile components found
23
+ if (
24
+ !root
25
+ .find(j.JSXElement, { openingElement: { name: { name: 'Tile' } } })
26
+ .size()
27
+ ) {
28
+ return null;
29
+ }
30
+
31
+ let needsFeatureFlagsImport = false;
32
+
33
+ // First update all existing FeatureFlags wrappers that need the attribute
34
+ root
35
+ .find(j.JSXElement, {
36
+ openingElement: { name: { name: 'FeatureFlags' } },
37
+ })
38
+ .forEach((path) => {
39
+ const hasTileInside =
40
+ j(path)
41
+ .find(j.JSXElement, {
42
+ openingElement: { name: { name: 'Tile' } },
43
+ })
44
+ .size() > 0;
45
+
46
+ const hasTileGroupWithTile =
47
+ j(path)
48
+ .find(j.JSXElement, {
49
+ openingElement: { name: { name: 'TileGroup' } },
50
+ })
51
+ .filter((tileGroupPath) => {
52
+ return (
53
+ j(tileGroupPath)
54
+ .find(j.JSXElement, {
55
+ openingElement: { name: { name: 'Tile' } },
56
+ })
57
+ .size() > 0
58
+ );
59
+ })
60
+ .size() > 0;
61
+
62
+ if (hasTileInside || hasTileGroupWithTile) {
63
+ const hasAttribute = path.node.openingElement.attributes.some(
64
+ (attr) =>
65
+ attr.type === 'JSXAttribute' &&
66
+ attr.name.name === 'enableV12TileDefaultIcons'
67
+ );
68
+
69
+ if (!hasAttribute) {
70
+ path.node.openingElement.attributes.push(
71
+ j.jsxAttribute(j.jsxIdentifier('enableV12TileDefaultIcons'))
72
+ );
73
+ needsFeatureFlagsImport = true;
74
+ }
75
+ }
76
+ });
77
+
78
+ // Handle Tiles within TileGroups
79
+ root
80
+ .find(j.JSXElement, {
81
+ openingElement: { name: { name: 'TileGroup' } },
82
+ })
83
+ .forEach((path) => {
84
+ const hasTile =
85
+ j(path)
86
+ .find(j.JSXElement, {
87
+ openingElement: { name: { name: 'Tile' } },
88
+ })
89
+ .size() > 0;
90
+
91
+ const wrappingFeatureFlags = j(path).closest(j.JSXElement, {
92
+ openingElement: { name: { name: 'FeatureFlags' } },
93
+ });
94
+
95
+ if (hasTile) {
96
+ if (wrappingFeatureFlags.size() === 0) {
97
+ // Not wrapped, add wrapper
98
+ const featureFlagsWrapper = j.jsxElement(
99
+ j.jsxOpeningElement(
100
+ j.jsxIdentifier('FeatureFlags'),
101
+ [j.jsxAttribute(j.jsxIdentifier('enableV12TileDefaultIcons'))],
102
+ false
103
+ ),
104
+ j.jsxClosingElement(j.jsxIdentifier('FeatureFlags')),
105
+ [path.node]
106
+ );
107
+
108
+ j(path).replaceWith(featureFlagsWrapper);
109
+ needsFeatureFlagsImport = true;
110
+ }
111
+ }
112
+ });
113
+
114
+ // Handle standalone Tiles
115
+ root
116
+ .find(j.JSXElement, {
117
+ openingElement: { name: { name: 'Tile' } },
118
+ })
119
+ .forEach((path) => {
120
+ const isInsideTileGroup =
121
+ j(path)
122
+ .closest(j.JSXElement, {
123
+ openingElement: { name: { name: 'TileGroup' } },
124
+ })
125
+ .size() > 0;
126
+
127
+ const wrappingFeatureFlags = j(path).closest(j.JSXElement, {
128
+ openingElement: { name: { name: 'FeatureFlags' } },
129
+ });
130
+
131
+ if (!isInsideTileGroup) {
132
+ if (wrappingFeatureFlags.size() === 0) {
133
+ // Not wrapped, add wrapper
134
+ const featureFlagsWrapper = j.jsxElement(
135
+ j.jsxOpeningElement(
136
+ j.jsxIdentifier('FeatureFlags'),
137
+ [j.jsxAttribute(j.jsxIdentifier('enableV12TileDefaultIcons'))],
138
+ false
139
+ ),
140
+ j.jsxClosingElement(j.jsxIdentifier('FeatureFlags')),
141
+ [path.node]
142
+ );
143
+
144
+ j(path).replaceWith(featureFlagsWrapper);
145
+ needsFeatureFlagsImport = true;
146
+ }
147
+ }
148
+ });
149
+
150
+ // Add FeatureFlags import only if we've added wrappers or attributes
151
+ if (needsFeatureFlagsImport) {
152
+ const hasFeatureFlagsImport =
153
+ root
154
+ .find(j.ImportDeclaration, {
155
+ source: { value: '@carbon/feature-flags' },
156
+ })
157
+ .size() > 0;
158
+
159
+ if (!hasFeatureFlagsImport) {
160
+ // Find the last import declaration
161
+ const lastImport = root.find(j.ImportDeclaration).at(-1);
162
+ const featureFlagsImport = j.importDeclaration(
163
+ [j.importSpecifier(j.identifier('FeatureFlags'))],
164
+ j.literal('@carbon/feature-flags')
165
+ );
166
+
167
+ if (lastImport.size() > 0) {
168
+ // Add newline after the last import
169
+ const newline = j.template.statement`\n`;
170
+ lastImport.insertAfter(newline);
171
+ lastImport.insertAfter(featureFlagsImport);
172
+ } else {
173
+ // If no imports exist, add at the beginning of the file
174
+ root.get().node.program.body.unshift(featureFlagsImport);
175
+ }
176
+ }
177
+ }
178
+
179
+ return root.toSource(printOptions);
180
+ }
181
+
182
+ module.exports = transform;
183
+ module.exports.parser = 'tsx';
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * Migrate RadioTile components by wrapping them with FeatureFlags
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const defaultOptions = {
13
+ quote: 'single',
14
+ trailingComma: true,
15
+ };
16
+
17
+ function transform(fileInfo, api, options) {
18
+ const j = api.jscodeshift;
19
+ const root = j(fileInfo.source);
20
+ const printOptions = options.printOptions || defaultOptions;
21
+
22
+ // Early return if no RadioTile components found
23
+ if (
24
+ !root
25
+ .find(j.JSXElement, { openingElement: { name: { name: 'RadioTile' } } })
26
+ .size()
27
+ ) {
28
+ return null;
29
+ }
30
+
31
+ let needsFeatureFlagsImport = false;
32
+
33
+ // First update all existing FeatureFlags wrappers that need the attribute
34
+ root
35
+ .find(j.JSXElement, {
36
+ openingElement: { name: { name: 'FeatureFlags' } },
37
+ })
38
+ .forEach((path) => {
39
+ const hasRadioTileInside =
40
+ j(path)
41
+ .find(j.JSXElement, {
42
+ openingElement: { name: { name: 'RadioTile' } },
43
+ })
44
+ .size() > 0;
45
+
46
+ const hasTileGroupWithRadioTile =
47
+ j(path)
48
+ .find(j.JSXElement, {
49
+ openingElement: { name: { name: 'TileGroup' } },
50
+ })
51
+ .filter((tileGroupPath) => {
52
+ return (
53
+ j(tileGroupPath)
54
+ .find(j.JSXElement, {
55
+ openingElement: { name: { name: 'RadioTile' } },
56
+ })
57
+ .size() > 0
58
+ );
59
+ })
60
+ .size() > 0;
61
+
62
+ if (hasRadioTileInside || hasTileGroupWithRadioTile) {
63
+ const hasAttribute = path.node.openingElement.attributes.some(
64
+ (attr) =>
65
+ attr.type === 'JSXAttribute' &&
66
+ attr.name.name === 'enableV12TileRadioIcons'
67
+ );
68
+
69
+ if (!hasAttribute) {
70
+ path.node.openingElement.attributes.push(
71
+ j.jsxAttribute(j.jsxIdentifier('enableV12TileRadioIcons'))
72
+ );
73
+ needsFeatureFlagsImport = true;
74
+ }
75
+ }
76
+ });
77
+
78
+ // Handle RadioTiles within TileGroups
79
+ root
80
+ .find(j.JSXElement, {
81
+ openingElement: { name: { name: 'TileGroup' } },
82
+ })
83
+ .forEach((path) => {
84
+ const hasRadioTile =
85
+ j(path)
86
+ .find(j.JSXElement, {
87
+ openingElement: { name: { name: 'RadioTile' } },
88
+ })
89
+ .size() > 0;
90
+
91
+ const wrappingFeatureFlags = j(path).closest(j.JSXElement, {
92
+ openingElement: { name: { name: 'FeatureFlags' } },
93
+ });
94
+
95
+ if (hasRadioTile) {
96
+ if (wrappingFeatureFlags.size() === 0) {
97
+ // Not wrapped, add wrapper
98
+ const featureFlagsWrapper = j.jsxElement(
99
+ j.jsxOpeningElement(
100
+ j.jsxIdentifier('FeatureFlags'),
101
+ [j.jsxAttribute(j.jsxIdentifier('enableV12TileRadioIcons'))],
102
+ false
103
+ ),
104
+ j.jsxClosingElement(j.jsxIdentifier('FeatureFlags')),
105
+ [path.node]
106
+ );
107
+
108
+ j(path).replaceWith(featureFlagsWrapper);
109
+ needsFeatureFlagsImport = true;
110
+ }
111
+ }
112
+ });
113
+
114
+ // Handle standalone RadioTiles
115
+ root
116
+ .find(j.JSXElement, {
117
+ openingElement: { name: { name: 'RadioTile' } },
118
+ })
119
+ .forEach((path) => {
120
+ const isInsideTileGroup =
121
+ j(path)
122
+ .closest(j.JSXElement, {
123
+ openingElement: { name: { name: 'TileGroup' } },
124
+ })
125
+ .size() > 0;
126
+
127
+ const wrappingFeatureFlags = j(path).closest(j.JSXElement, {
128
+ openingElement: { name: { name: 'FeatureFlags' } },
129
+ });
130
+
131
+ if (!isInsideTileGroup) {
132
+ if (wrappingFeatureFlags.size() === 0) {
133
+ // Not wrapped, add wrapper
134
+ const featureFlagsWrapper = j.jsxElement(
135
+ j.jsxOpeningElement(
136
+ j.jsxIdentifier('FeatureFlags'),
137
+ [j.jsxAttribute(j.jsxIdentifier('enableV12TileRadioIcons'))],
138
+ false
139
+ ),
140
+ j.jsxClosingElement(j.jsxIdentifier('FeatureFlags')),
141
+ [path.node]
142
+ );
143
+
144
+ j(path).replaceWith(featureFlagsWrapper);
145
+ needsFeatureFlagsImport = true;
146
+ }
147
+ }
148
+ });
149
+
150
+ // Add FeatureFlags import only if we've added wrappers or attributes
151
+ if (needsFeatureFlagsImport) {
152
+ const hasFeatureFlagsImport =
153
+ root
154
+ .find(j.ImportDeclaration, {
155
+ source: { value: '@carbon/feature-flags' },
156
+ })
157
+ .size() > 0;
158
+
159
+ if (!hasFeatureFlagsImport) {
160
+ // Find the last import declaration
161
+ const lastImport = root.find(j.ImportDeclaration).at(-1);
162
+ const featureFlagsImport = j.importDeclaration(
163
+ [j.importSpecifier(j.identifier('FeatureFlags'))],
164
+ j.literal('@carbon/feature-flags')
165
+ );
166
+
167
+ if (lastImport.size() > 0) {
168
+ // Add newline after the last import
169
+ const newline = j.template.statement`\n`;
170
+ lastImport.insertAfter(newline);
171
+ lastImport.insertAfter(featureFlagsImport);
172
+ } else {
173
+ // If no imports exist, add at the beginning of the file
174
+ root.get().node.program.body.unshift(featureFlagsImport);
175
+ }
176
+ }
177
+ }
178
+
179
+ return root.toSource(printOptions);
180
+ }
181
+
182
+ module.exports = transform;
183
+ module.exports.parser = 'tsx';