@workday/canvas-kit-codemod 7.0.0-alpha.83-next.11 → 7.0.0-alpha.87-next.14
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/dist/es6/v7/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Transform } from 'jscodeshift';
|
|
2
|
+
declare const transform: Transform;
|
|
3
|
+
export default transform;
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v7/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v7/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAWtC,QAAA,MAAM,SAAS,EAAE,SAchB,CAAC;AACF,eAAe,SAAS,CAAC"}
|
package/dist/es6/v7/index.js
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
|
-
|
|
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 compoundActionBar from './compoundActionBar';
|
|
13
|
+
import compoundBanner from './compoundBanner';
|
|
14
|
+
import removePropFromPopper from './removePropFromPopper';
|
|
15
|
+
import renameIconRef from './renameIconRef';
|
|
16
|
+
import renameLayoutImports from './renameLayoutImports';
|
|
17
|
+
import updateSegmentedControl from './updateSegmentedControl';
|
|
18
|
+
import renameIconPosition from './renameIconPosition';
|
|
19
|
+
import recategorizeIconButtons from './recategorizeIconButtons';
|
|
20
|
+
var transform = function (file, api, options) {
|
|
2
21
|
// These will run in order. If your transform depends on others, place yours after dependent transforms
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
22
|
+
var fixes = [
|
|
23
|
+
compoundActionBar,
|
|
24
|
+
compoundBanner,
|
|
25
|
+
recategorizeIconButtons,
|
|
26
|
+
renameIconRef,
|
|
27
|
+
removePropFromPopper,
|
|
28
|
+
renameIconPosition,
|
|
29
|
+
renameLayoutImports,
|
|
30
|
+
updateSegmentedControl,
|
|
31
|
+
];
|
|
32
|
+
return fixes.reduce(function (source, fix) { return fix(__assign(__assign({}, file), { source: source }), api, options); }, file.source);
|
|
33
|
+
};
|
|
34
|
+
export default transform;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recategorizeIconButtons.d.ts","sourceRoot":"","sources":["../../../lib/v7/recategorizeIconButtons.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EAMR,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"recategorizeIconButtons.d.ts","sourceRoot":"","sources":["../../../lib/v7/recategorizeIconButtons.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EAMR,MAAM,aAAa,CAAC;AAcrB,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UA0J7E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getImportRenameMap } from './utils/getImportRenameMap';
|
|
2
|
+
import chalk from 'chalk';
|
|
2
3
|
var updateJSXTag = function (nodePath, newTag) {
|
|
3
4
|
var componentName = nodePath.value.openingElement.name.name;
|
|
4
5
|
if (componentName === 'IconButton') {
|
|
@@ -43,15 +44,30 @@ export default function transformer(file, api, options) {
|
|
|
43
44
|
value.openingElement.name.name === styledMap.IconButton);
|
|
44
45
|
})
|
|
45
46
|
.forEach(function (nodePath) {
|
|
46
|
-
var _a
|
|
47
|
+
var _a;
|
|
47
48
|
var attrs = nodePath.value.openingElement.attributes;
|
|
48
49
|
var variantProp = attrs === null || attrs === void 0 ? void 0 : attrs.find(function (attr) { return attr.type === 'JSXAttribute' && attr.name.name === 'variant'; });
|
|
49
50
|
// Default IconButton variant is `circle`
|
|
50
51
|
if (variantProp) {
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
var valueBody = variantProp.value;
|
|
53
|
+
if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.type) === 'JSXExpressionContainer' &&
|
|
54
|
+
valueBody.expression.type === 'StringLiteral') {
|
|
55
|
+
variantProp.value = valueBody.expression;
|
|
56
|
+
}
|
|
57
|
+
var variantPropValue = variantProp.value.value;
|
|
58
|
+
if (variantPropValue) {
|
|
59
|
+
variantProp.value.value = variantPropValue.replace('Filled', '');
|
|
60
|
+
buttonType = /filled/gi.test(variantPropValue) ? 'SecondaryButton' : 'TertiaryButton';
|
|
61
|
+
if (!variantPropValue.includes('inverse')) {
|
|
62
|
+
(_a = nodePath.value.openingElement.attributes) === null || _a === void 0 ? void 0 : _a.splice(attrs === null || attrs === void 0 ? void 0 : attrs.indexOf(variantProp), 1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.warn(chalk.bold.red('** CANNOT UPDATE EXPRESSION FOR ICON BUTTON VARIANT. **') +
|
|
67
|
+
'\nYou will need to manually update this file to fix this warning.' +
|
|
68
|
+
'\nFile Name: ' +
|
|
69
|
+
chalk.blue(file.path) +
|
|
70
|
+
'\nConsult Upgrade Guide Section for v7: "Removal of Icon Button"');
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
updateJSXTag(nodePath, buttonType);
|
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": "7.0.0-alpha.
|
|
5
|
+
"version": "7.0.0-alpha.87-next.14+83b4c509",
|
|
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,
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"test": "TZ=UTC jest -c ../../jest.config.js",
|
|
43
43
|
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "83b4c509b541eead40170a73b449f8cd798d51ef"
|
|
46
46
|
}
|