@atlaskit/codemod-cli 0.29.0 → 0.29.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/codemod-cli
2
2
 
3
+ ## 0.29.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e1c9823b0b420`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e1c9823b0b420) -
8
+ Updated `migrate-icon-object-to-object` to use new object name "Work item"
9
+ - Updated dependencies
10
+
3
11
  ## 0.29.0
4
12
 
5
13
  ### Minor Changes
@@ -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.ICON_NAME_MAPPINGS = exports.AVAILABLE_ICON_NAMES = void 0;
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
- // Icon name mappings from kebab-case to PascalCase
15
- var ICON_NAME_MAPPINGS = exports.ICON_NAME_MAPPINGS = {
16
- blog: 'Blog',
17
- branch: 'Branch',
18
- bug: 'Bug',
19
- calendar: 'Calendar',
20
- changes: 'Changes',
21
- code: 'Code',
22
- commit: 'Commit',
23
- epic: 'Epic',
24
- improvement: 'Improvement',
25
- incident: 'Incident',
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 = Object.keys(ICON_NAME_MAPPINGS);
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.ICON_NAME_MAPPINGS[iconName]) {
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
- var pascalCaseName = _constants.ICON_NAME_MAPPINGS[iconName];
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(iconName),
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(iconName),
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
- // Icon name mappings from kebab-case to PascalCase
9
- export const ICON_NAME_MAPPINGS = {
10
- blog: 'Blog',
11
- branch: 'Branch',
12
- bug: 'Bug',
13
- calendar: 'Calendar',
14
- changes: 'Changes',
15
- code: 'Code',
16
- commit: 'Commit',
17
- epic: 'Epic',
18
- improvement: 'Improvement',
19
- incident: 'Incident',
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 = Object.keys(ICON_NAME_MAPPINGS);
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 { ICON_NAME_MAPPINGS } from './constants';
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 (!ICON_NAME_MAPPINGS[iconName]) {
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
- const pascalCaseName = ICON_NAME_MAPPINGS[iconName];
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/${iconName}`,
50
+ importPath: `@atlaskit/object/${objectName}`,
38
51
  componentName: `${pascalCaseName}Object`
39
52
  };
40
53
  } else {
41
54
  return {
42
- importPath: `@atlaskit/object/tile/${iconName}`,
55
+ importPath: `@atlaskit/object/tile/${objectName}`,
43
56
  componentName: `${pascalCaseName}ObjectTile`
44
57
  };
45
58
  }
@@ -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
- // Icon name mappings from kebab-case to PascalCase
9
- export var ICON_NAME_MAPPINGS = {
10
- blog: 'Blog',
11
- branch: 'Branch',
12
- bug: 'Bug',
13
- calendar: 'Calendar',
14
- changes: 'Changes',
15
- code: 'Code',
16
- commit: 'Commit',
17
- epic: 'Epic',
18
- improvement: 'Improvement',
19
- incident: 'Incident',
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 = Object.keys(ICON_NAME_MAPPINGS);
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 { ICON_NAME_MAPPINGS } from './constants';
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 (!ICON_NAME_MAPPINGS[iconName]) {
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
- var pascalCaseName = ICON_NAME_MAPPINGS[iconName];
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(iconName),
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(iconName),
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
- export declare const ICON_NAME_MAPPINGS: Record<string, string>;
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
- export declare const ICON_NAME_MAPPINGS: Record<string, string>;
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.0",
3
+ "version": "0.29.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/"
@@ -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": "^6.3.0",
32
+ "@atlaskit/tokens": "^6.5.0",
43
33
  "@babel/runtime": "^7.0.0",
44
34
  "@codeshift/utils": "^0.2.4",
45
35
  "@hypermod/utils": "^0.4.2",