@carbon/upgrade 11.31.0 → 11.32.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 +2693 -3118
- package/package.json +3 -3
- package/transforms/__testfixtures__/ibm-products-update-pdlc-status.input.js +2 -0
- package/transforms/__testfixtures__/ibm-products-update-pdlc-status.output.js +2 -0
- package/transforms/__testfixtures__/rename-imports-to-preview-core-and-products.input.js +4 -0
- package/transforms/__testfixtures__/rename-imports-to-preview-core-and-products.output.js +4 -0
- package/transforms/__testfixtures__/rename-imports-to-preview.input.js +2 -0
- package/transforms/__testfixtures__/rename-imports-to-preview.output.js +2 -0
- package/transforms/__tests__/ibm-products-update-pdlc-status-test.js +12 -0
- package/transforms/__tests__/rename-imports-to-preview-core-and-products-test.js +12 -0
- package/transforms/__tests__/rename-imports-to-preview-test.js +12 -0
- package/transforms/ibm-products-update-pdlc-status.js +44 -0
- package/transforms/nonStableMapping.js +34 -0
- package/transforms/rename-imports-to-preview-core-and-products.js +48 -0
- package/transforms/rename-imports-to-preview.js +42 -0
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.32.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
7
7
|
"carbon-upgrade": "./bin/carbon-upgrade.js"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"fs-extra": "^11.0.0",
|
|
47
47
|
"inquirer": "^12.5.0",
|
|
48
48
|
"is-git-clean": "^1.1.0",
|
|
49
|
-
"jest-diff": "^
|
|
49
|
+
"jest-diff": "^30.0.0",
|
|
50
50
|
"lodash.clonedeep": "^4.5.0",
|
|
51
51
|
"lodash.merge": "^4.6.2",
|
|
52
52
|
"memfs": "^4.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@ibm/telemetry-js": "^1.5.0",
|
|
61
61
|
"jscodeshift": "^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "7c8548ba752bea350cc1c6a4955b1b5184429015"
|
|
64
64
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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, 'ibm-products-update-pdlc-status');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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, 'rename-imports-to-preview-core-and-products');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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, 'rename-imports-to-preview');
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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
|
+
const { productsPreviewMap } = require('./nonStableMapping');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Updates imports for non-stable components
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Before:
|
|
15
|
+
* import { SearchBar, InlineTip } from '@carbon/ibm-products';
|
|
16
|
+
*
|
|
17
|
+
* After:
|
|
18
|
+
* import { previewCandidate__SearchBar, previewCandidate__InlineTip } from "@carbon/ibm-products";
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const nonStableComponentKeys = Object.keys(productsPreviewMap);
|
|
22
|
+
|
|
23
|
+
function transformer(file, api) {
|
|
24
|
+
const j = api.jscodeshift;
|
|
25
|
+
|
|
26
|
+
return j(file.source)
|
|
27
|
+
.find(j.ImportDeclaration, {
|
|
28
|
+
source: {
|
|
29
|
+
value: '@carbon/ibm-products',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.find(j.ImportSpecifier)
|
|
33
|
+
.filter(
|
|
34
|
+
(path) => !!nonStableComponentKeys.includes(path.node.imported.name)
|
|
35
|
+
)
|
|
36
|
+
.replaceWith((path) =>
|
|
37
|
+
j.importSpecifier(
|
|
38
|
+
j.identifier(productsPreviewMap[path.node.imported.name])
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
.toSource();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = transformer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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
|
+
exports.reactPreviewMap = {
|
|
9
|
+
unstable__FluidTimePicker: 'preview__FluidTimePicker',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.productsPreviewMap = {
|
|
13
|
+
BigNumber: 'previewCandidate__BigNumber',
|
|
14
|
+
BigNumbers: 'previewCandidate__BigNumber',
|
|
15
|
+
Coachmark: 'previewCandidate__Coachmark',
|
|
16
|
+
ConditionBuilder: 'previewCandidate__ConditionBuilder',
|
|
17
|
+
DataSpreadsheet: 'previewCandidate__DataSpreadsheet',
|
|
18
|
+
Decorator: 'previewCandidate__Decorator',
|
|
19
|
+
DelimitedList: 'previewCandidate__DelimitedList',
|
|
20
|
+
GetStartedCard: 'previewCandidate__GetStartedCard',
|
|
21
|
+
GuideBanner: 'previewCandidate__Guidebanner',
|
|
22
|
+
GuidebannerElement: 'previewCandidate__GuidebannerElement',
|
|
23
|
+
GuidebannerElementButton: 'previewCandidate__GuidebannerElementButton',
|
|
24
|
+
GuidebannerElementLink: 'previewCandidate__GuidebannerElementLink',
|
|
25
|
+
InlineTip: 'previewCandidate__InlineTip',
|
|
26
|
+
InlineTipButton: 'previewCandidate__InlineTipButton',
|
|
27
|
+
InlineTipLink: 'previewCandidate__InlineTipLink',
|
|
28
|
+
NonLinearReading: 'previewCandidate__NonLinearReading',
|
|
29
|
+
SearchBar: 'previewCandidate__SearchBar',
|
|
30
|
+
Toolbar: 'previewCandidate__Toolbar',
|
|
31
|
+
ToolbarButton: 'previewCandidate__ToolbarButton',
|
|
32
|
+
ToolbarGroup: 'previewCandidate__ToolbarGroup',
|
|
33
|
+
TruncatedList: 'previewCandidate__TruncatedList',
|
|
34
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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
|
+
const { reactPreviewMap, productsPreviewMap } = require('./nonStableMapping');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Updates imports for non-stable components
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Before:
|
|
15
|
+
* import { unstable__FluidTimePicker } from '@carbon/react';
|
|
16
|
+
* import { SearchBar } from '@carbon/ibm-products';
|
|
17
|
+
*
|
|
18
|
+
* After:
|
|
19
|
+
* import { preview__FluidTimePicker } from "@carbon/react";
|
|
20
|
+
* import { previewCandidate__SearchBar } from '@carbon/ibm-products';
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const allPreviews = { ...reactPreviewMap, ...productsPreviewMap };
|
|
24
|
+
const nonStableKeys = Object.keys(allPreviews);
|
|
25
|
+
|
|
26
|
+
const carbonPackages = ['@carbon/react', '@carbon/ibm-products'];
|
|
27
|
+
|
|
28
|
+
function transformer(file, api) {
|
|
29
|
+
const j = api.jscodeshift;
|
|
30
|
+
const root = j(file.source);
|
|
31
|
+
|
|
32
|
+
carbonPackages.forEach((p) => {
|
|
33
|
+
root
|
|
34
|
+
.find(j.ImportDeclaration, {
|
|
35
|
+
source: {
|
|
36
|
+
value: p,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
.find(j.ImportSpecifier)
|
|
40
|
+
.filter((path) => !!nonStableKeys.includes(path.node.imported.name))
|
|
41
|
+
.replaceWith((path) =>
|
|
42
|
+
j.importSpecifier(j.identifier(allPreviews[path.node.imported.name]))
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
return root.toSource();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = transformer;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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
|
+
const { reactPreviewMap } = require('./nonStableMapping');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Updates imports for non-stable components
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Before:
|
|
15
|
+
* import { unstable__FluidTimePicker } from '@carbon/react';
|
|
16
|
+
*
|
|
17
|
+
* After:
|
|
18
|
+
* import { preview__FluidTimePicker } from "@carbon/react";
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const nonStableComponentKeys = Object.keys(reactPreviewMap);
|
|
22
|
+
|
|
23
|
+
function transformer(file, api) {
|
|
24
|
+
const j = api.jscodeshift;
|
|
25
|
+
|
|
26
|
+
return j(file.source)
|
|
27
|
+
.find(j.ImportDeclaration, {
|
|
28
|
+
source: {
|
|
29
|
+
value: '@carbon/react',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.find(j.ImportSpecifier)
|
|
33
|
+
.filter(
|
|
34
|
+
(path) => !!nonStableComponentKeys.includes(path.node.imported.name)
|
|
35
|
+
)
|
|
36
|
+
.replaceWith((path) =>
|
|
37
|
+
j.importSpecifier(j.identifier(reactPreviewMap[path.node.imported.name]))
|
|
38
|
+
)
|
|
39
|
+
.toSource();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = transformer;
|