@atlaskit/codemod-cli 0.24.4 → 0.25.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 +16 -0
- package/README.md +19 -9
- package/bin/codemod-cli.js +10 -10
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/migrate-to-new-buttons/codemods/next-migrate-link-button-to-link.js +94 -0
- package/dist/cjs/presets/migrate-to-new-buttons/codemods/next-migrate-to-new-button-variants.js +30 -8
- package/dist/cjs/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.js +4 -3
- package/dist/cjs/presets/migrate-to-new-buttons/migrate-to-new-buttons.js +2 -1
- package/dist/cjs/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js +2 -0
- package/dist/cjs/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.js +15 -0
- package/dist/cjs/presets/migrate-to-new-buttons/utils/constants.js +2 -1
- package/dist/cjs/presets/migrate-to-new-buttons/utils/find-attribute-with-value.js +17 -0
- package/dist/cjs/presets/migrate-to-new-buttons/utils/generate-link-element.js +40 -0
- package/dist/cjs/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +6 -1
- package/dist/cjs/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.js +30 -0
- package/dist/es2019/presets/migrate-to-new-buttons/codemods/next-migrate-link-button-to-link.js +81 -0
- package/dist/es2019/presets/migrate-to-new-buttons/codemods/next-migrate-to-new-button-variants.js +30 -8
- package/dist/es2019/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.js +3 -2
- package/dist/es2019/presets/migrate-to-new-buttons/migrate-to-new-buttons.js +2 -1
- package/dist/es2019/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js +2 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.js +7 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/constants.js +1 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/find-attribute-with-value.js +11 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/generate-link-element.js +36 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +6 -1
- package/dist/es2019/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.js +24 -0
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/migrate-to-new-buttons/codemods/next-migrate-link-button-to-link.js +87 -0
- package/dist/esm/presets/migrate-to-new-buttons/codemods/next-migrate-to-new-button-variants.js +30 -8
- package/dist/esm/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.js +3 -2
- package/dist/esm/presets/migrate-to-new-buttons/migrate-to-new-buttons.js +2 -1
- package/dist/esm/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js +2 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.js +9 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/constants.js +1 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/find-attribute-with-value.js +11 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/generate-link-element.js +34 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +6 -1
- package/dist/esm/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.js +24 -0
- package/dist/types/presets/migrate-to-new-buttons/codemods/next-migrate-link-button-to-link.d.ts +3 -0
- package/dist/types/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.d.ts +2 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.d.ts +2 -0
- package/dist/types/presets/migrate-to-new-buttons/utils/constants.d.ts +1 -0
- package/dist/types/presets/migrate-to-new-buttons/utils/find-attribute-with-value.d.ts +2 -0
- package/dist/types/presets/migrate-to-new-buttons/utils/generate-link-element.d.ts +3 -0
- package/dist/types/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.d.ts +3 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/codemods/next-migrate-link-button-to-link.d.ts +3 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.d.ts +2 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/add-comment-for-overlay-prop.d.ts +2 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/constants.d.ts +1 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/find-attribute-with-value.d.ts +2 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-link-element.d.ts +3 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.d.ts +3 -0
- package/index.js +6 -6
- package/package.json +63 -63
- package/report.api.md +29 -28
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type JSXElement, type API, type JSXExpressionContainer, type ASTPath } from 'jscodeshift';
|
|
2
|
+
declare const moveIcon: (j: API['jscodeshift'], path: ASTPath<JSXElement>, iconNode: JSXExpressionContainer | undefined | null, beforeOrAfter: 'iconBefore' | 'iconAfter') => void;
|
|
3
|
+
export default moveIcon;
|
|
@@ -22,6 +22,7 @@ export declare const buttonPropsNoLongerSupportedComment = "Buttons with \"compo
|
|
|
22
22
|
export declare const migrateFitContainerButtonToDefaultButtonComment = "Migrated to a default button with text which is from the icon label.";
|
|
23
23
|
export declare const migrateFitContainerButtonToIconButtonComment = "\"shouldFitContainer\" is not available in icon buttons, please consider using a default button with text.";
|
|
24
24
|
export declare const customThemeButtonComment = "CustomThemeButton will be deprecated. Please consider migrating to Pressable or Anchor Primitives with custom styles.";
|
|
25
|
+
export declare const overlayPropComment = "The 'overlay' prop has been deprecated. This only existed in legacy buttons for supporting loading spinners, which can now be achieved in new buttons using the `isLoading` prop. Please remove the `overlay` prop and consider using the new `isLoading` prop.";
|
|
25
26
|
export declare const loadingButtonComment: ({ hasLinkAppearance, hasHref, }: {
|
|
26
27
|
hasLinkAppearance: boolean;
|
|
27
28
|
hasHref: boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type JSXElement, type API, type JSXExpressionContainer, type ASTPath } from 'jscodeshift';
|
|
2
|
+
declare const moveIcon: (j: API['jscodeshift'], path: ASTPath<JSXElement>, iconNode: JSXExpressionContainer | undefined | null, beforeOrAfter: 'iconBefore' | 'iconAfter') => void;
|
|
3
|
+
export default moveIcon;
|
package/index.js
CHANGED
|
@@ -11,12 +11,12 @@ const dev = fs.existsSync(project);
|
|
|
11
11
|
|
|
12
12
|
let entrypoint = path.join(__dirname, 'dist', 'cjs', 'index');
|
|
13
13
|
if (dev) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (!require.extensions['.ts']) {
|
|
15
|
+
// ts-node can only handle being registered once, see https://github.com/TypeStrong/ts-node/issues/409
|
|
16
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
|
+
require('ts-node').register({ project });
|
|
18
|
+
}
|
|
19
|
+
entrypoint = path.join(__dirname, 'src', 'index');
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
module.exports = require(entrypoint);
|
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
2
|
+
"name": "@atlaskit/codemod-cli",
|
|
3
|
+
"version": "0.25.1",
|
|
4
|
+
"description": "A cli for distributing codemods for atlassian-frontend components and services",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
|
+
},
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
|
+
"author": "Atlassian Pty Ltd",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"types": "dist/types/index.d.ts",
|
|
13
|
+
"typesVersions": {
|
|
14
|
+
">=4.5 <4.9": {
|
|
15
|
+
"*": [
|
|
16
|
+
"dist/types-ts4.5/*",
|
|
17
|
+
"dist/types-ts4.5/index.d.ts"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
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
|
+
"atlassian": {
|
|
33
|
+
"team": "Design System Team",
|
|
34
|
+
"releaseModel": "continuous"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"prestart": "cd ../../ && yarn build @atlaskit/codemod-utils tokens",
|
|
38
|
+
"start": "./bin/codemod-cli.js"
|
|
39
|
+
},
|
|
40
|
+
"bin": "./bin/codemod-cli.js",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@atlaskit/codemod-utils": "^4.2.0",
|
|
43
|
+
"@atlaskit/tokens": "^1.54.0",
|
|
44
|
+
"@babel/runtime": "^7.0.0",
|
|
45
|
+
"@codeshift/utils": "^0.2.4",
|
|
46
|
+
"@hypermod/utils": "^0.4.2",
|
|
47
|
+
"@types/jscodeshift": "^0.11.0",
|
|
48
|
+
"chalk": "^4.1.2",
|
|
49
|
+
"enquirer": "^2.3.4",
|
|
50
|
+
"glob": "9.0.0",
|
|
51
|
+
"jscodeshift": "^0.13.0",
|
|
52
|
+
"meow": "^8.1.1",
|
|
53
|
+
"projector-spawn": "^1.0.1",
|
|
54
|
+
"semver": "^7.5.2",
|
|
55
|
+
"simple-git": "^3.16.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@af/formatting": "*",
|
|
59
|
+
"prettier": "^3.2.5",
|
|
60
|
+
"ts-node": "^10.9.1",
|
|
61
|
+
"typescript": "~5.4.2"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://atlaskit.atlassian.com/packages/monorepo-tooling/codemod-cli"
|
|
64
|
+
}
|
package/report.api.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/codemod-cli"
|
|
4
4
|
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
5
|
+
> Do not edit this file. This report is auto-generated using
|
|
6
|
+
> [API Extractor](https://api-extractor.com/).
|
|
6
7
|
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
8
|
|
|
8
9
|
### Table of contents
|
|
@@ -17,15 +18,15 @@
|
|
|
17
18
|
```ts
|
|
18
19
|
// @public (undocumented)
|
|
19
20
|
type CliFlags = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
transform?: string;
|
|
22
|
+
preset?: string;
|
|
23
|
+
packages?: string;
|
|
24
|
+
parser: 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx';
|
|
25
|
+
extensions: string;
|
|
26
|
+
ignorePattern: string;
|
|
27
|
+
sinceRef?: string;
|
|
28
|
+
failOnError?: boolean;
|
|
29
|
+
filterPaths?: boolean;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
// @public
|
|
@@ -33,34 +34,34 @@ type Default<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
|
33
34
|
|
|
34
35
|
// @public (undocumented)
|
|
35
36
|
const defaultFlags: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
parser: 'babel';
|
|
38
|
+
extensions: string;
|
|
39
|
+
ignorePattern: string;
|
|
40
|
+
logger: Console;
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
// @public (undocumented)
|
|
43
44
|
type Flags_2 = CliFlags & {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
logger: {
|
|
46
|
+
log: (...args: any) => void;
|
|
47
|
+
warn: (...args: any) => void;
|
|
48
|
+
};
|
|
48
49
|
};
|
|
49
50
|
export { Flags_2 as Flags };
|
|
50
51
|
|
|
51
52
|
// @public (undocumented)
|
|
52
53
|
function main(
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
input: string[],
|
|
55
|
+
userFlags: UserFlags,
|
|
55
56
|
): Promise<{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
transforms: {
|
|
58
|
+
module: string;
|
|
59
|
+
root: string;
|
|
60
|
+
dir: string;
|
|
61
|
+
base: string;
|
|
62
|
+
ext: string;
|
|
63
|
+
name: string;
|
|
64
|
+
}[];
|
|
64
65
|
}>;
|
|
65
66
|
export default main;
|
|
66
67
|
|