@workday/canvas-kit-codemod 8.0.0-alpha.125-next.4 → 8.0.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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workday/canvas-kit-codemod",
|
|
3
3
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "8.0.0
|
|
5
|
+
"version": "8.0.0",
|
|
6
6
|
"description": "A collection of codemods for use on Workday Canvas Kit packages.",
|
|
7
7
|
"main": "dist/es6/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"test": "TZ=UTC jest -c ../../jest.config.js",
|
|
44
44
|
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "433a9d272804ceed26191ac1ef629d61fab4dcb4"
|
|
47
47
|
}
|
package/dist/es6/v8/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v8/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,QAAA,MAAM,SAAS,EAAE,SAKhB,CAAC;AACF,eAAe,SAAS,CAAC"}
|
package/dist/es6/v8/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import revomeDefaultImports from './removeDefaultImports';
|
|
13
|
-
var transform = function (file, api, options) {
|
|
14
|
-
// These will run in order. If your transform depends on others, place yours after dependent transforms
|
|
15
|
-
var fixes = [revomeDefaultImports];
|
|
16
|
-
return fixes.reduce(function (source, fix) { return fix(__assign(__assign({}, file), { source: source }), api, options); }, file.source);
|
|
17
|
-
};
|
|
18
|
-
export default transform;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeDefaultImports.d.ts","sourceRoot":"","sources":["../../../lib/v8/removeDefaultImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAA6B,MAAM,aAAa,CAAC;AAiC/E,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAuB7E"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// List of import paths and the named export
|
|
2
|
-
// before: import Button from '@workday/canvas-kit-react/button
|
|
3
|
-
// after: import { Button } from '@workday/canvas-kit-react/button
|
|
4
|
-
var renameDefaultMap = {
|
|
5
|
-
'@workday/canvas-kit-labs-react/combobox': 'Combobox',
|
|
6
|
-
'@workday/canvas-kit-labs-react/drawer': 'Drawer',
|
|
7
|
-
'@workday/canvas-kit-preview-react/breadcrumbs': 'Breadcrumbs',
|
|
8
|
-
'@workday/canvas-kit-preview-react/color-picker': 'ColorPicker',
|
|
9
|
-
'@workday/canvas-kit-preview-react/menu': 'Menu',
|
|
10
|
-
'@workday/canvas-kit-preview-react/select': 'Select',
|
|
11
|
-
'@workday/canvas-kit-preview-react/side-panel': 'SidePanel',
|
|
12
|
-
'@workday/canvas-kit-react-fonts': 'fonts',
|
|
13
|
-
'@workday/canvas-kit-react/toast': 'Toast',
|
|
14
|
-
'@workday/canvas-kit-react/tokens': 'Canvas',
|
|
15
|
-
'@workday/canvas-kit-react/tooltip': 'Tooltip',
|
|
16
|
-
'@workday/canvas-kit-react/text-area': 'TextArea',
|
|
17
|
-
'@workday/canvas-kit-react/avatar': 'Avatar',
|
|
18
|
-
'@workday/canvas-kit-react/badge': 'CountBadge',
|
|
19
|
-
'@workday/canvas-kit-react/checkbox': 'Checkbox',
|
|
20
|
-
'@workday/canvas-kit-react/form-field': 'FormField',
|
|
21
|
-
'@workday/canvas-kit-react/loading-animation': 'LoadingDots',
|
|
22
|
-
'@workday/canvas-kit-react/radio': 'Radio',
|
|
23
|
-
'@workday/canvas-kit-react/segmented-control': 'SegmentedControl',
|
|
24
|
-
'@workday/canvas-kit-react/select': 'Select',
|
|
25
|
-
'@workday/canvas-kit-react/side-panel': 'SidePanel',
|
|
26
|
-
'@workday/canvas-kit-react/status-indicator': 'StatusIndicator',
|
|
27
|
-
'@workday/canvas-kit-react/switch': 'Switch',
|
|
28
|
-
'@workday/canvas-kit-react/table': 'Table',
|
|
29
|
-
'@workday/canvas-kit-react/text-input': 'TextInput',
|
|
30
|
-
};
|
|
31
|
-
export default function transformer(file, api, options) {
|
|
32
|
-
var j = api.jscodeshift;
|
|
33
|
-
var root = j(file.source);
|
|
34
|
-
// Renames default imports from `renameDefaultMap` and changes them to named exports
|
|
35
|
-
// Example:
|
|
36
|
-
// before:
|
|
37
|
-
// import Button from '@workday/canvas-kit-react/button';
|
|
38
|
-
// import StyledButton from '@workday/canvas-kit-react/button';
|
|
39
|
-
// after:
|
|
40
|
-
// import { Button } from '@workday/canvas-kit-react/button';
|
|
41
|
-
// import { Button as StyledButton } from '@workday/canvas-kit-react/button';
|
|
42
|
-
root.find(j.ImportDefaultSpecifier).forEach(function (nodePath) {
|
|
43
|
-
var _a;
|
|
44
|
-
var parent = nodePath.parent;
|
|
45
|
-
var importSource = String(parent.node.source.value);
|
|
46
|
-
var localName = (_a = nodePath.value.local) === null || _a === void 0 ? void 0 : _a.name;
|
|
47
|
-
if (Object.keys(renameDefaultMap).includes(importSource) && localName) {
|
|
48
|
-
nodePath.replace(j.importSpecifier(j.identifier(localName)));
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return root.toSource();
|
|
52
|
-
}
|