@atlaskit/checkbox 17.3.3 → 17.3.4
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 +6 -0
- package/codemods/migrations/remove-imports.tsx +4 -1
- package/codemods/migrations/remove-props.tsx +16 -4
- package/codemods/migrations/rename-import.tsx +12 -3
- package/codemods/migrations/rename-input-ref-to-ref.tsx +4 -6
- package/codemods/utils.tsx +53 -16
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createRemoveImportsFor } from '../utils';
|
|
2
2
|
|
|
3
|
-
export const removeThemeImports: (
|
|
3
|
+
export const removeThemeImports: (
|
|
4
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
5
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
6
|
+
) => void = createRemoveImportsFor({
|
|
4
7
|
importsToRemove: ['ComponentTokens', 'ThemeFn'],
|
|
5
8
|
packagePath: '@atlaskit/checkbox/types',
|
|
6
9
|
comment: `This file uses exports used to help theme @atlaskit/checkbox which
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { createRemoveFuncFor } from '../utils';
|
|
2
2
|
|
|
3
|
-
export const removeFullWidth: (
|
|
3
|
+
export const removeFullWidth: (
|
|
4
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
5
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
6
|
+
) => void = createRemoveFuncFor('@atlaskit/checkbox', 'Checkbox', 'isFullWidth');
|
|
4
7
|
|
|
5
|
-
export const removeOverrides: (
|
|
8
|
+
export const removeOverrides: (
|
|
9
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
10
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
11
|
+
) => void = createRemoveFuncFor(
|
|
6
12
|
'@atlaskit/checkbox',
|
|
7
13
|
'Checkbox',
|
|
8
14
|
'overrides',
|
|
@@ -13,7 +19,10 @@ export const removeOverrides: (j: import("jscodeshift/src/core").JSCodeshift, so
|
|
|
13
19
|
of Checkbox will have likely changed.`,
|
|
14
20
|
);
|
|
15
21
|
|
|
16
|
-
export const removeTheme: (
|
|
22
|
+
export const removeTheme: (
|
|
23
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
24
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
25
|
+
) => void = createRemoveFuncFor(
|
|
17
26
|
'@atlaskit/checkbox',
|
|
18
27
|
'Checkbox',
|
|
19
28
|
'theme',
|
|
@@ -24,4 +33,7 @@ export const removeTheme: (j: import("jscodeshift/src/core").JSCodeshift, source
|
|
|
24
33
|
The appearance of Checkbox will have likely changed.`,
|
|
25
34
|
);
|
|
26
35
|
|
|
27
|
-
export const removeSize: (
|
|
36
|
+
export const removeSize: (
|
|
37
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
38
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
39
|
+
) => void = createRemoveFuncFor('@atlaskit/checkbox', 'Checkbox', 'size');
|
|
@@ -4,19 +4,28 @@ import { createRenameImportFor } from '../utils';
|
|
|
4
4
|
// there are a lot of possible things to fix. Having searched on SourceTree
|
|
5
5
|
// these are the only things that need to be fixed
|
|
6
6
|
|
|
7
|
-
export const renameTypeImport: (
|
|
7
|
+
export const renameTypeImport: (
|
|
8
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
9
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
10
|
+
) => void = createRenameImportFor({
|
|
8
11
|
componentName: 'CheckboxProps',
|
|
9
12
|
oldPackagePath: '@atlaskit/checkbox/types',
|
|
10
13
|
newPackagePath: '@atlaskit/checkbox',
|
|
11
14
|
});
|
|
12
15
|
|
|
13
|
-
export const renameDeepTypeImport: (
|
|
16
|
+
export const renameDeepTypeImport: (
|
|
17
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
18
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
19
|
+
) => void = createRenameImportFor({
|
|
14
20
|
componentName: 'CheckboxProps',
|
|
15
21
|
oldPackagePath: '@atlaskit/checkbox/dist/cjs/types',
|
|
16
22
|
newPackagePath: '@atlaskit/checkbox',
|
|
17
23
|
});
|
|
18
24
|
|
|
19
|
-
export const renameCheckboxWithoutAnalyticsImport: (
|
|
25
|
+
export const renameCheckboxWithoutAnalyticsImport: (
|
|
26
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
27
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
28
|
+
) => void = createRenameImportFor({
|
|
20
29
|
componentName: 'CheckboxWithoutAnalytics',
|
|
21
30
|
newComponentName: 'Checkbox',
|
|
22
31
|
oldPackagePath: '@atlaskit/checkbox/Checkbox',
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { createRenameFuncFor } from '../utils';
|
|
2
2
|
|
|
3
|
-
export const renameInputRef: (
|
|
4
|
-
'
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
'ref',
|
|
8
|
-
);
|
|
3
|
+
export const renameInputRef: (
|
|
4
|
+
j: import('jscodeshift/src/core').JSCodeshift,
|
|
5
|
+
source: import('jscodeshift/src/Collection').Collection<Node>,
|
|
6
|
+
) => void = createRenameFuncFor('@atlaskit/checkbox', 'Checkbox', 'inputRef', 'ref');
|
package/codemods/utils.tsx
CHANGED
|
@@ -20,7 +20,7 @@ export function getNamedSpecifier(
|
|
|
20
20
|
source: any,
|
|
21
21
|
specifier: string,
|
|
22
22
|
importName: string,
|
|
23
|
-
) {
|
|
23
|
+
): any {
|
|
24
24
|
const specifiers = source
|
|
25
25
|
.find(j.ImportDeclaration)
|
|
26
26
|
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
@@ -61,7 +61,11 @@ export function getJSXAttributesByName(
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export function hasImportDeclaration(
|
|
64
|
+
export function hasImportDeclaration(
|
|
65
|
+
j: core.JSCodeshift,
|
|
66
|
+
source: any,
|
|
67
|
+
importPath: string,
|
|
68
|
+
): boolean {
|
|
65
69
|
const imports = source
|
|
66
70
|
.find(j.ImportDeclaration)
|
|
67
71
|
.filter(
|
|
@@ -78,7 +82,7 @@ export function findIdentifierAndReplaceAttribute(
|
|
|
78
82
|
identifierName: string,
|
|
79
83
|
searchAttr: string,
|
|
80
84
|
replaceWithAttr: string,
|
|
81
|
-
) {
|
|
85
|
+
): void {
|
|
82
86
|
source
|
|
83
87
|
.find(j.JSXElement)
|
|
84
88
|
.find(j.JSXOpeningElement)
|
|
@@ -136,7 +140,7 @@ export function addCommentToStartOfFile({
|
|
|
136
140
|
j: core.JSCodeshift;
|
|
137
141
|
base: Collection<Node>;
|
|
138
142
|
message: string;
|
|
139
|
-
}) {
|
|
143
|
+
}): void {
|
|
140
144
|
addCommentBefore({
|
|
141
145
|
j,
|
|
142
146
|
target: base.find(j.Program),
|
|
@@ -152,7 +156,7 @@ export function addCommentBefore({
|
|
|
152
156
|
j: core.JSCodeshift;
|
|
153
157
|
target: Collection<Program> | Collection<ImportDeclaration>;
|
|
154
158
|
message: string;
|
|
155
|
-
}) {
|
|
159
|
+
}): void {
|
|
156
160
|
const content: string = ` TODO: (from codemod) ${clean(message)} `;
|
|
157
161
|
target.forEach((path: ASTPath<Program | ImportDeclaration>) => {
|
|
158
162
|
path.value.comments = path.value.comments || [];
|
|
@@ -178,7 +182,7 @@ export function tryCreateImport({
|
|
|
178
182
|
base: Collection<any>;
|
|
179
183
|
relativeToPackage: string;
|
|
180
184
|
packageName: string;
|
|
181
|
-
}) {
|
|
185
|
+
}): void {
|
|
182
186
|
const exists: boolean =
|
|
183
187
|
base.find(j.ImportDeclaration).filter((path) => path.value.source.value === packageName)
|
|
184
188
|
.length > 0;
|
|
@@ -203,7 +207,7 @@ export function addToImport({
|
|
|
203
207
|
base: Collection<any>;
|
|
204
208
|
importSpecifier: ImportSpecifier | ImportDefaultSpecifier;
|
|
205
209
|
packageName: string;
|
|
206
|
-
}) {
|
|
210
|
+
}): void {
|
|
207
211
|
base
|
|
208
212
|
.find(j.ImportDeclaration)
|
|
209
213
|
.filter((path) => path.value.source.value === packageName)
|
|
@@ -223,7 +227,12 @@ export function addToImport({
|
|
|
223
227
|
});
|
|
224
228
|
}
|
|
225
229
|
|
|
226
|
-
export const createRenameFuncFor
|
|
230
|
+
export const createRenameFuncFor: (
|
|
231
|
+
component: string,
|
|
232
|
+
importName: string,
|
|
233
|
+
from: string,
|
|
234
|
+
to: string,
|
|
235
|
+
) => (j: core.JSCodeshift, source: Collection<Node>) => void =
|
|
227
236
|
(component: string, importName: string, from: string, to: string) =>
|
|
228
237
|
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
229
238
|
const specifier = getNamedSpecifier(j, source, component, importName);
|
|
@@ -253,7 +262,12 @@ export const createRenameFuncFor =
|
|
|
253
262
|
}
|
|
254
263
|
};
|
|
255
264
|
|
|
256
|
-
export const createRemoveFuncFor
|
|
265
|
+
export const createRemoveFuncFor: (
|
|
266
|
+
component: string,
|
|
267
|
+
importName: string,
|
|
268
|
+
prop: string,
|
|
269
|
+
comment?: string,
|
|
270
|
+
) => (j: core.JSCodeshift, source: Collection<Node>) => void =
|
|
257
271
|
(component: string, importName: string, prop: string, comment?: string) =>
|
|
258
272
|
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
259
273
|
const specifier =
|
|
@@ -274,7 +288,17 @@ export const createRemoveFuncFor =
|
|
|
274
288
|
});
|
|
275
289
|
};
|
|
276
290
|
|
|
277
|
-
export const createRenameImportFor
|
|
291
|
+
export const createRenameImportFor: ({
|
|
292
|
+
componentName,
|
|
293
|
+
newComponentName,
|
|
294
|
+
oldPackagePath,
|
|
295
|
+
newPackagePath,
|
|
296
|
+
}: {
|
|
297
|
+
componentName: string;
|
|
298
|
+
newComponentName?: string;
|
|
299
|
+
oldPackagePath: string;
|
|
300
|
+
newPackagePath: string;
|
|
301
|
+
}) => (j: core.JSCodeshift, source: Collection<Node>) => void =
|
|
278
302
|
({
|
|
279
303
|
componentName,
|
|
280
304
|
newComponentName,
|
|
@@ -355,7 +379,15 @@ export const createRenameImportFor =
|
|
|
355
379
|
.remove();
|
|
356
380
|
};
|
|
357
381
|
|
|
358
|
-
export const createRemoveImportsFor
|
|
382
|
+
export const createRemoveImportsFor: ({
|
|
383
|
+
importsToRemove,
|
|
384
|
+
packagePath,
|
|
385
|
+
comment,
|
|
386
|
+
}: {
|
|
387
|
+
importsToRemove: string[];
|
|
388
|
+
packagePath: string;
|
|
389
|
+
comment: string;
|
|
390
|
+
}) => (j: core.JSCodeshift, source: Collection<Node>) => void =
|
|
359
391
|
({
|
|
360
392
|
importsToRemove,
|
|
361
393
|
packagePath,
|
|
@@ -425,16 +457,21 @@ export const createRemoveImportsFor =
|
|
|
425
457
|
}
|
|
426
458
|
};
|
|
427
459
|
|
|
428
|
-
export const createTransformer
|
|
460
|
+
export const createTransformer: (
|
|
461
|
+
component: string,
|
|
462
|
+
migrates: {
|
|
463
|
+
(j: core.JSCodeshift, source: Collection<Node>): void;
|
|
464
|
+
}[],
|
|
465
|
+
) => (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string =
|
|
429
466
|
(component: string, migrates: { (j: core.JSCodeshift, source: Collection<Node>): void }[]) =>
|
|
430
|
-
(fileInfo: FileInfo, { jscodeshift
|
|
431
|
-
const source: Collection<Node> =
|
|
467
|
+
(fileInfo: FileInfo, { jscodeshift }: API, options: Options) => {
|
|
468
|
+
const source: Collection<Node> = jscodeshift(fileInfo.source);
|
|
432
469
|
|
|
433
|
-
if (!hasImportDeclaration(
|
|
470
|
+
if (!hasImportDeclaration(jscodeshift, source, component)) {
|
|
434
471
|
return fileInfo.source;
|
|
435
472
|
}
|
|
436
473
|
|
|
437
|
-
migrates.forEach((tf) => tf(
|
|
474
|
+
migrates.forEach((tf) => tf(jscodeshift, source));
|
|
438
475
|
|
|
439
476
|
return source.toSource(options.printOptions || { quote: 'single' });
|
|
440
477
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/checkbox",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.4",
|
|
4
4
|
"description": "A checkbox is an input control that allows a user to select one or more options from a number of choices.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/css": "^0.19.0",
|
|
37
37
|
"@atlaskit/ds-lib": "^5.3.0",
|
|
38
38
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
39
|
-
"@atlaskit/theme": "^
|
|
39
|
+
"@atlaskit/theme": "^22.0.0",
|
|
40
40
|
"@atlaskit/tokens": "^11.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@compiled/react": "^0.18.6"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@af/integration-testing": "workspace:^",
|
|
50
50
|
"@af/suppress-react-warnings": "workspace:^",
|
|
51
51
|
"@af/visual-regression": "workspace:^",
|
|
52
|
-
"@atlaskit/button": "^23.
|
|
53
|
-
"@atlaskit/docs": "^11.
|
|
52
|
+
"@atlaskit/button": "^23.10.0",
|
|
53
|
+
"@atlaskit/docs": "^11.5.0",
|
|
54
54
|
"@atlaskit/form": "^15.3.0",
|
|
55
55
|
"@atlaskit/link": "^3.3.0",
|
|
56
56
|
"@atlaskit/primitives": "^18.0.0",
|
|
@@ -91,9 +91,6 @@
|
|
|
91
91
|
"platform-checkbox-atomic-styles": {
|
|
92
92
|
"type": "boolean"
|
|
93
93
|
},
|
|
94
|
-
"platform-visual-refresh-icons": {
|
|
95
|
-
"type": "boolean"
|
|
96
|
-
},
|
|
97
94
|
"platform-dst-shape-theme-default": {
|
|
98
95
|
"type": "boolean"
|
|
99
96
|
}
|