@atlaskit/codemod-cli 0.17.3 → 0.17.4
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 +6 -0
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +2 -1
- package/dist/es2019/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +2 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/codemod-cli
|
|
2
2
|
|
|
3
|
+
## 0.17.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#59085](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59085) [`360ae69766f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/360ae69766f9) - small fix in button migration codemod - don't move the size prop from icon if it is medium.
|
|
8
|
+
|
|
3
9
|
## 0.17.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/main.js
CHANGED
|
@@ -305,7 +305,7 @@ function _main() {
|
|
|
305
305
|
case 4:
|
|
306
306
|
_yield$parseArgs = _context5.sent;
|
|
307
307
|
packages = _yield$parseArgs.packages;
|
|
308
|
-
_process$env$_PACKAGE = "0.17.
|
|
308
|
+
_process$env$_PACKAGE = "0.17.4", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
309
309
|
logger.log(_chalk.default.bgBlue(_chalk.default.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
310
310
|
if (packages && packages.length > 0) {
|
|
311
311
|
logger.log(_chalk.default.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -35,6 +35,7 @@ var moveSizeAndLabelAttributes = exports.moveSizeAndLabelAttributes = function m
|
|
|
35
35
|
var iconJSXElementAttributes = iconElement.openingElement.attributes;
|
|
36
36
|
// add inlined comment to the icon if it has any attributes other than label and size
|
|
37
37
|
if (Array.isArray(iconJSXElementAttributes)) {
|
|
38
|
+
var _sizeAttribute$value;
|
|
38
39
|
var ifIconAttributeEitherLabelOrSize = iconJSXElementAttributes === null || iconJSXElementAttributes === void 0 ? void 0 : iconJSXElementAttributes.every(function (attribute) {
|
|
39
40
|
return attribute.type === 'JSXAttribute' && typeof attribute.name.name === 'string' && (attribute.name.name === 'size' || attribute.name.name === 'label');
|
|
40
41
|
});
|
|
@@ -52,7 +53,7 @@ var moveSizeAndLabelAttributes = exports.moveSizeAndLabelAttributes = function m
|
|
|
52
53
|
var sizeAttribute = iconJSXElementAttributes.find(function (attribute) {
|
|
53
54
|
return attribute.type === 'JSXAttribute' && attribute.name.name === 'size';
|
|
54
55
|
});
|
|
55
|
-
if (sizeAttribute && sizeAttribute.type === 'JSXAttribute') {
|
|
56
|
+
if (sizeAttribute && sizeAttribute.type === 'JSXAttribute' && ((_sizeAttribute$value = sizeAttribute.value) === null || _sizeAttribute$value === void 0 ? void 0 : _sizeAttribute$value.type) === 'Literal' && sizeAttribute.value.value !== 'medium') {
|
|
56
57
|
sizeAttribute.name.name = iconRenamed ? 'UNSAFE_size' : "UNSAFE_".concat(iconAttr.name.name, "_size");
|
|
57
58
|
attributes === null || attributes === void 0 || attributes.push(sizeAttribute);
|
|
58
59
|
}
|
|
@@ -28,6 +28,7 @@ export const moveSizeAndLabelAttributes = (element, j, iconRenamed = false) => {
|
|
|
28
28
|
const iconJSXElementAttributes = iconElement.openingElement.attributes;
|
|
29
29
|
// add inlined comment to the icon if it has any attributes other than label and size
|
|
30
30
|
if (Array.isArray(iconJSXElementAttributes)) {
|
|
31
|
+
var _sizeAttribute$value;
|
|
31
32
|
const ifIconAttributeEitherLabelOrSize = iconJSXElementAttributes === null || iconJSXElementAttributes === void 0 ? void 0 : iconJSXElementAttributes.every(attribute => attribute.type === 'JSXAttribute' && typeof attribute.name.name === 'string' && (attribute.name.name === 'size' || attribute.name.name === 'label'));
|
|
32
33
|
if (!ifIconAttributeEitherLabelOrSize) {
|
|
33
34
|
addCommentBefore(j, j(iconAttr), iconPropsNoLongerSupportedComment, 'line');
|
|
@@ -39,7 +40,7 @@ export const moveSizeAndLabelAttributes = (element, j, iconRenamed = false) => {
|
|
|
39
40
|
attributes === null || attributes === void 0 ? void 0 : attributes.push(labelAttribute);
|
|
40
41
|
}
|
|
41
42
|
const sizeAttribute = iconJSXElementAttributes.find(attribute => attribute.type === 'JSXAttribute' && attribute.name.name === 'size');
|
|
42
|
-
if (sizeAttribute && sizeAttribute.type === 'JSXAttribute') {
|
|
43
|
+
if (sizeAttribute && sizeAttribute.type === 'JSXAttribute' && ((_sizeAttribute$value = sizeAttribute.value) === null || _sizeAttribute$value === void 0 ? void 0 : _sizeAttribute$value.type) === 'Literal' && sizeAttribute.value.value !== 'medium') {
|
|
43
44
|
sizeAttribute.name.name = iconRenamed ? 'UNSAFE_size' : `UNSAFE_${iconAttr.name.name}_size`;
|
|
44
45
|
attributes === null || attributes === void 0 ? void 0 : attributes.push(sizeAttribute);
|
|
45
46
|
}
|
package/dist/esm/main.js
CHANGED
|
@@ -298,7 +298,7 @@ function _main() {
|
|
|
298
298
|
case 4:
|
|
299
299
|
_yield$parseArgs = _context5.sent;
|
|
300
300
|
packages = _yield$parseArgs.packages;
|
|
301
|
-
_process$env$_PACKAGE = "0.17.
|
|
301
|
+
_process$env$_PACKAGE = "0.17.4", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
302
302
|
logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
303
303
|
if (packages && packages.length > 0) {
|
|
304
304
|
logger.log(chalk.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -29,6 +29,7 @@ export var moveSizeAndLabelAttributes = function moveSizeAndLabelAttributes(elem
|
|
|
29
29
|
var iconJSXElementAttributes = iconElement.openingElement.attributes;
|
|
30
30
|
// add inlined comment to the icon if it has any attributes other than label and size
|
|
31
31
|
if (Array.isArray(iconJSXElementAttributes)) {
|
|
32
|
+
var _sizeAttribute$value;
|
|
32
33
|
var ifIconAttributeEitherLabelOrSize = iconJSXElementAttributes === null || iconJSXElementAttributes === void 0 ? void 0 : iconJSXElementAttributes.every(function (attribute) {
|
|
33
34
|
return attribute.type === 'JSXAttribute' && typeof attribute.name.name === 'string' && (attribute.name.name === 'size' || attribute.name.name === 'label');
|
|
34
35
|
});
|
|
@@ -46,7 +47,7 @@ export var moveSizeAndLabelAttributes = function moveSizeAndLabelAttributes(elem
|
|
|
46
47
|
var sizeAttribute = iconJSXElementAttributes.find(function (attribute) {
|
|
47
48
|
return attribute.type === 'JSXAttribute' && attribute.name.name === 'size';
|
|
48
49
|
});
|
|
49
|
-
if (sizeAttribute && sizeAttribute.type === 'JSXAttribute') {
|
|
50
|
+
if (sizeAttribute && sizeAttribute.type === 'JSXAttribute' && ((_sizeAttribute$value = sizeAttribute.value) === null || _sizeAttribute$value === void 0 ? void 0 : _sizeAttribute$value.type) === 'Literal' && sizeAttribute.value.value !== 'medium') {
|
|
50
51
|
sizeAttribute.name.name = iconRenamed ? 'UNSAFE_size' : "UNSAFE_".concat(iconAttr.name.name, "_size");
|
|
51
52
|
attributes === null || attributes === void 0 || attributes.push(sizeAttribute);
|
|
52
53
|
}
|
package/package.json
CHANGED