@atlaskit/codemod-cli 0.28.2 → 0.29.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/CHANGELOG.md +15 -0
- package/cli/package.json +1 -1
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/index.js +2 -1
- package/dist/cjs/presets/migrate-icon-object-to-object/codemods/migrate-icon-object-to-object.js +138 -0
- package/dist/cjs/presets/migrate-icon-object-to-object/migrate-icon-object-to-object.js +44 -0
- package/dist/cjs/presets/migrate-icon-object-to-object/utils/constants.js +44 -0
- package/dist/cjs/presets/migrate-icon-object-to-object/utils/icon-mappings.js +65 -0
- package/dist/es2019/presets/index.js +2 -1
- package/dist/es2019/presets/migrate-icon-object-to-object/codemods/migrate-icon-object-to-object.js +130 -0
- package/dist/es2019/presets/migrate-icon-object-to-object/migrate-icon-object-to-object.js +18 -0
- package/dist/es2019/presets/migrate-icon-object-to-object/utils/constants.js +38 -0
- package/dist/es2019/presets/migrate-icon-object-to-object/utils/icon-mappings.js +54 -0
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/index.js +2 -1
- package/dist/esm/presets/migrate-icon-object-to-object/codemods/migrate-icon-object-to-object.js +132 -0
- package/dist/esm/presets/migrate-icon-object-to-object/migrate-icon-object-to-object.js +37 -0
- package/dist/esm/presets/migrate-icon-object-to-object/utils/constants.js +38 -0
- package/dist/esm/presets/migrate-icon-object-to-object/utils/icon-mappings.js +57 -0
- package/dist/types/presets/index.d.ts +1 -0
- package/dist/types/presets/migrate-icon-object-to-object/codemods/migrate-icon-object-to-object.d.ts +3 -0
- package/dist/types/presets/migrate-icon-object-to-object/migrate-icon-object-to-object.d.ts +2 -0
- package/dist/types/presets/migrate-icon-object-to-object/utils/constants.d.ts +9 -0
- package/dist/types/presets/migrate-icon-object-to-object/utils/icon-mappings.d.ts +23 -0
- package/dist/types/presets/migrate-to-link/utils/comments.d.ts +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.d.ts +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.d.ts +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/generate-link-element.d.ts +2 -2
- package/dist/types/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts +3 -3
- package/dist/types/presets/migrate-to-new-buttons/utils/if-variant-already-imported.d.ts +2 -2
- package/dist/types/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.d.ts +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.d.ts +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/rename-default-button-to-legacy-button.d.ts +1 -1
- package/dist/types/transforms.d.ts +0 -1
- package/dist/types-ts4.5/presets/index.d.ts +1 -0
- package/dist/types-ts4.5/presets/migrate-icon-object-to-object/codemods/migrate-icon-object-to-object.d.ts +3 -0
- package/dist/types-ts4.5/presets/migrate-icon-object-to-object/migrate-icon-object-to-object.d.ts +2 -0
- package/dist/types-ts4.5/presets/migrate-icon-object-to-object/utils/constants.d.ts +9 -0
- package/dist/types-ts4.5/presets/migrate-icon-object-to-object/utils/icon-mappings.d.ts +23 -0
- package/dist/types-ts4.5/presets/migrate-to-link/utils/comments.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-link-element.d.ts +2 -2
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts +3 -3
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/if-variant-already-imported.d.ts +2 -2
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/rename-default-button-to-legacy-button.d.ts +1 -1
- package/dist/types-ts4.5/transforms.d.ts +0 -1
- package/filepath/package.json +1 -1
- package/main/package.json +1 -1
- package/package.json +3 -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/dist/esm/presets/migrate-icon-object-to-object/codemods/migrate-icon-object-to-object.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
2
|
+
|
|
3
|
+
import { OLD_ICON_OBJECT_ENTRY_POINT, PRINT_SETTINGS } from '../utils/constants';
|
|
4
|
+
import { createDefaultImportDeclaration, getNewImportInfo, parseIconObjectImport } from '../utils/icon-mappings';
|
|
5
|
+
var transformer = function transformer(file, api) {
|
|
6
|
+
var j = api.jscodeshift;
|
|
7
|
+
var fileSource = j(file.source);
|
|
8
|
+
|
|
9
|
+
// Find all icon-object imports
|
|
10
|
+
var iconObjectImports = fileSource.find(j.ImportDeclaration).filter(function (path) {
|
|
11
|
+
var source = path.node.source.value;
|
|
12
|
+
return typeof source === 'string' && source.startsWith(OLD_ICON_OBJECT_ENTRY_POINT);
|
|
13
|
+
});
|
|
14
|
+
if (!iconObjectImports.length) {
|
|
15
|
+
return fileSource.toSource();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Track import name mappings (old name -> new name) and new imports to create
|
|
19
|
+
var importNameMappings = new Map();
|
|
20
|
+
var newImportsToCreate = [];
|
|
21
|
+
|
|
22
|
+
// Process each icon-object import
|
|
23
|
+
iconObjectImports.forEach(function (importPath) {
|
|
24
|
+
var _importDeclaration$sp;
|
|
25
|
+
var importDeclaration = importPath.node;
|
|
26
|
+
var source = importDeclaration.source.value;
|
|
27
|
+
var parsedImport = parseIconObjectImport(source);
|
|
28
|
+
if (!parsedImport) {
|
|
29
|
+
return; // Skip invalid imports
|
|
30
|
+
}
|
|
31
|
+
var iconName = parsedImport.iconName,
|
|
32
|
+
size = parsedImport.size;
|
|
33
|
+
var _getNewImportInfo = getNewImportInfo(iconName, size),
|
|
34
|
+
newImportPath = _getNewImportInfo.importPath,
|
|
35
|
+
componentName = _getNewImportInfo.componentName;
|
|
36
|
+
|
|
37
|
+
// Get the current import name (could be default import or renamed)
|
|
38
|
+
var defaultSpecifier = (_importDeclaration$sp = importDeclaration.specifiers) === null || _importDeclaration$sp === void 0 ? void 0 : _importDeclaration$sp.find(function (spec) {
|
|
39
|
+
return spec.type === 'ImportDefaultSpecifier';
|
|
40
|
+
});
|
|
41
|
+
if (defaultSpecifier) {
|
|
42
|
+
var _defaultSpecifier$loc;
|
|
43
|
+
var currentImportName = (_defaultSpecifier$loc = defaultSpecifier.local) === null || _defaultSpecifier$loc === void 0 ? void 0 : _defaultSpecifier$loc.name;
|
|
44
|
+
if (currentImportName) {
|
|
45
|
+
// Map the old import name to the new component name
|
|
46
|
+
importNameMappings.set(currentImportName, componentName);
|
|
47
|
+
|
|
48
|
+
// Track the new import to create
|
|
49
|
+
newImportsToCreate.push({
|
|
50
|
+
componentName: componentName,
|
|
51
|
+
importPath: newImportPath
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Update JSX elements to use new component names
|
|
58
|
+
importNameMappings.forEach(function (newName, oldName) {
|
|
59
|
+
fileSource.find(j.JSXElement).filter(function (path) {
|
|
60
|
+
var openingElement = path.value.openingElement;
|
|
61
|
+
return openingElement.name.type === 'JSXIdentifier' && openingElement.name.name === oldName;
|
|
62
|
+
}).forEach(function (elementPath) {
|
|
63
|
+
var _element$closingEleme;
|
|
64
|
+
var element = elementPath.value;
|
|
65
|
+
|
|
66
|
+
// Update opening tag
|
|
67
|
+
if (element.openingElement.name.type === 'JSXIdentifier') {
|
|
68
|
+
element.openingElement.name.name = newName;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Update closing tag if it exists
|
|
72
|
+
if (((_element$closingEleme = element.closingElement) === null || _element$closingEleme === void 0 ? void 0 : _element$closingEleme.name.type) === 'JSXIdentifier') {
|
|
73
|
+
element.closingElement.name.name = newName;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// For 24px icons (now object tiles), add size="small" prop
|
|
77
|
+
if (newName.endsWith('ObjectTile')) {
|
|
78
|
+
var attributes = element.openingElement.attributes;
|
|
79
|
+
if (attributes) {
|
|
80
|
+
// Add size="small" (24px icons should be small tiles)
|
|
81
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier('size'), j.stringLiteral('small')));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Update other references (like in render calls, etc.)
|
|
88
|
+
importNameMappings.forEach(function (newName, oldName) {
|
|
89
|
+
fileSource.find(j.Identifier).filter(function (path) {
|
|
90
|
+
return path.node.name === oldName;
|
|
91
|
+
}).forEach(function (path) {
|
|
92
|
+
var _parent$value, _parent$value2;
|
|
93
|
+
// Only update if it's not part of an import declaration or JSX element
|
|
94
|
+
// (those are handled separately)
|
|
95
|
+
var parent = path.parent;
|
|
96
|
+
if ((parent === null || parent === void 0 || (_parent$value = parent.value) === null || _parent$value === void 0 ? void 0 : _parent$value.type) !== 'ImportDefaultSpecifier' && (parent === null || parent === void 0 || (_parent$value2 = parent.value) === null || _parent$value2 === void 0 ? void 0 : _parent$value2.type) !== 'JSXIdentifier') {
|
|
97
|
+
path.node.name = newName;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Remove old icon-object imports
|
|
103
|
+
iconObjectImports.remove();
|
|
104
|
+
|
|
105
|
+
// Create new individual default imports
|
|
106
|
+
var newImports = newImportsToCreate.map(function (_ref) {
|
|
107
|
+
var componentName = _ref.componentName,
|
|
108
|
+
importPath = _ref.importPath;
|
|
109
|
+
return createDefaultImportDeclaration(j, componentName, importPath);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Insert new imports at the top of the file
|
|
113
|
+
if (newImports.length > 0) {
|
|
114
|
+
var firstImport = fileSource.find(j.ImportDeclaration).at(0);
|
|
115
|
+
if (firstImport.length > 0) {
|
|
116
|
+
// Insert before the first existing import
|
|
117
|
+
// insertBefore adds in reverse order, so we need to reverse the array
|
|
118
|
+
newImports.reverse().forEach(function (importDecl) {
|
|
119
|
+
firstImport.insertBefore(importDecl);
|
|
120
|
+
});
|
|
121
|
+
} else {
|
|
122
|
+
// No existing imports, add at the top of the file
|
|
123
|
+
var body = fileSource.find(j.Program).get('body');
|
|
124
|
+
// For unshift, we also need to reverse to maintain correct order
|
|
125
|
+
newImports.reverse().forEach(function (importDecl) {
|
|
126
|
+
body.unshift(importDecl);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return fileSource.toSource(PRINT_SETTINGS);
|
|
131
|
+
};
|
|
132
|
+
export default transformer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import migrateIconObjectToObjectTransformer from './codemods/migrate-icon-object-to-object';
|
|
7
|
+
export default function transformer(_x, _x2) {
|
|
8
|
+
return _transformer.apply(this, arguments);
|
|
9
|
+
}
|
|
10
|
+
function _transformer() {
|
|
11
|
+
_transformer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, api) {
|
|
12
|
+
var transformers, src;
|
|
13
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
transformers = [migrateIconObjectToObjectTransformer];
|
|
17
|
+
src = file.source;
|
|
18
|
+
transformers.forEach(function (transformer) {
|
|
19
|
+
if (typeof src === 'undefined') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
var nextSrc = transformer(_objectSpread(_objectSpread({}, file), {}, {
|
|
23
|
+
source: src
|
|
24
|
+
}), api);
|
|
25
|
+
if (nextSrc) {
|
|
26
|
+
src = nextSrc;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return _context.abrupt("return", src);
|
|
30
|
+
case 4:
|
|
31
|
+
case "end":
|
|
32
|
+
return _context.stop();
|
|
33
|
+
}
|
|
34
|
+
}, _callee);
|
|
35
|
+
}));
|
|
36
|
+
return _transformer.apply(this, arguments);
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
2
|
+
|
|
3
|
+
// Entry points
|
|
4
|
+
export var OLD_ICON_OBJECT_ENTRY_POINT = '@atlaskit/icon-object';
|
|
5
|
+
export var NEW_OBJECT_ENTRY_POINT = '@atlaskit/object';
|
|
6
|
+
export var NEW_OBJECT_TILE_ENTRY_POINT = '@atlaskit/object/tile';
|
|
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'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Available icon names (kebab-case)
|
|
34
|
+
export var AVAILABLE_ICON_NAMES = Object.keys(ICON_NAME_MAPPINGS);
|
|
35
|
+
export var PRINT_SETTINGS = {
|
|
36
|
+
quote: 'single',
|
|
37
|
+
trailingComma: true
|
|
38
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
3
|
+
|
|
4
|
+
import { ICON_NAME_MAPPINGS } from './constants';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts icon name and size from an icon-object import path
|
|
8
|
+
* @param importPath - The import path like '@atlaskit/icon-object/glyph/new-feature/16'
|
|
9
|
+
* @returns Object with iconName and size, or null if not a valid icon-object import
|
|
10
|
+
*/
|
|
11
|
+
export function parseIconObjectImport(importPath) {
|
|
12
|
+
var match = importPath.match(/^@atlaskit\/icon-object\/glyph\/([^/]+)\/(16|24)$/);
|
|
13
|
+
if (!match) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
var _match = _slicedToArray(match, 3),
|
|
17
|
+
iconName = _match[1],
|
|
18
|
+
size = _match[2];
|
|
19
|
+
|
|
20
|
+
// Check if this is a valid icon name we support
|
|
21
|
+
if (!ICON_NAME_MAPPINGS[iconName]) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
iconName: iconName,
|
|
26
|
+
size: size
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 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')
|
|
33
|
+
* @param size - The size ('16' or '24')
|
|
34
|
+
* @returns Object with the new import path and component name
|
|
35
|
+
*/
|
|
36
|
+
export function getNewImportInfo(iconName, size) {
|
|
37
|
+
var pascalCaseName = ICON_NAME_MAPPINGS[iconName];
|
|
38
|
+
if (size === '16') {
|
|
39
|
+
return {
|
|
40
|
+
importPath: "@atlaskit/object/".concat(iconName),
|
|
41
|
+
componentName: "".concat(pascalCaseName, "Object")
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
return {
|
|
45
|
+
importPath: "@atlaskit/object/tile/".concat(iconName),
|
|
46
|
+
componentName: "".concat(pascalCaseName, "ObjectTile")
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new default import declaration for the transformed component
|
|
53
|
+
*/
|
|
54
|
+
export function createDefaultImportDeclaration(j, componentName, importPath) {
|
|
55
|
+
var defaultSpecifier = j.importDefaultSpecifier(j.identifier(componentName));
|
|
56
|
+
return j.importDeclaration([defaultSpecifier], j.stringLiteral(importPath));
|
|
57
|
+
}
|
|
@@ -6,6 +6,7 @@ import './styled-to-emotion/styled-to-emotion';
|
|
|
6
6
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
7
7
|
import './migrate-to-link/migrate-to-link';
|
|
8
8
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
9
|
+
import './migrate-icon-object-to-object/migrate-icon-object-to-object';
|
|
9
10
|
import './upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable';
|
|
10
11
|
import './remove-dark-theme-vr-options/remove-dark-theme-vr-options';
|
|
11
12
|
import './remove-token-fallbacks/remove-token-fallbacks';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const OLD_ICON_OBJECT_ENTRY_POINT = "@atlaskit/icon-object";
|
|
2
|
+
export declare const NEW_OBJECT_ENTRY_POINT = "@atlaskit/object";
|
|
3
|
+
export declare const NEW_OBJECT_TILE_ENTRY_POINT = "@atlaskit/object/tile";
|
|
4
|
+
export declare const ICON_NAME_MAPPINGS: Record<string, string>;
|
|
5
|
+
export declare const AVAILABLE_ICON_NAMES: string[];
|
|
6
|
+
export declare const PRINT_SETTINGS: {
|
|
7
|
+
quote: "single";
|
|
8
|
+
trailingComma: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts icon name and size from an icon-object import path
|
|
3
|
+
* @param importPath - The import path like '@atlaskit/icon-object/glyph/new-feature/16'
|
|
4
|
+
* @returns Object with iconName and size, or null if not a valid icon-object import
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseIconObjectImport(importPath: string): {
|
|
7
|
+
iconName: string;
|
|
8
|
+
size: '16' | '24';
|
|
9
|
+
} | null;
|
|
10
|
+
/**
|
|
11
|
+
* 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')
|
|
13
|
+
* @param size - The size ('16' or '24')
|
|
14
|
+
* @returns Object with the new import path and component name
|
|
15
|
+
*/
|
|
16
|
+
export declare function getNewImportInfo(iconName: string, size: '16' | '24'): {
|
|
17
|
+
importPath: string;
|
|
18
|
+
componentName: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new default import declaration for the transformed component
|
|
22
|
+
*/
|
|
23
|
+
export declare function createDefaultImportDeclaration(j: any, componentName: string, importPath: string): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const stylePropComment: ({ propName, prefix, }: {
|
|
2
2
|
propName: string;
|
|
3
|
-
prefix?: string
|
|
3
|
+
prefix?: string;
|
|
4
4
|
}) => string;
|
|
5
5
|
export declare const spreadPropsComment = "This link could not be migrated due to usage of spread props. The codemod cannot determine the props being spread. Please manually migrate.";
|
|
6
6
|
export declare const genericUnsupportedMigrationComment: (prefix?: string) => string;
|
package/dist/types/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { API, Collection } from 'jscodeshift';
|
|
2
|
-
export declare const addCommentForCustomThemeButtons: (fileSource: Collection<any>, j: API[
|
|
2
|
+
export declare const addCommentForCustomThemeButtons: (fileSource: Collection<any>, j: API["jscodeshift"]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { API, Collection, JSXElement } from 'jscodeshift';
|
|
2
|
-
export declare const addCommentForOverlayProp: (oldButtons: Collection<JSXElement>, j: API[
|
|
2
|
+
export declare const addCommentForOverlayProp: (oldButtons: Collection<JSXElement>, j: API["jscodeshift"]) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type API, type JSXElement } from 'jscodeshift';
|
|
2
|
-
export declare const modifyLinkAttributes: (element: JSXElement, j: API[
|
|
3
|
-
export declare const generateLinkComponent: (element: JSXElement, j: API[
|
|
2
|
+
export declare const modifyLinkAttributes: (element: JSXElement, j: API["jscodeshift"]) => void;
|
|
3
|
+
export declare const generateLinkComponent: (element: JSXElement, j: API["jscodeshift"]) => JSXElement | undefined;
|
|
@@ -15,6 +15,6 @@ export declare const getIconElement: (iconAttr: JSXAttribute) => JSXElement | nu
|
|
|
15
15
|
* @param j
|
|
16
16
|
* @param iconRenamed
|
|
17
17
|
*/
|
|
18
|
-
export declare const handleIconAttributes: (element: JSXElement, j: API[
|
|
19
|
-
export declare const generateNewElement: (variant: (typeof NEW_BUTTON_VARIANTS)[keyof typeof NEW_BUTTON_VARIANTS], element: JSXElement, j: API[
|
|
20
|
-
export declare const modifyButtonAttributes: (element: JSXElement, j: API[
|
|
18
|
+
export declare const handleIconAttributes: (element: JSXElement, j: API["jscodeshift"], iconRenamed?: boolean) => void;
|
|
19
|
+
export declare const generateNewElement: (variant: (typeof NEW_BUTTON_VARIANTS)[keyof typeof NEW_BUTTON_VARIANTS], element: JSXElement, j: API["jscodeshift"]) => JSXElement;
|
|
20
|
+
export declare const modifyButtonAttributes: (element: JSXElement, j: API["jscodeshift"], hasSpacingNone: boolean) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { API, Collection } from 'jscodeshift';
|
|
2
|
-
export declare const findVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API[
|
|
3
|
-
export declare const checkIfVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API[
|
|
2
|
+
export declare const findVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API["jscodeshift"], isDefaultSpecifier?: boolean) => Collection<any>;
|
|
3
|
+
export declare const checkIfVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API["jscodeshift"], isDefaultSpecifier?: boolean) => boolean;
|
package/dist/types/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { API, ASTPath } from 'jscodeshift';
|
|
2
2
|
import { type JSXElement } from 'jscodeshift';
|
|
3
|
-
export declare const migrateFitContainerIconButton: (element: ASTPath<JSXElement>, j: API[
|
|
3
|
+
export declare const migrateFitContainerIconButton: (element: ASTPath<JSXElement>, j: API["jscodeshift"]) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type API, type ASTPath, type JSXElement, type JSXExpressionContainer } from 'jscodeshift';
|
|
2
|
-
declare const moveIcon: (j: API[
|
|
2
|
+
declare const moveIcon: (j: API["jscodeshift"], path: ASTPath<JSXElement>, iconNode: JSXExpressionContainer | undefined | null, beforeOrAfter: "iconBefore" | "iconAfter") => void;
|
|
3
3
|
export default moveIcon;
|
package/dist/types/presets/migrate-to-new-buttons/utils/rename-default-button-to-legacy-button.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { API, Collection, ImportDeclaration, JSXElement } from 'jscodeshift';
|
|
2
|
-
export declare const renameDefaultButtonToLegacyButtonImport: (oldButtonImport: Collection<ImportDeclaration>, oldButtonElements: Collection<JSXElement>, j: API[
|
|
2
|
+
export declare const renameDefaultButtonToLegacyButtonImport: (oldButtonImport: Collection<ImportDeclaration>, oldButtonElements: Collection<JSXElement>, j: API["jscodeshift"]) => void;
|
|
@@ -6,6 +6,7 @@ import './styled-to-emotion/styled-to-emotion';
|
|
|
6
6
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
7
7
|
import './migrate-to-link/migrate-to-link';
|
|
8
8
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
9
|
+
import './migrate-icon-object-to-object/migrate-icon-object-to-object';
|
|
9
10
|
import './upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable';
|
|
10
11
|
import './remove-dark-theme-vr-options/remove-dark-theme-vr-options';
|
|
11
12
|
import './remove-token-fallbacks/remove-token-fallbacks';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const OLD_ICON_OBJECT_ENTRY_POINT = "@atlaskit/icon-object";
|
|
2
|
+
export declare const NEW_OBJECT_ENTRY_POINT = "@atlaskit/object";
|
|
3
|
+
export declare const NEW_OBJECT_TILE_ENTRY_POINT = "@atlaskit/object/tile";
|
|
4
|
+
export declare const ICON_NAME_MAPPINGS: Record<string, string>;
|
|
5
|
+
export declare const AVAILABLE_ICON_NAMES: string[];
|
|
6
|
+
export declare const PRINT_SETTINGS: {
|
|
7
|
+
quote: "single";
|
|
8
|
+
trailingComma: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts icon name and size from an icon-object import path
|
|
3
|
+
* @param importPath - The import path like '@atlaskit/icon-object/glyph/new-feature/16'
|
|
4
|
+
* @returns Object with iconName and size, or null if not a valid icon-object import
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseIconObjectImport(importPath: string): {
|
|
7
|
+
iconName: string;
|
|
8
|
+
size: '16' | '24';
|
|
9
|
+
} | null;
|
|
10
|
+
/**
|
|
11
|
+
* 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')
|
|
13
|
+
* @param size - The size ('16' or '24')
|
|
14
|
+
* @returns Object with the new import path and component name
|
|
15
|
+
*/
|
|
16
|
+
export declare function getNewImportInfo(iconName: string, size: '16' | '24'): {
|
|
17
|
+
importPath: string;
|
|
18
|
+
componentName: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new default import declaration for the transformed component
|
|
22
|
+
*/
|
|
23
|
+
export declare function createDefaultImportDeclaration(j: any, componentName: string, importPath: string): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const stylePropComment: ({ propName, prefix, }: {
|
|
2
2
|
propName: string;
|
|
3
|
-
prefix?: string
|
|
3
|
+
prefix?: string;
|
|
4
4
|
}) => string;
|
|
5
5
|
export declare const spreadPropsComment = "This link could not be migrated due to usage of spread props. The codemod cannot determine the props being spread. Please manually migrate.";
|
|
6
6
|
export declare const genericUnsupportedMigrationComment: (prefix?: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { API, Collection } from 'jscodeshift';
|
|
2
|
-
export declare const addCommentForCustomThemeButtons: (fileSource: Collection<any>, j: API[
|
|
2
|
+
export declare const addCommentForCustomThemeButtons: (fileSource: Collection<any>, j: API["jscodeshift"]) => void;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { API, Collection, JSXElement } from 'jscodeshift';
|
|
2
|
-
export declare const addCommentForOverlayProp: (oldButtons: Collection<JSXElement>, j: API[
|
|
2
|
+
export declare const addCommentForOverlayProp: (oldButtons: Collection<JSXElement>, j: API["jscodeshift"]) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type API, type JSXElement } from 'jscodeshift';
|
|
2
|
-
export declare const modifyLinkAttributes: (element: JSXElement, j: API[
|
|
3
|
-
export declare const generateLinkComponent: (element: JSXElement, j: API[
|
|
2
|
+
export declare const modifyLinkAttributes: (element: JSXElement, j: API["jscodeshift"]) => void;
|
|
3
|
+
export declare const generateLinkComponent: (element: JSXElement, j: API["jscodeshift"]) => JSXElement | undefined;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export declare const getIconElement: (iconAttr: JSXAttribute) => JSXElement | nu
|
|
|
15
15
|
* @param j
|
|
16
16
|
* @param iconRenamed
|
|
17
17
|
*/
|
|
18
|
-
export declare const handleIconAttributes: (element: JSXElement, j: API[
|
|
19
|
-
export declare const generateNewElement: (variant: (typeof NEW_BUTTON_VARIANTS)[keyof typeof NEW_BUTTON_VARIANTS], element: JSXElement, j: API[
|
|
20
|
-
export declare const modifyButtonAttributes: (element: JSXElement, j: API[
|
|
18
|
+
export declare const handleIconAttributes: (element: JSXElement, j: API["jscodeshift"], iconRenamed?: boolean) => void;
|
|
19
|
+
export declare const generateNewElement: (variant: (typeof NEW_BUTTON_VARIANTS)[keyof typeof NEW_BUTTON_VARIANTS], element: JSXElement, j: API["jscodeshift"]) => JSXElement;
|
|
20
|
+
export declare const modifyButtonAttributes: (element: JSXElement, j: API["jscodeshift"], hasSpacingNone: boolean) => void;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/if-variant-already-imported.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { API, Collection } from 'jscodeshift';
|
|
2
|
-
export declare const findVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API[
|
|
3
|
-
export declare const checkIfVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API[
|
|
2
|
+
export declare const findVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API["jscodeshift"], isDefaultSpecifier?: boolean) => Collection<any>;
|
|
3
|
+
export declare const checkIfVariantAlreadyImported: (variant: string, entryPoint: string, fileSource: Collection<any>, j: API["jscodeshift"], isDefaultSpecifier?: boolean) => boolean;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { API, ASTPath } from 'jscodeshift';
|
|
2
2
|
import { type JSXElement } from 'jscodeshift';
|
|
3
|
-
export declare const migrateFitContainerIconButton: (element: ASTPath<JSXElement>, j: API[
|
|
3
|
+
export declare const migrateFitContainerIconButton: (element: ASTPath<JSXElement>, j: API["jscodeshift"]) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type API, type ASTPath, type JSXElement, type JSXExpressionContainer } from 'jscodeshift';
|
|
2
|
-
declare const moveIcon: (j: API[
|
|
2
|
+
declare const moveIcon: (j: API["jscodeshift"], path: ASTPath<JSXElement>, iconNode: JSXExpressionContainer | undefined | null, beforeOrAfter: "iconBefore" | "iconAfter") => void;
|
|
3
3
|
export default moveIcon;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { API, Collection, ImportDeclaration, JSXElement } from 'jscodeshift';
|
|
2
|
-
export declare const renameDefaultButtonToLegacyButtonImport: (oldButtonImport: Collection<ImportDeclaration>, oldButtonElements: Collection<JSXElement>, j: API[
|
|
2
|
+
export declare const renameDefaultButtonToLegacyButtonImport: (oldButtonImport: Collection<ImportDeclaration>, oldButtonElements: Collection<JSXElement>, j: API["jscodeshift"]) => void;
|
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.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "A cli for distributing codemods for atlassian-frontend components and services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"bin": "./bin/codemod-cli.js",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
42
|
-
"@atlaskit/tokens": "^6.
|
|
42
|
+
"@atlaskit/tokens": "^6.3.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@codeshift/utils": "^0.2.4",
|
|
45
45
|
"@hypermod/utils": "^0.4.2",
|
|
@@ -61,8 +61,7 @@
|
|
|
61
61
|
"@af/formatting": "workspace:^",
|
|
62
62
|
"@types/color-diff": "^1.2.1",
|
|
63
63
|
"prettier": "^3.2.5",
|
|
64
|
-
"ts-node": "^10.9.1"
|
|
65
|
-
"typescript": "~5.4.2"
|
|
64
|
+
"ts-node": "^10.9.1"
|
|
66
65
|
},
|
|
67
66
|
"homepage": "https://atlaskit.atlassian.com/packages/monorepo-tooling/codemod-cli"
|
|
68
67
|
}
|
package/sinceRef/package.json
CHANGED
package/transforms/package.json
CHANGED
package/types/package.json
CHANGED