@atlaskit/button 17.17.2 → 17.18.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 +56 -1
- package/__perf__/button.tsx +6 -6
- package/__perf__/custom.tsx +6 -6
- package/__perf__/customised.tsx +1 -3
- package/__perf__/utils/example-runner.tsx +32 -36
- package/__perf__/utils/interaction-tasks.tsx +65 -86
- package/codemods/15.0.0-lite-mode.tsx +32 -36
- package/codemods/15.1.1-data-testid.tsx +136 -142
- package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +121 -121
- package/codemods/__tests__/15.0.0-lite-mode/safe.tsx +54 -54
- package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +96 -97
- package/codemods/__tests__/15.1.1-data-testid/rename-data-testid.tsx +32 -32
- package/codemods/__tests__/_framework.tsx +32 -32
- package/codemods/helpers/15.0.0-runner.tsx +135 -137
- package/codemods/helpers/helpers-generic.tsx +524 -556
- package/codemods/optimistic-15.0.0-lite-mode.tsx +208 -231
- package/dist/cjs/containers/button-group.js +3 -1
- package/dist/cjs/new-button/containers/split-button/split-button.js +6 -2
- package/dist/cjs/new-button/variants/default/button.js +8 -1
- package/dist/cjs/new-button/variants/default/link.js +8 -1
- package/dist/cjs/new-button/variants/default/use-default-button.js +7 -1
- package/dist/cjs/new-button/variants/icon/button.js +6 -1
- package/dist/cjs/new-button/variants/icon/link.js +6 -1
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/cjs/new-button/variants/shared/constants.js +7 -0
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/cjs/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/cjs/old-button/button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/theme.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +9 -3
- package/dist/cjs/old-button/shared/css.js +4 -3
- package/dist/es2019/containers/button-group.js +3 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +5 -2
- package/dist/es2019/new-button/variants/default/button.js +7 -0
- package/dist/es2019/new-button/variants/default/link.js +9 -2
- package/dist/es2019/new-button/variants/default/use-default-button.js +7 -1
- package/dist/es2019/new-button/variants/icon/button.js +5 -0
- package/dist/es2019/new-button/variants/icon/link.js +8 -3
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/es2019/new-button/variants/shared/constants.js +1 -0
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/es2019/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/es2019/old-button/button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/theme.js +2 -0
- package/dist/es2019/old-button/shared/button-base.js +10 -3
- package/dist/es2019/old-button/shared/css.js +4 -2
- package/dist/esm/containers/button-group.js +3 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +5 -2
- package/dist/esm/new-button/variants/default/button.js +8 -1
- package/dist/esm/new-button/variants/default/link.js +10 -3
- package/dist/esm/new-button/variants/default/use-default-button.js +7 -1
- package/dist/esm/new-button/variants/icon/button.js +6 -1
- package/dist/esm/new-button/variants/icon/link.js +9 -4
- package/dist/esm/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/esm/new-button/variants/shared/constants.js +1 -0
- package/dist/esm/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/esm/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/esm/old-button/button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/theme.js +2 -0
- package/dist/esm/old-button/shared/button-base.js +10 -3
- package/dist/esm/old-button/shared/css.js +4 -2
- package/dist/types/entry-points/loading-button.d.ts +1 -1
- package/dist/types/entry-points/new.d.ts +3 -3
- package/dist/types/entry-points/types.d.ts +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/new-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/types.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +5 -1
- package/dist/types/new.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/loading-button.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/new.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/types.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +3 -3
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +5 -1
- package/dist/types-ts4.5/new.d.ts +3 -3
- package/extract-react-types/custom-theme-button-props.tsx +2 -4
- package/extract-react-types/legacy-button/custom-theme-button-props.tsx +2 -4
- package/extract-react-types/legacy-button/loading-button-props.tsx +1 -1
- package/extract-react-types/legacy-button/shared-props.tsx +1 -1
- package/extract-react-types/loading-button-props.tsx +1 -1
- package/extract-react-types/new-button/containers/split-button/split-button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/default/button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/default/common-default-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/default/link-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/icon-button/common-icon-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/icon-button/link-icon-button-props.tsx +2 -4
- package/extract-react-types/shared-props.tsx +1 -1
- package/package.json +202 -201
- package/report.api.md +78 -96
|
@@ -4,16 +4,16 @@ import transformer from '../../15.1.1-data-testid';
|
|
|
4
4
|
import { check } from '../_framework';
|
|
5
5
|
|
|
6
6
|
check({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
transformer,
|
|
8
|
+
it: 'should rename data-testid to testId (default import)',
|
|
9
|
+
original: `
|
|
10
10
|
import DSButton from '@atlaskit/button';
|
|
11
11
|
|
|
12
12
|
function App() {
|
|
13
13
|
return <DSButton data-testid="my-testid">click me</DSButton>;
|
|
14
14
|
}
|
|
15
15
|
`,
|
|
16
|
-
|
|
16
|
+
expected: `
|
|
17
17
|
import DSButton from '@atlaskit/button';
|
|
18
18
|
|
|
19
19
|
function App() {
|
|
@@ -23,16 +23,16 @@ check({
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
check({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
transformer,
|
|
27
|
+
it: 'should rename data-testid to testId (standard button)',
|
|
28
|
+
original: `
|
|
29
29
|
import Button from '@atlaskit/button/standard-button';
|
|
30
30
|
|
|
31
31
|
function App() {
|
|
32
32
|
return <Button data-testid="my-testid">click me</Button>;
|
|
33
33
|
}
|
|
34
34
|
`,
|
|
35
|
-
|
|
35
|
+
expected: `
|
|
36
36
|
import Button from '@atlaskit/button/standard-button';
|
|
37
37
|
|
|
38
38
|
function App() {
|
|
@@ -42,16 +42,16 @@ check({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
check({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
transformer,
|
|
46
|
+
it: 'should rename data-testid to testId (loading button)',
|
|
47
|
+
original: `
|
|
48
48
|
import Button from '@atlaskit/button/loading-button';
|
|
49
49
|
|
|
50
50
|
function App() {
|
|
51
51
|
return <Button data-testid="my-testid">click me</Button>;
|
|
52
52
|
}
|
|
53
53
|
`,
|
|
54
|
-
|
|
54
|
+
expected: `
|
|
55
55
|
import Button from '@atlaskit/button/loading-button';
|
|
56
56
|
|
|
57
57
|
function App() {
|
|
@@ -61,16 +61,16 @@ check({
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
check({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
transformer,
|
|
65
|
+
it: 'should rename data-testid to testId (custom theme button)',
|
|
66
|
+
original: `
|
|
67
67
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
68
68
|
|
|
69
69
|
function App() {
|
|
70
70
|
return <Button data-testid="my-testid">click me</Button>;
|
|
71
71
|
}
|
|
72
72
|
`,
|
|
73
|
-
|
|
73
|
+
expected: `
|
|
74
74
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
75
75
|
|
|
76
76
|
function App() {
|
|
@@ -80,9 +80,9 @@ check({
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
check({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
transformer,
|
|
84
|
+
it: 'should rename data-testid to testId (named imports)',
|
|
85
|
+
original: `
|
|
86
86
|
import { StandardButton, LoadingButton, CustomThemeButton } from '@atlaskit/button';
|
|
87
87
|
|
|
88
88
|
function App() {
|
|
@@ -93,7 +93,7 @@ check({
|
|
|
93
93
|
</>;
|
|
94
94
|
}
|
|
95
95
|
`,
|
|
96
|
-
|
|
96
|
+
expected: `
|
|
97
97
|
import { StandardButton, LoadingButton, CustomThemeButton } from '@atlaskit/button';
|
|
98
98
|
|
|
99
99
|
function App() {
|
|
@@ -107,9 +107,9 @@ check({
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
check({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
transformer,
|
|
111
|
+
it: 'should rename data-testid to testId (named imports with alias)',
|
|
112
|
+
original: `
|
|
113
113
|
import { StandardButton as SB, LoadingButton as LB, CustomThemeButton as CTB } from '@atlaskit/button';
|
|
114
114
|
|
|
115
115
|
function App() {
|
|
@@ -120,7 +120,7 @@ check({
|
|
|
120
120
|
</>;
|
|
121
121
|
}
|
|
122
122
|
`,
|
|
123
|
-
|
|
123
|
+
expected: `
|
|
124
124
|
import { StandardButton as SB, LoadingButton as LB, CustomThemeButton as CTB } from '@atlaskit/button';
|
|
125
125
|
|
|
126
126
|
function App() {
|
|
@@ -134,16 +134,16 @@ check({
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
check({
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
transformer,
|
|
138
|
+
it: 'should add a warning when both the testId and data-testid props are being used',
|
|
139
|
+
original: `
|
|
140
140
|
import StandardButton from '@atlaskit/button';
|
|
141
141
|
|
|
142
142
|
function App() {
|
|
143
143
|
return <StandardButton testId="oh-my" data-testid="oh-dear">Click me</StandardButton>
|
|
144
144
|
}
|
|
145
145
|
`,
|
|
146
|
-
|
|
146
|
+
expected: `
|
|
147
147
|
/* TODO: (from codemod) Cannot rename data-testid to testId on StandardButton.
|
|
148
148
|
A StandardButton was detected with both data-testid and testId props.
|
|
149
149
|
Please remove the data-testid prop and check your tests */
|
|
@@ -156,9 +156,9 @@ check({
|
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
check({
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
transformer,
|
|
160
|
+
it: 'should not touch unrelated testids',
|
|
161
|
+
original: `
|
|
162
162
|
import DSButton from '@atlaskit/button';
|
|
163
163
|
import Something from '@atlaskit/foobar';
|
|
164
164
|
|
|
@@ -170,7 +170,7 @@ check({
|
|
|
170
170
|
</>;
|
|
171
171
|
}
|
|
172
172
|
`,
|
|
173
|
-
|
|
173
|
+
expected: `
|
|
174
174
|
import DSButton from '@atlaskit/button';
|
|
175
175
|
import Something from '@atlaskit/foobar';
|
|
176
176
|
|
|
@@ -7,41 +7,41 @@ const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
|
|
|
7
7
|
type Transformer = (file: FileInfo, jscodeshift: API, options: Options) => void;
|
|
8
8
|
|
|
9
9
|
type TestArgs = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
it: string;
|
|
11
|
+
original: string;
|
|
12
|
+
expected: string;
|
|
13
|
+
transformer: Transformer;
|
|
14
|
+
mode?: 'only' | 'skip' | 'standard';
|
|
15
|
+
before?: () => void;
|
|
16
|
+
after?: () => void;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export function check({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
it: name,
|
|
21
|
+
original,
|
|
22
|
+
expected,
|
|
23
|
+
transformer,
|
|
24
|
+
before = noop,
|
|
25
|
+
after = noop,
|
|
26
|
+
mode = 'standard',
|
|
27
27
|
}: TestArgs) {
|
|
28
|
-
|
|
28
|
+
const run = mode === 'only' ? it.only : mode === 'skip' ? it.skip : it;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
run(name, () => {
|
|
31
|
+
before();
|
|
32
|
+
try {
|
|
33
|
+
const output: string = applyTransform(
|
|
34
|
+
{ default: transformer, parser: 'tsx' },
|
|
35
|
+
{},
|
|
36
|
+
{ source: original },
|
|
37
|
+
);
|
|
38
|
+
expect(output).toBe(expected.trim());
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// a failed assertion will throw
|
|
41
|
+
after();
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
44
|
+
// will only be hit if we don't throw
|
|
45
|
+
after();
|
|
46
|
+
});
|
|
47
47
|
}
|
|
@@ -3,167 +3,165 @@ import type { default as core, FileInfo, JSXElement } from 'jscodeshift';
|
|
|
3
3
|
import { type Collection } from 'jscodeshift/src/Collection';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
addToImport,
|
|
7
|
+
changeImportFor,
|
|
8
|
+
hasImportDeclaration,
|
|
9
|
+
removeImport,
|
|
10
|
+
tryCreateImport,
|
|
11
11
|
} from './helpers-generic';
|
|
12
12
|
|
|
13
13
|
export function convertButtonType({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
j,
|
|
15
|
+
base,
|
|
16
|
+
elements,
|
|
17
|
+
name,
|
|
18
|
+
newPackageName,
|
|
19
19
|
}: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
j: core.JSCodeshift;
|
|
21
|
+
base: Collection<any>;
|
|
22
|
+
elements: NodePath<JSXElement, JSXElement>[];
|
|
23
|
+
name: string;
|
|
24
|
+
newPackageName: string;
|
|
25
25
|
}) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// Don't need to do anything if there are no elements of this type
|
|
27
|
+
if (!elements.length) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
tryCreateImport({
|
|
32
|
+
j,
|
|
33
|
+
base,
|
|
34
|
+
relativeToPackage: '@atlaskit/button',
|
|
35
|
+
packageName: newPackageName,
|
|
36
|
+
});
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
addToImport({
|
|
39
|
+
j,
|
|
40
|
+
base,
|
|
41
|
+
importSpecifier: j.importDefaultSpecifier(j.identifier(name)),
|
|
42
|
+
packageName: newPackageName,
|
|
43
|
+
});
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
});
|
|
45
|
+
elements.forEach((path: NodePath<JSXElement, JSXElement>) => {
|
|
46
|
+
path.replace(
|
|
47
|
+
j.jsxElement(
|
|
48
|
+
j.jsxOpeningElement(
|
|
49
|
+
// name: new!
|
|
50
|
+
j.jsxIdentifier(name),
|
|
51
|
+
// keep the old attributes
|
|
52
|
+
path.value.openingElement.attributes,
|
|
53
|
+
// self closing
|
|
54
|
+
path.value.openingElement.selfClosing,
|
|
55
|
+
),
|
|
56
|
+
// Only create a closing element if the original had one
|
|
57
|
+
// <Button /> => <Button /> (rather than <Button></Button>)
|
|
58
|
+
path.value.closingElement ? j.jsxClosingElement(j.jsxIdentifier(name)) : null,
|
|
59
|
+
path.value.children,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
});
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
export function changeType({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
j,
|
|
67
|
+
base,
|
|
68
|
+
oldName,
|
|
69
|
+
newName,
|
|
70
|
+
fallbackNameAlias,
|
|
73
71
|
}: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
j: core.JSCodeshift;
|
|
73
|
+
base: Collection<any>;
|
|
74
|
+
oldName: string;
|
|
75
|
+
newName: string;
|
|
76
|
+
fallbackNameAlias: string;
|
|
79
77
|
}) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
78
|
+
changeImportFor({
|
|
79
|
+
j,
|
|
80
|
+
base,
|
|
81
|
+
option: {
|
|
82
|
+
type: 'change-name',
|
|
83
|
+
oldName,
|
|
84
|
+
newName,
|
|
85
|
+
fallbackNameAlias,
|
|
86
|
+
},
|
|
87
|
+
oldPackagePath: '@atlaskit/button',
|
|
88
|
+
newPackagePath: '@atlaskit/button/types',
|
|
89
|
+
});
|
|
90
|
+
changeImportFor({
|
|
91
|
+
j,
|
|
92
|
+
base,
|
|
93
|
+
option: {
|
|
94
|
+
type: 'change-name',
|
|
95
|
+
oldName,
|
|
96
|
+
newName,
|
|
97
|
+
fallbackNameAlias,
|
|
98
|
+
},
|
|
99
|
+
oldPackagePath: '@atlaskit/button/types',
|
|
100
|
+
newPackagePath: '@atlaskit/button/types',
|
|
101
|
+
});
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
export function transformButton({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
j,
|
|
106
|
+
file,
|
|
107
|
+
custom: fn,
|
|
110
108
|
}: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
j: core.JSCodeshift;
|
|
110
|
+
file: FileInfo;
|
|
111
|
+
custom: (base: Collection<any>) => void;
|
|
114
112
|
}) {
|
|
115
|
-
|
|
113
|
+
const base: Collection<any> = j(file.source);
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
// Exit early if not relevant
|
|
116
|
+
// We are doing this so we don't touch the formatting of unrelated files
|
|
117
|
+
const willChange: boolean =
|
|
118
|
+
hasImportDeclaration(j, file.source, '@atlaskit/button') ||
|
|
119
|
+
hasImportDeclaration(j, file.source, '@atlaskit/button/types');
|
|
122
120
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
if (!willChange) {
|
|
122
|
+
return file.source;
|
|
123
|
+
}
|
|
126
124
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
125
|
+
changeType({
|
|
126
|
+
j,
|
|
127
|
+
base,
|
|
128
|
+
oldName: 'ButtonAppearances',
|
|
129
|
+
newName: 'Appearance',
|
|
130
|
+
fallbackNameAlias: 'DSButtonAppearance',
|
|
131
|
+
});
|
|
134
132
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
133
|
+
changeImportFor({
|
|
134
|
+
j,
|
|
135
|
+
base,
|
|
136
|
+
// Not changing the name
|
|
137
|
+
option: {
|
|
138
|
+
type: 'keep-name',
|
|
139
|
+
name: 'Theme',
|
|
140
|
+
behaviour: 'keep-as-named-import',
|
|
141
|
+
},
|
|
142
|
+
oldPackagePath: '@atlaskit/button',
|
|
143
|
+
newPackagePath: '@atlaskit/button/custom-theme-button',
|
|
144
|
+
});
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
146
|
+
changeImportFor({
|
|
147
|
+
j,
|
|
148
|
+
base,
|
|
149
|
+
option: {
|
|
150
|
+
type: 'keep-name',
|
|
151
|
+
name: 'ButtonGroup',
|
|
152
|
+
behaviour: 'move-to-default-import',
|
|
153
|
+
},
|
|
154
|
+
oldPackagePath: '@atlaskit/button',
|
|
155
|
+
newPackagePath: '@atlaskit/button/button-group',
|
|
156
|
+
});
|
|
159
157
|
|
|
160
|
-
|
|
158
|
+
fn(base);
|
|
161
159
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
removeImport({
|
|
161
|
+
j,
|
|
162
|
+
base,
|
|
163
|
+
packageName: '@atlaskit/button',
|
|
164
|
+
});
|
|
167
165
|
|
|
168
|
-
|
|
166
|
+
return base.toSource({ quote: 'single' });
|
|
169
167
|
}
|