@atlaskit/codemod-cli 0.20.0 → 0.20.1
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/cli/package.json +1 -1
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +12 -0
- package/dist/cjs/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.js +0 -1
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.js +0 -1
- package/dist/cjs/types.js +1 -1
- package/dist/es2019/main.js +0 -1
- package/dist/es2019/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +8 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.js +0 -1
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.js +0 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +12 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.js +0 -1
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.js +0 -1
- package/dist/esm/types.js +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts +1 -1
- package/filepath/package.json +1 -1
- package/main/package.json +1 -1
- package/package.json +4 -4
- package/sinceRef/package.json +1 -1
- package/transforms/package.json +1 -1
- package/types/package.json +1 -1
- package/utils/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/codemod-cli
|
|
2
2
|
|
|
3
|
+
## 0.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
8
|
+
|
|
3
9
|
## 0.20.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/cli/package.json
CHANGED
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.20.
|
|
308
|
+
_process$env$_PACKAGE = "0.20.1", _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) {
|
|
@@ -74,6 +74,18 @@ var generateNewElement = exports.generateNewElement = function generateNewElemen
|
|
|
74
74
|
|
|
75
75
|
// rename iconBefore/iconAfter to icon
|
|
76
76
|
iconAttrs[0].name.name = 'icon';
|
|
77
|
+
var ariaLabelAttr = j(element.openingElement).find(j.JSXAttribute).filter(function (attribute) {
|
|
78
|
+
return attribute.node.name.name === 'aria-label';
|
|
79
|
+
});
|
|
80
|
+
if (ariaLabelAttr.length) {
|
|
81
|
+
var hasNoLabelProp = !(attributes !== null && attributes !== void 0 && attributes.find(function (attribute) {
|
|
82
|
+
return attribute.type === 'JSXAttribute' && attribute.name.name === 'label';
|
|
83
|
+
}));
|
|
84
|
+
if (hasNoLabelProp && attributes) {
|
|
85
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier('label'), ariaLabelAttr.get().node.value));
|
|
86
|
+
}
|
|
87
|
+
ariaLabelAttr.remove();
|
|
88
|
+
}
|
|
77
89
|
}
|
|
78
90
|
return j.jsxElement(
|
|
79
91
|
// self closing if it's an icon button or icon link button
|
|
@@ -25,7 +25,6 @@ var importMap = {
|
|
|
25
25
|
// '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer':
|
|
26
26
|
// '@atlaskit/pragmatic-drag-and-drop/element/offset-from-pointer',
|
|
27
27
|
};
|
|
28
|
-
|
|
29
28
|
function updateSafeImports(file, api) {
|
|
30
29
|
var j = api.jscodeshift;
|
|
31
30
|
var root = j(file.source);
|
package/dist/cjs/types.js
CHANGED
|
@@ -12,7 +12,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
14
14
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
15
|
-
function _isNativeReflectConstruct() {
|
|
15
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
16
|
/** Converts required args to optional if they have a default
|
|
17
17
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
18
18
|
*/
|
package/dist/es2019/main.js
CHANGED
|
@@ -65,6 +65,14 @@ export const generateNewElement = (variant, element, j) => {
|
|
|
65
65
|
|
|
66
66
|
// rename iconBefore/iconAfter to icon
|
|
67
67
|
iconAttrs[0].name.name = 'icon';
|
|
68
|
+
const ariaLabelAttr = j(element.openingElement).find(j.JSXAttribute).filter(attribute => attribute.node.name.name === 'aria-label');
|
|
69
|
+
if (ariaLabelAttr.length) {
|
|
70
|
+
const hasNoLabelProp = !(attributes !== null && attributes !== void 0 && attributes.find(attribute => attribute.type === 'JSXAttribute' && attribute.name.name === 'label'));
|
|
71
|
+
if (hasNoLabelProp && attributes) {
|
|
72
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier('label'), ariaLabelAttr.get().node.value));
|
|
73
|
+
}
|
|
74
|
+
ariaLabelAttr.remove();
|
|
75
|
+
}
|
|
68
76
|
}
|
|
69
77
|
return j.jsxElement(
|
|
70
78
|
// self closing if it's an icon button or icon link button
|
|
@@ -19,7 +19,6 @@ const importMap = {
|
|
|
19
19
|
// '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer':
|
|
20
20
|
// '@atlaskit/pragmatic-drag-and-drop/element/offset-from-pointer',
|
|
21
21
|
};
|
|
22
|
-
|
|
23
22
|
export function updateSafeImports(file, api) {
|
|
24
23
|
const j = api.jscodeshift;
|
|
25
24
|
const root = j(file.source);
|
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.20.
|
|
301
|
+
_process$env$_PACKAGE = "0.20.1", _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) {
|
|
@@ -68,6 +68,18 @@ export var generateNewElement = function generateNewElement(variant, element, j)
|
|
|
68
68
|
|
|
69
69
|
// rename iconBefore/iconAfter to icon
|
|
70
70
|
iconAttrs[0].name.name = 'icon';
|
|
71
|
+
var ariaLabelAttr = j(element.openingElement).find(j.JSXAttribute).filter(function (attribute) {
|
|
72
|
+
return attribute.node.name.name === 'aria-label';
|
|
73
|
+
});
|
|
74
|
+
if (ariaLabelAttr.length) {
|
|
75
|
+
var hasNoLabelProp = !(attributes !== null && attributes !== void 0 && attributes.find(function (attribute) {
|
|
76
|
+
return attribute.type === 'JSXAttribute' && attribute.name.name === 'label';
|
|
77
|
+
}));
|
|
78
|
+
if (hasNoLabelProp && attributes) {
|
|
79
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier('label'), ariaLabelAttr.get().node.value));
|
|
80
|
+
}
|
|
81
|
+
ariaLabelAttr.remove();
|
|
82
|
+
}
|
|
71
83
|
}
|
|
72
84
|
return j.jsxElement(
|
|
73
85
|
// self closing if it's an icon button or icon link button
|
|
@@ -19,7 +19,6 @@ var importMap = {
|
|
|
19
19
|
// '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer':
|
|
20
20
|
// '@atlaskit/pragmatic-drag-and-drop/element/offset-from-pointer',
|
|
21
21
|
};
|
|
22
|
-
|
|
23
22
|
export function updateSafeImports(file, api) {
|
|
24
23
|
var j = api.jscodeshift;
|
|
25
24
|
var root = j(file.source);
|
package/dist/esm/types.js
CHANGED
|
@@ -5,7 +5,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
7
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _isNativeReflectConstruct() {
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
/** Converts required args to optional if they have a default
|
|
10
10
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
11
11
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { API, JSXElement, JSXAttribute, JSXSpreadAttribute } from 'jscodeshift';
|
|
2
2
|
import { NEW_BUTTON_VARIANTS } from '../utils/constants';
|
|
3
3
|
export declare const getIconAttributes: (attributes: (JSXAttribute | JSXSpreadAttribute)[]) => JSXAttribute[] | null;
|
|
4
4
|
export declare const getIconElement: (iconAttr: JSXAttribute) => JSXElement | null;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { API, JSXElement, JSXAttribute, JSXSpreadAttribute } from 'jscodeshift';
|
|
2
2
|
import { NEW_BUTTON_VARIANTS } from '../utils/constants';
|
|
3
3
|
export declare const getIconAttributes: (attributes: (JSXAttribute | JSXSpreadAttribute)[]) => JSXAttribute[] | null;
|
|
4
4
|
export declare const getIconElement: (iconAttr: JSXAttribute) => JSXElement | null;
|
package/filepath/package.json
CHANGED
package/main/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/codemod-cli",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "A cli for distributing codemods for atlassian-frontend components and services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"bin": "./bin/codemod-cli.js",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
43
|
-
"@atlaskit/tokens": "^1.
|
|
43
|
+
"@atlaskit/tokens": "^1.42.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@codeshift/utils": "^0.2.4",
|
|
46
46
|
"@types/jscodeshift": "^0.11.0",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
58
58
|
"prettier": "^2.8.0",
|
|
59
59
|
"ts-node": "^10.9.1",
|
|
60
|
-
"typescript": "~4.
|
|
60
|
+
"typescript": "~5.4.2"
|
|
61
61
|
},
|
|
62
62
|
"homepage": "https://atlaskit.atlassian.com/packages/monorepo-tooling/codemod-cli",
|
|
63
63
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
64
|
-
}
|
|
64
|
+
}
|
package/sinceRef/package.json
CHANGED
package/transforms/package.json
CHANGED
package/types/package.json
CHANGED