@carbon/upgrade 11.32.0 → 11.33.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 +1 -1
- package/package.json +2 -2
- package/transforms/__testfixtures__/ibm-products-update-pdlc-status.input.js +1 -1
- package/transforms/__testfixtures__/ibm-products-update-pdlc-status.output.js +5 -2
- package/transforms/__testfixtures__/rename-imports-to-preview-core-and-products.input.js +1 -3
- package/transforms/__testfixtures__/rename-imports-to-preview-core-and-products.output.js +2 -4
- package/transforms/__testfixtures__/rename-imports-to-preview.input.js +1 -1
- package/transforms/__testfixtures__/rename-imports-to-preview.output.js +2 -2
- package/transforms/ibm-products-update-pdlc-status.js +51 -10
- package/transforms/nonStableMapping.js +6 -0
- package/transforms/rename-imports-to-preview-core-and-products.js +55 -6
- package/transforms/rename-imports-to-preview.js +18 -7
package/cli.js
CHANGED
|
@@ -44386,7 +44386,7 @@ var upgrades = [
|
|
|
44386
44386
|
var package_default = {
|
|
44387
44387
|
name: "@carbon/upgrade",
|
|
44388
44388
|
description: "A tool for upgrading Carbon versions",
|
|
44389
|
-
version: "11.
|
|
44389
|
+
version: "11.33.0",
|
|
44390
44390
|
license: "Apache-2.0",
|
|
44391
44391
|
bin: {
|
|
44392
44392
|
"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.
|
|
4
|
+
"version": "11.33.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
7
7
|
"carbon-upgrade": "./bin/carbon-upgrade.js"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@ibm/telemetry-js": "^1.5.0",
|
|
61
61
|
"jscodeshift": "^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c76188a59aad432ce28e79b1a8a6b95457ba2cce"
|
|
64
64
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// eslint-disable-next-line no-unused-vars
|
|
2
|
-
import { Tearsheet, SearchBar } from '@carbon/ibm-products';
|
|
2
|
+
import { Tearsheet, SearchBar, InlineTip } from '@carbon/ibm-products';
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Tearsheet,
|
|
3
|
+
previewCandidate__SearchBar as SearchBar,
|
|
4
|
+
previewCandidate__InlineTip as InlineTip,
|
|
5
|
+
} from '@carbon/ibm-products';
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { unstable__FluidTimePicker } from '@carbon/react';
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
1
|
+
import { unstable__FluidTimePicker as FluidTimePicker } from '@carbon/react';
|
|
4
2
|
import { Tearsheet, SearchBar } from '@carbon/ibm-products';
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
import { Tearsheet, previewCandidate__SearchBar } from '@carbon/ibm-products';
|
|
1
|
+
import { preview__FluidTimePicker as FluidTimePicker } from '@carbon/react';
|
|
2
|
+
import { Tearsheet, previewCandidate__SearchBar as SearchBar } from '@carbon/ibm-products';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { unstable__FluidTimePicker as FluidTimePicker } from '@carbon/react';
|
|
2
2
|
import { unstable__FluidTimePicker } from '@carbon/react';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { preview__FluidTimePicker } from '@carbon/react';
|
|
1
|
+
import { preview__FluidTimePicker as FluidTimePicker } from '@carbon/react';
|
|
2
|
+
import { preview__FluidTimePicker } from '@carbon/react';
|
|
@@ -15,7 +15,7 @@ const { productsPreviewMap } = require('./nonStableMapping');
|
|
|
15
15
|
* import { SearchBar, InlineTip } from '@carbon/ibm-products';
|
|
16
16
|
*
|
|
17
17
|
* After:
|
|
18
|
-
* import { previewCandidate__SearchBar, previewCandidate__InlineTip } from "@carbon/ibm-products";
|
|
18
|
+
* import { previewCandidate__SearchBar as SearchBar, previewCandidate__InlineTip as InlineTip } from "@carbon/ibm-products";
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
const nonStableComponentKeys = Object.keys(productsPreviewMap);
|
|
@@ -29,15 +29,56 @@ function transformer(file, api) {
|
|
|
29
29
|
value: '@carbon/ibm-products',
|
|
30
30
|
},
|
|
31
31
|
})
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
.forEach((path) => {
|
|
33
|
+
const uniqueSpecifiers = new Set();
|
|
34
|
+
const newSpecifiers = [];
|
|
35
|
+
path.node.specifiers.forEach((specifier) => {
|
|
36
|
+
if (specifier.type === 'ImportSpecifier') {
|
|
37
|
+
nonStableComponentKeys.forEach((c) => {
|
|
38
|
+
const importedName = specifier.imported.name;
|
|
39
|
+
const localName = specifier.local
|
|
40
|
+
? specifier.local.name
|
|
41
|
+
: importedName;
|
|
42
|
+
let transformedImportedName = importedName;
|
|
43
|
+
if (importedName === c) {
|
|
44
|
+
transformedImportedName = productsPreviewMap[c];
|
|
45
|
+
specifier.imported.name = transformedImportedName;
|
|
46
|
+
// Build new import specifier so that
|
|
47
|
+
// products components changing exports
|
|
48
|
+
// are aliased to their original name.
|
|
49
|
+
// This will help to avoid additional changes
|
|
50
|
+
// within jsx.
|
|
51
|
+
const importSpecifier = j.importSpecifier(
|
|
52
|
+
j.identifier(transformedImportedName),
|
|
53
|
+
// Use the already specified alias if there is one
|
|
54
|
+
j.identifier(localName)
|
|
55
|
+
);
|
|
56
|
+
j(path).replaceWith(
|
|
57
|
+
j.importDeclaration(
|
|
58
|
+
[...path.node.specifiers, importSpecifier],
|
|
59
|
+
path.node.source
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (specifier.type === 'ImportSpecifier') {
|
|
64
|
+
if (!uniqueSpecifiers.has(importedName)) {
|
|
65
|
+
uniqueSpecifiers.add(importedName);
|
|
66
|
+
newSpecifiers.push(importSpecifier);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
newSpecifiers.push(specifier);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// Replace the original specifiers with the new aliased ones
|
|
74
|
+
// to prevent further changes needed in jsx for products components
|
|
75
|
+
const others = path.node.specifiers.filter(
|
|
76
|
+
(c) => !Object.values(productsPreviewMap).includes(c.imported.name)
|
|
77
|
+
);
|
|
78
|
+
path.node.specifiers = [...others, ...newSpecifiers];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
})
|
|
41
82
|
.toSource();
|
|
42
83
|
}
|
|
43
84
|
|
|
@@ -13,6 +13,12 @@ exports.productsPreviewMap = {
|
|
|
13
13
|
BigNumber: 'previewCandidate__BigNumber',
|
|
14
14
|
BigNumbers: 'previewCandidate__BigNumber',
|
|
15
15
|
Coachmark: 'previewCandidate__Coachmark',
|
|
16
|
+
CoachmarkBeacon: 'previewCandidate__CoachmarkBeacon',
|
|
17
|
+
CoachmarkButton: 'previewCandidate__CoachmarkButton',
|
|
18
|
+
CoachmarkFixed: 'previewCandidate__CoachmarkFixed',
|
|
19
|
+
CoachmarkOverlayElement: 'previewCandidate__CoachmarkOverlayElement',
|
|
20
|
+
CoachmarkOverlayElements: 'previewCandidate__CoachmarkOverlayElements',
|
|
21
|
+
CoachmarkStack: 'previewCandidate__CoachmarkStack',
|
|
16
22
|
ConditionBuilder: 'previewCandidate__ConditionBuilder',
|
|
17
23
|
DataSpreadsheet: 'previewCandidate__DataSpreadsheet',
|
|
18
24
|
Decorator: 'previewCandidate__Decorator',
|
|
@@ -17,7 +17,7 @@ const { reactPreviewMap, productsPreviewMap } = require('./nonStableMapping');
|
|
|
17
17
|
*
|
|
18
18
|
* After:
|
|
19
19
|
* import { preview__FluidTimePicker } from "@carbon/react";
|
|
20
|
-
* import { previewCandidate__SearchBar } from '@carbon/ibm-products';
|
|
20
|
+
* import { previewCandidate__SearchBar as SearchBar } from '@carbon/ibm-products';
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
const allPreviews = { ...reactPreviewMap, ...productsPreviewMap };
|
|
@@ -36,11 +36,60 @@ function transformer(file, api) {
|
|
|
36
36
|
value: p,
|
|
37
37
|
},
|
|
38
38
|
})
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
.forEach((path) => {
|
|
40
|
+
const uniqueSpecifiers = new Set();
|
|
41
|
+
const newSpecifiers = [];
|
|
42
|
+
path.node.specifiers.forEach((specifier) => {
|
|
43
|
+
if (specifier.type === 'ImportSpecifier') {
|
|
44
|
+
nonStableKeys.forEach((c) => {
|
|
45
|
+
const importedName = specifier.imported.name;
|
|
46
|
+
const localName = specifier.local
|
|
47
|
+
? specifier.local.name
|
|
48
|
+
: importedName;
|
|
49
|
+
let transformedImportedName = importedName;
|
|
50
|
+
if (importedName === c) {
|
|
51
|
+
transformedImportedName = allPreviews[c];
|
|
52
|
+
specifier.imported.name = transformedImportedName;
|
|
53
|
+
if (p === '@carbon/ibm-products') {
|
|
54
|
+
// Build new import specifier so that
|
|
55
|
+
// products components changing exports
|
|
56
|
+
// are aliased to their original name.
|
|
57
|
+
// This will help to avoid additional changes
|
|
58
|
+
// within jsx.
|
|
59
|
+
const importSpecifier = j.importSpecifier(
|
|
60
|
+
j.identifier(transformedImportedName),
|
|
61
|
+
// Use the already specified alias if there is one
|
|
62
|
+
j.identifier(localName)
|
|
63
|
+
);
|
|
64
|
+
j(path).replaceWith(
|
|
65
|
+
j.importDeclaration(
|
|
66
|
+
[...path.node.specifiers, importSpecifier],
|
|
67
|
+
path.node.source
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
if (specifier.type === 'ImportSpecifier') {
|
|
71
|
+
if (!uniqueSpecifiers.has(importedName)) {
|
|
72
|
+
uniqueSpecifiers.add(importedName);
|
|
73
|
+
newSpecifiers.push(importSpecifier);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
newSpecifiers.push(specifier);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// Replace the original specifiers with the new aliased ones
|
|
82
|
+
// to prevent further changes needed in jsx for products components
|
|
83
|
+
if (p === '@carbon/ibm-products') {
|
|
84
|
+
const others = path.node.specifiers.filter(
|
|
85
|
+
(c) =>
|
|
86
|
+
!Object.values(productsPreviewMap).includes(c.imported.name)
|
|
87
|
+
);
|
|
88
|
+
path.node.specifiers = [...others, ...newSpecifiers];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
44
93
|
});
|
|
45
94
|
return root.toSource();
|
|
46
95
|
}
|
|
@@ -12,9 +12,13 @@ const { reactPreviewMap } = require('./nonStableMapping');
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* Before:
|
|
15
|
+
* import { unstable__FluidTimePicker as FluidTimePicker } from '@carbon/react';
|
|
16
|
+
* or
|
|
15
17
|
* import { unstable__FluidTimePicker } from '@carbon/react';
|
|
16
18
|
*
|
|
17
19
|
* After:
|
|
20
|
+
* import { preview__FluidTimePicker as FluidTimePicker } from "@carbon/react";
|
|
21
|
+
* or
|
|
18
22
|
* import { preview__FluidTimePicker } from "@carbon/react";
|
|
19
23
|
*/
|
|
20
24
|
|
|
@@ -29,13 +33,20 @@ function transformer(file, api) {
|
|
|
29
33
|
value: '@carbon/react',
|
|
30
34
|
},
|
|
31
35
|
})
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
.forEach((path) => {
|
|
37
|
+
path.node.specifiers.forEach((specifier) => {
|
|
38
|
+
if (specifier.type === 'ImportSpecifier') {
|
|
39
|
+
nonStableComponentKeys.forEach((c) => {
|
|
40
|
+
let importedName = specifier.imported.name;
|
|
41
|
+
let transformedImportedName = importedName;
|
|
42
|
+
if (importedName === c) {
|
|
43
|
+
transformedImportedName = reactPreviewMap[c];
|
|
44
|
+
specifier.imported.name = transformedImportedName;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
})
|
|
39
50
|
.toSource();
|
|
40
51
|
}
|
|
41
52
|
|