@atlaskit/codemod-cli 0.29.0 → 0.29.2
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 +14 -5
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/migrate-icon-object-to-object/utils/constants.js +15 -26
- package/dist/cjs/presets/migrate-icon-object-to-object/utils/icon-mappings.js +21 -5
- package/dist/es2019/presets/migrate-icon-object-to-object/utils/constants.js +14 -25
- package/dist/es2019/presets/migrate-icon-object-to-object/utils/icon-mappings.js +19 -6
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/migrate-icon-object-to-object/utils/constants.js +14 -25
- package/dist/esm/presets/migrate-icon-object-to-object/utils/icon-mappings.js +21 -6
- package/dist/types/presets/migrate-icon-object-to-object/utils/constants.d.ts +11 -1
- package/dist/types/presets/migrate-icon-object-to-object/utils/icon-mappings.d.ts +7 -1
- package/dist/types-ts4.5/presets/migrate-icon-object-to-object/utils/constants.d.ts +11 -1
- package/dist/types-ts4.5/presets/migrate-icon-object-to-object/utils/icon-mappings.d.ts +7 -1
- package/package.json +2 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/codemod-cli
|
|
2
2
|
|
|
3
|
+
## 0.29.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 0.29.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e1c9823b0b420`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e1c9823b0b420) -
|
|
14
|
+
Updated `migrate-icon-object-to-object` to use new object name "Work item"
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 0.29.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -363,7 +377,6 @@
|
|
|
363
377
|
- [#40270](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40270)
|
|
364
378
|
[`27bbdfcb6ad`](https://bitbucket.org/atlassian/atlassian-frontend/commits/27bbdfcb6ad) - This
|
|
365
379
|
update includes several improvements and fixes to the css-to-design-tokens preset:
|
|
366
|
-
|
|
367
380
|
- Resolved transformation errors.
|
|
368
381
|
- Added support for new color properties such as `border-color-left`.
|
|
369
382
|
- Omitted unrecognized functions, including `url`, and certain Less functions to prevent compile
|
|
@@ -588,7 +601,6 @@
|
|
|
588
601
|
- [#20310](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20310)
|
|
589
602
|
[`1977986ea86`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1977986ea86) - Bumping
|
|
590
603
|
dependencies via Renovate:
|
|
591
|
-
|
|
592
604
|
- simple-git
|
|
593
605
|
|
|
594
606
|
## 0.9.2
|
|
@@ -598,7 +610,6 @@
|
|
|
598
610
|
- [#19927](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/19927)
|
|
599
611
|
[`5c45b17200d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5c45b17200d) - Bumping
|
|
600
612
|
dependencies via Renovate:
|
|
601
|
-
|
|
602
613
|
- simple-git
|
|
603
614
|
|
|
604
615
|
## 0.9.1
|
|
@@ -701,13 +712,11 @@
|
|
|
701
712
|
[Commit Changelog](https://github.com/facebook/jscodeshift/commit/2fd5e11f469427d474983b2d1c47be9408677591).
|
|
702
713
|
|
|
703
714
|
### Added
|
|
704
|
-
|
|
705
715
|
- Added a `--fail-on-error` flag to return a `1` error code when errors were found (#416,
|
|
706
716
|
@marcodejongh)
|
|
707
717
|
- Created `template.asyncExpression` (#405, @jedwards1211)
|
|
708
718
|
|
|
709
719
|
### Changed
|
|
710
|
-
|
|
711
720
|
- Removed lodash dependency from tsx parser (#432, @JHilker and @robyoder)
|
|
712
721
|
|
|
713
722
|
## 0.6.6
|
package/dist/cjs/main.js
CHANGED
|
@@ -362,7 +362,7 @@ function _main() {
|
|
|
362
362
|
case 4:
|
|
363
363
|
_yield$parseArgs = _context6.sent;
|
|
364
364
|
packages = _yield$parseArgs.packages;
|
|
365
|
-
_process$env$_PACKAGE = "0.
|
|
365
|
+
_process$env$_PACKAGE = "0.29.1", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
366
366
|
logger.log(_chalk.default.bgBlue(_chalk.default.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
367
367
|
if (packages && packages.length > 0) {
|
|
368
368
|
logger.log(_chalk.default.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PRINT_SETTINGS = exports.OLD_ICON_OBJECT_ENTRY_POINT = exports.NEW_OBJECT_TILE_ENTRY_POINT = exports.NEW_OBJECT_ENTRY_POINT = exports.
|
|
6
|
+
exports.PRINT_SETTINGS = exports.OLD_ICON_OBJECT_ENTRY_POINT = exports.NEW_OBJECT_TILE_ENTRY_POINT = exports.NEW_OBJECT_ENTRY_POINT = exports.ICON_TO_OBJECT_NAME_MAPPINGS = exports.AVAILABLE_ICON_NAMES = void 0;
|
|
7
7
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
8
8
|
|
|
9
9
|
// Entry points
|
|
@@ -11,33 +11,22 @@ var OLD_ICON_OBJECT_ENTRY_POINT = exports.OLD_ICON_OBJECT_ENTRY_POINT = '@atlask
|
|
|
11
11
|
var NEW_OBJECT_ENTRY_POINT = exports.NEW_OBJECT_ENTRY_POINT = '@atlaskit/object';
|
|
12
12
|
var NEW_OBJECT_TILE_ENTRY_POINT = exports.NEW_OBJECT_TILE_ENTRY_POINT = '@atlaskit/object/tile';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
issue: 'Issue',
|
|
27
|
-
'new-feature': 'NewFeature',
|
|
28
|
-
page: 'Page',
|
|
29
|
-
'page-live-doc': 'PageLiveDoc',
|
|
30
|
-
problem: 'Problem',
|
|
31
|
-
'pull-request': 'PullRequest',
|
|
32
|
-
question: 'Question',
|
|
33
|
-
story: 'Story',
|
|
34
|
-
subtask: 'Subtask',
|
|
35
|
-
task: 'Task',
|
|
36
|
-
whiteboard: 'Whiteboard'
|
|
14
|
+
/**
|
|
15
|
+
* Mappings for icon-object names that change when migrating to object.
|
|
16
|
+
* Key: old icon-object name (kebab-case)
|
|
17
|
+
* Value: new object name (kebab-case)
|
|
18
|
+
*
|
|
19
|
+
* Use this when the icon name in icon-object doesn't match the object name.
|
|
20
|
+
* For example, 'issue' icon-object becomes 'work-item' object.
|
|
21
|
+
*
|
|
22
|
+
* Icons not listed here will use their original name (converted to PascalCase automatically).
|
|
23
|
+
*/
|
|
24
|
+
var ICON_TO_OBJECT_NAME_MAPPINGS = exports.ICON_TO_OBJECT_NAME_MAPPINGS = {
|
|
25
|
+
issue: 'work-item'
|
|
37
26
|
};
|
|
38
27
|
|
|
39
|
-
// Available icon names (kebab-case)
|
|
40
|
-
var AVAILABLE_ICON_NAMES = exports.AVAILABLE_ICON_NAMES =
|
|
28
|
+
// Available icon names (kebab-case) - icons supported in icon-object
|
|
29
|
+
var AVAILABLE_ICON_NAMES = exports.AVAILABLE_ICON_NAMES = ['blog', 'branch', 'bug', 'calendar', 'changes', 'code', 'commit', 'epic', 'improvement', 'incident', 'issue', 'new-feature', 'page', 'page-live-doc', 'problem', 'pull-request', 'question', 'story', 'subtask', 'task', 'whiteboard'];
|
|
41
30
|
var PRINT_SETTINGS = exports.PRINT_SETTINGS = {
|
|
42
31
|
quote: 'single',
|
|
43
32
|
trailingComma: true
|
|
@@ -6,11 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.createDefaultImportDeclaration = createDefaultImportDeclaration;
|
|
8
8
|
exports.getNewImportInfo = getNewImportInfo;
|
|
9
|
+
exports.kebabToPascalCase = kebabToPascalCase;
|
|
9
10
|
exports.parseIconObjectImport = parseIconObjectImport;
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _constants = require("./constants");
|
|
12
13
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Converts a kebab-case string to PascalCase
|
|
17
|
+
* @param str - The kebab-case string (e.g., 'new-feature', 'work-item')
|
|
18
|
+
* @returns PascalCase string (e.g., 'NewFeature', 'WorkItem')
|
|
19
|
+
*/
|
|
20
|
+
function kebabToPascalCase(str) {
|
|
21
|
+
return str.split('-').map(function (word) {
|
|
22
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
23
|
+
}).join('');
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
/**
|
|
15
27
|
* Extracts icon name and size from an icon-object import path
|
|
16
28
|
* @param importPath - The import path like '@atlaskit/icon-object/glyph/new-feature/16'
|
|
@@ -26,7 +38,7 @@ function parseIconObjectImport(importPath) {
|
|
|
26
38
|
size = _match[2];
|
|
27
39
|
|
|
28
40
|
// Check if this is a valid icon name we support
|
|
29
|
-
if (!_constants.
|
|
41
|
+
if (!_constants.AVAILABLE_ICON_NAMES.includes(iconName)) {
|
|
30
42
|
return null;
|
|
31
43
|
}
|
|
32
44
|
return {
|
|
@@ -37,20 +49,24 @@ function parseIconObjectImport(importPath) {
|
|
|
37
49
|
|
|
38
50
|
/**
|
|
39
51
|
* Gets the new import specifier for an icon based on its name and size
|
|
40
|
-
* @param iconName - The kebab-case icon name (e.g., 'new-feature')
|
|
52
|
+
* @param iconName - The kebab-case icon name from icon-object (e.g., 'new-feature', 'issue')
|
|
41
53
|
* @param size - The size ('16' or '24')
|
|
42
54
|
* @returns Object with the new import path and component name
|
|
43
55
|
*/
|
|
44
56
|
function getNewImportInfo(iconName, size) {
|
|
45
|
-
|
|
57
|
+
// Check if this icon name needs to be mapped to a different object name
|
|
58
|
+
var objectName = _constants.ICON_TO_OBJECT_NAME_MAPPINGS[iconName] || iconName;
|
|
59
|
+
|
|
60
|
+
// Convert the object name to PascalCase
|
|
61
|
+
var pascalCaseName = kebabToPascalCase(objectName);
|
|
46
62
|
if (size === '16') {
|
|
47
63
|
return {
|
|
48
|
-
importPath: "@atlaskit/object/".concat(
|
|
64
|
+
importPath: "@atlaskit/object/".concat(objectName),
|
|
49
65
|
componentName: "".concat(pascalCaseName, "Object")
|
|
50
66
|
};
|
|
51
67
|
} else {
|
|
52
68
|
return {
|
|
53
|
-
importPath: "@atlaskit/object/tile/".concat(
|
|
69
|
+
importPath: "@atlaskit/object/tile/".concat(objectName),
|
|
54
70
|
componentName: "".concat(pascalCaseName, "ObjectTile")
|
|
55
71
|
};
|
|
56
72
|
}
|
|
@@ -5,33 +5,22 @@ export const OLD_ICON_OBJECT_ENTRY_POINT = '@atlaskit/icon-object';
|
|
|
5
5
|
export const NEW_OBJECT_ENTRY_POINT = '@atlaskit/object';
|
|
6
6
|
export const NEW_OBJECT_TILE_ENTRY_POINT = '@atlaskit/object/tile';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
issue: 'Issue',
|
|
21
|
-
'new-feature': 'NewFeature',
|
|
22
|
-
page: 'Page',
|
|
23
|
-
'page-live-doc': 'PageLiveDoc',
|
|
24
|
-
problem: 'Problem',
|
|
25
|
-
'pull-request': 'PullRequest',
|
|
26
|
-
question: 'Question',
|
|
27
|
-
story: 'Story',
|
|
28
|
-
subtask: 'Subtask',
|
|
29
|
-
task: 'Task',
|
|
30
|
-
whiteboard: 'Whiteboard'
|
|
8
|
+
/**
|
|
9
|
+
* Mappings for icon-object names that change when migrating to object.
|
|
10
|
+
* Key: old icon-object name (kebab-case)
|
|
11
|
+
* Value: new object name (kebab-case)
|
|
12
|
+
*
|
|
13
|
+
* Use this when the icon name in icon-object doesn't match the object name.
|
|
14
|
+
* For example, 'issue' icon-object becomes 'work-item' object.
|
|
15
|
+
*
|
|
16
|
+
* Icons not listed here will use their original name (converted to PascalCase automatically).
|
|
17
|
+
*/
|
|
18
|
+
export const ICON_TO_OBJECT_NAME_MAPPINGS = {
|
|
19
|
+
issue: 'work-item'
|
|
31
20
|
};
|
|
32
21
|
|
|
33
|
-
// Available icon names (kebab-case)
|
|
34
|
-
export const AVAILABLE_ICON_NAMES =
|
|
22
|
+
// Available icon names (kebab-case) - icons supported in icon-object
|
|
23
|
+
export const AVAILABLE_ICON_NAMES = ['blog', 'branch', 'bug', 'calendar', 'changes', 'code', 'commit', 'epic', 'improvement', 'incident', 'issue', 'new-feature', 'page', 'page-live-doc', 'problem', 'pull-request', 'question', 'story', 'subtask', 'task', 'whiteboard'];
|
|
35
24
|
export const PRINT_SETTINGS = {
|
|
36
25
|
quote: 'single',
|
|
37
26
|
trailingComma: true
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { AVAILABLE_ICON_NAMES, ICON_TO_OBJECT_NAME_MAPPINGS } from './constants';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts a kebab-case string to PascalCase
|
|
7
|
+
* @param str - The kebab-case string (e.g., 'new-feature', 'work-item')
|
|
8
|
+
* @returns PascalCase string (e.g., 'NewFeature', 'WorkItem')
|
|
9
|
+
*/
|
|
10
|
+
export function kebabToPascalCase(str) {
|
|
11
|
+
return str.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
12
|
+
}
|
|
4
13
|
|
|
5
14
|
/**
|
|
6
15
|
* Extracts icon name and size from an icon-object import path
|
|
@@ -15,7 +24,7 @@ export function parseIconObjectImport(importPath) {
|
|
|
15
24
|
const [, iconName, size] = match;
|
|
16
25
|
|
|
17
26
|
// Check if this is a valid icon name we support
|
|
18
|
-
if (!
|
|
27
|
+
if (!AVAILABLE_ICON_NAMES.includes(iconName)) {
|
|
19
28
|
return null;
|
|
20
29
|
}
|
|
21
30
|
return {
|
|
@@ -26,20 +35,24 @@ export function parseIconObjectImport(importPath) {
|
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
37
|
* Gets the new import specifier for an icon based on its name and size
|
|
29
|
-
* @param iconName - The kebab-case icon name (e.g., 'new-feature')
|
|
38
|
+
* @param iconName - The kebab-case icon name from icon-object (e.g., 'new-feature', 'issue')
|
|
30
39
|
* @param size - The size ('16' or '24')
|
|
31
40
|
* @returns Object with the new import path and component name
|
|
32
41
|
*/
|
|
33
42
|
export function getNewImportInfo(iconName, size) {
|
|
34
|
-
|
|
43
|
+
// Check if this icon name needs to be mapped to a different object name
|
|
44
|
+
const objectName = ICON_TO_OBJECT_NAME_MAPPINGS[iconName] || iconName;
|
|
45
|
+
|
|
46
|
+
// Convert the object name to PascalCase
|
|
47
|
+
const pascalCaseName = kebabToPascalCase(objectName);
|
|
35
48
|
if (size === '16') {
|
|
36
49
|
return {
|
|
37
|
-
importPath: `@atlaskit/object/${
|
|
50
|
+
importPath: `@atlaskit/object/${objectName}`,
|
|
38
51
|
componentName: `${pascalCaseName}Object`
|
|
39
52
|
};
|
|
40
53
|
} else {
|
|
41
54
|
return {
|
|
42
|
-
importPath: `@atlaskit/object/tile/${
|
|
55
|
+
importPath: `@atlaskit/object/tile/${objectName}`,
|
|
43
56
|
componentName: `${pascalCaseName}ObjectTile`
|
|
44
57
|
};
|
|
45
58
|
}
|
package/dist/esm/main.js
CHANGED
|
@@ -355,7 +355,7 @@ function _main() {
|
|
|
355
355
|
case 4:
|
|
356
356
|
_yield$parseArgs = _context6.sent;
|
|
357
357
|
packages = _yield$parseArgs.packages;
|
|
358
|
-
_process$env$_PACKAGE = "0.
|
|
358
|
+
_process$env$_PACKAGE = "0.29.1", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
359
359
|
logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
360
360
|
if (packages && packages.length > 0) {
|
|
361
361
|
logger.log(chalk.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -5,33 +5,22 @@ export var OLD_ICON_OBJECT_ENTRY_POINT = '@atlaskit/icon-object';
|
|
|
5
5
|
export var NEW_OBJECT_ENTRY_POINT = '@atlaskit/object';
|
|
6
6
|
export var NEW_OBJECT_TILE_ENTRY_POINT = '@atlaskit/object/tile';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
issue: 'Issue',
|
|
21
|
-
'new-feature': 'NewFeature',
|
|
22
|
-
page: 'Page',
|
|
23
|
-
'page-live-doc': 'PageLiveDoc',
|
|
24
|
-
problem: 'Problem',
|
|
25
|
-
'pull-request': 'PullRequest',
|
|
26
|
-
question: 'Question',
|
|
27
|
-
story: 'Story',
|
|
28
|
-
subtask: 'Subtask',
|
|
29
|
-
task: 'Task',
|
|
30
|
-
whiteboard: 'Whiteboard'
|
|
8
|
+
/**
|
|
9
|
+
* Mappings for icon-object names that change when migrating to object.
|
|
10
|
+
* Key: old icon-object name (kebab-case)
|
|
11
|
+
* Value: new object name (kebab-case)
|
|
12
|
+
*
|
|
13
|
+
* Use this when the icon name in icon-object doesn't match the object name.
|
|
14
|
+
* For example, 'issue' icon-object becomes 'work-item' object.
|
|
15
|
+
*
|
|
16
|
+
* Icons not listed here will use their original name (converted to PascalCase automatically).
|
|
17
|
+
*/
|
|
18
|
+
export var ICON_TO_OBJECT_NAME_MAPPINGS = {
|
|
19
|
+
issue: 'work-item'
|
|
31
20
|
};
|
|
32
21
|
|
|
33
|
-
// Available icon names (kebab-case)
|
|
34
|
-
export var AVAILABLE_ICON_NAMES =
|
|
22
|
+
// Available icon names (kebab-case) - icons supported in icon-object
|
|
23
|
+
export var AVAILABLE_ICON_NAMES = ['blog', 'branch', 'bug', 'calendar', 'changes', 'code', 'commit', 'epic', 'improvement', 'incident', 'issue', 'new-feature', 'page', 'page-live-doc', 'problem', 'pull-request', 'question', 'story', 'subtask', 'task', 'whiteboard'];
|
|
35
24
|
export var PRINT_SETTINGS = {
|
|
36
25
|
quote: 'single',
|
|
37
26
|
trailingComma: true
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { AVAILABLE_ICON_NAMES, ICON_TO_OBJECT_NAME_MAPPINGS } from './constants';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Converts a kebab-case string to PascalCase
|
|
8
|
+
* @param str - The kebab-case string (e.g., 'new-feature', 'work-item')
|
|
9
|
+
* @returns PascalCase string (e.g., 'NewFeature', 'WorkItem')
|
|
10
|
+
*/
|
|
11
|
+
export function kebabToPascalCase(str) {
|
|
12
|
+
return str.split('-').map(function (word) {
|
|
13
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
14
|
+
}).join('');
|
|
15
|
+
}
|
|
5
16
|
|
|
6
17
|
/**
|
|
7
18
|
* Extracts icon name and size from an icon-object import path
|
|
@@ -18,7 +29,7 @@ export function parseIconObjectImport(importPath) {
|
|
|
18
29
|
size = _match[2];
|
|
19
30
|
|
|
20
31
|
// Check if this is a valid icon name we support
|
|
21
|
-
if (!
|
|
32
|
+
if (!AVAILABLE_ICON_NAMES.includes(iconName)) {
|
|
22
33
|
return null;
|
|
23
34
|
}
|
|
24
35
|
return {
|
|
@@ -29,20 +40,24 @@ export function parseIconObjectImport(importPath) {
|
|
|
29
40
|
|
|
30
41
|
/**
|
|
31
42
|
* Gets the new import specifier for an icon based on its name and size
|
|
32
|
-
* @param iconName - The kebab-case icon name (e.g., 'new-feature')
|
|
43
|
+
* @param iconName - The kebab-case icon name from icon-object (e.g., 'new-feature', 'issue')
|
|
33
44
|
* @param size - The size ('16' or '24')
|
|
34
45
|
* @returns Object with the new import path and component name
|
|
35
46
|
*/
|
|
36
47
|
export function getNewImportInfo(iconName, size) {
|
|
37
|
-
|
|
48
|
+
// Check if this icon name needs to be mapped to a different object name
|
|
49
|
+
var objectName = ICON_TO_OBJECT_NAME_MAPPINGS[iconName] || iconName;
|
|
50
|
+
|
|
51
|
+
// Convert the object name to PascalCase
|
|
52
|
+
var pascalCaseName = kebabToPascalCase(objectName);
|
|
38
53
|
if (size === '16') {
|
|
39
54
|
return {
|
|
40
|
-
importPath: "@atlaskit/object/".concat(
|
|
55
|
+
importPath: "@atlaskit/object/".concat(objectName),
|
|
41
56
|
componentName: "".concat(pascalCaseName, "Object")
|
|
42
57
|
};
|
|
43
58
|
} else {
|
|
44
59
|
return {
|
|
45
|
-
importPath: "@atlaskit/object/tile/".concat(
|
|
60
|
+
importPath: "@atlaskit/object/tile/".concat(objectName),
|
|
46
61
|
componentName: "".concat(pascalCaseName, "ObjectTile")
|
|
47
62
|
};
|
|
48
63
|
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
export declare const OLD_ICON_OBJECT_ENTRY_POINT = "@atlaskit/icon-object";
|
|
2
2
|
export declare const NEW_OBJECT_ENTRY_POINT = "@atlaskit/object";
|
|
3
3
|
export declare const NEW_OBJECT_TILE_ENTRY_POINT = "@atlaskit/object/tile";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Mappings for icon-object names that change when migrating to object.
|
|
6
|
+
* Key: old icon-object name (kebab-case)
|
|
7
|
+
* Value: new object name (kebab-case)
|
|
8
|
+
*
|
|
9
|
+
* Use this when the icon name in icon-object doesn't match the object name.
|
|
10
|
+
* For example, 'issue' icon-object becomes 'work-item' object.
|
|
11
|
+
*
|
|
12
|
+
* Icons not listed here will use their original name (converted to PascalCase automatically).
|
|
13
|
+
*/
|
|
14
|
+
export declare const ICON_TO_OBJECT_NAME_MAPPINGS: Record<string, string>;
|
|
5
15
|
export declare const AVAILABLE_ICON_NAMES: string[];
|
|
6
16
|
export declare const PRINT_SETTINGS: {
|
|
7
17
|
quote: "single";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a kebab-case string to PascalCase
|
|
3
|
+
* @param str - The kebab-case string (e.g., 'new-feature', 'work-item')
|
|
4
|
+
* @returns PascalCase string (e.g., 'NewFeature', 'WorkItem')
|
|
5
|
+
*/
|
|
6
|
+
export declare function kebabToPascalCase(str: string): string;
|
|
1
7
|
/**
|
|
2
8
|
* Extracts icon name and size from an icon-object import path
|
|
3
9
|
* @param importPath - The import path like '@atlaskit/icon-object/glyph/new-feature/16'
|
|
@@ -9,7 +15,7 @@ export declare function parseIconObjectImport(importPath: string): {
|
|
|
9
15
|
} | null;
|
|
10
16
|
/**
|
|
11
17
|
* Gets the new import specifier for an icon based on its name and size
|
|
12
|
-
* @param iconName - The kebab-case icon name (e.g., 'new-feature')
|
|
18
|
+
* @param iconName - The kebab-case icon name from icon-object (e.g., 'new-feature', 'issue')
|
|
13
19
|
* @param size - The size ('16' or '24')
|
|
14
20
|
* @returns Object with the new import path and component name
|
|
15
21
|
*/
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
export declare const OLD_ICON_OBJECT_ENTRY_POINT = "@atlaskit/icon-object";
|
|
2
2
|
export declare const NEW_OBJECT_ENTRY_POINT = "@atlaskit/object";
|
|
3
3
|
export declare const NEW_OBJECT_TILE_ENTRY_POINT = "@atlaskit/object/tile";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Mappings for icon-object names that change when migrating to object.
|
|
6
|
+
* Key: old icon-object name (kebab-case)
|
|
7
|
+
* Value: new object name (kebab-case)
|
|
8
|
+
*
|
|
9
|
+
* Use this when the icon name in icon-object doesn't match the object name.
|
|
10
|
+
* For example, 'issue' icon-object becomes 'work-item' object.
|
|
11
|
+
*
|
|
12
|
+
* Icons not listed here will use their original name (converted to PascalCase automatically).
|
|
13
|
+
*/
|
|
14
|
+
export declare const ICON_TO_OBJECT_NAME_MAPPINGS: Record<string, string>;
|
|
5
15
|
export declare const AVAILABLE_ICON_NAMES: string[];
|
|
6
16
|
export declare const PRINT_SETTINGS: {
|
|
7
17
|
quote: "single";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a kebab-case string to PascalCase
|
|
3
|
+
* @param str - The kebab-case string (e.g., 'new-feature', 'work-item')
|
|
4
|
+
* @returns PascalCase string (e.g., 'NewFeature', 'WorkItem')
|
|
5
|
+
*/
|
|
6
|
+
export declare function kebabToPascalCase(str: string): string;
|
|
1
7
|
/**
|
|
2
8
|
* Extracts icon name and size from an icon-object import path
|
|
3
9
|
* @param importPath - The import path like '@atlaskit/icon-object/glyph/new-feature/16'
|
|
@@ -9,7 +15,7 @@ export declare function parseIconObjectImport(importPath: string): {
|
|
|
9
15
|
} | null;
|
|
10
16
|
/**
|
|
11
17
|
* Gets the new import specifier for an icon based on its name and size
|
|
12
|
-
* @param iconName - The kebab-case icon name (e.g., 'new-feature')
|
|
18
|
+
* @param iconName - The kebab-case icon name from icon-object (e.g., 'new-feature', 'issue')
|
|
13
19
|
* @param size - The size ('16' or '24')
|
|
14
20
|
* @returns Object with the new import path and component name
|
|
15
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/codemod-cli",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.2",
|
|
4
4
|
"description": "A cli for distributing codemods for atlassian-frontend components and services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -19,16 +19,6 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"atlaskit:src": "src/index.ts",
|
|
22
|
-
"af:exports": {
|
|
23
|
-
".": "./src/index.ts",
|
|
24
|
-
"./cli": "./src/cli.ts",
|
|
25
|
-
"./filepath": "./src/filepath.ts",
|
|
26
|
-
"./main": "./src/main.ts",
|
|
27
|
-
"./sinceRef": "./src/sinceRef.ts",
|
|
28
|
-
"./transforms": "./src/transforms.ts",
|
|
29
|
-
"./types": "./src/types.ts",
|
|
30
|
-
"./utils": "./src/utils.ts"
|
|
31
|
-
},
|
|
32
22
|
"atlassian": {
|
|
33
23
|
"team": "Design System Team"
|
|
34
24
|
},
|
|
@@ -39,7 +29,7 @@
|
|
|
39
29
|
"bin": "./bin/codemod-cli.js",
|
|
40
30
|
"dependencies": {
|
|
41
31
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
42
|
-
"@atlaskit/tokens": "^
|
|
32
|
+
"@atlaskit/tokens": "^7.0.0",
|
|
43
33
|
"@babel/runtime": "^7.0.0",
|
|
44
34
|
"@codeshift/utils": "^0.2.4",
|
|
45
35
|
"@hypermod/utils": "^0.4.2",
|