@workday/canvas-kit-codemod 14.1.7 → 14.1.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v14-tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v14-tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAQtC,QAAA,MAAM,SAAS,EAAE,SAShB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import migrateNewColorTokens from './migrateColorTokens';
|
|
2
|
+
import migrateColorTokens from '../v13.2/migrateColorTokens';
|
|
2
3
|
import migrateDepthTokens from '../v13.2/migrateDepthTokens';
|
|
3
4
|
import migrateOtherTokens from '../v13.2/migrateOtherTokens';
|
|
4
5
|
import migrateTypeTokens from '../v13.2/migrateTypeTokens';
|
|
5
6
|
const transform = (file, api, options) => {
|
|
6
|
-
const fixes = [
|
|
7
|
+
const fixes = [
|
|
8
|
+
migrateColorTokens,
|
|
9
|
+
migrateNewColorTokens,
|
|
10
|
+
migrateDepthTokens,
|
|
11
|
+
migrateTypeTokens,
|
|
12
|
+
migrateOtherTokens,
|
|
13
|
+
];
|
|
7
14
|
return fixes.reduce((source, fix) => fix({ ...file, source }, api, options), file.source);
|
|
8
15
|
};
|
|
9
16
|
export default transform;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v14-tokens/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v14-tokens/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAUlD,QAAA,MAAM,SAAS,EAAE,SAwHhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -2,11 +2,7 @@ import { addMissingImports, filterOutImports, getImports } from '../v13.2/utils'
|
|
|
2
2
|
import { transformObjectPropertyRecursively } from './utils/transformObjectPropertyRecursively';
|
|
3
3
|
import { mapping } from '../v13.2/mapping';
|
|
4
4
|
import baseMapping from './baseMapping';
|
|
5
|
-
const canvasImportSources = [
|
|
6
|
-
'@workday/canvas-kit-styling',
|
|
7
|
-
'@workday/canvas-kit-react/tokens',
|
|
8
|
-
'@workday/canvas-tokens-web',
|
|
9
|
-
];
|
|
5
|
+
const canvasImportSources = ['@workday/canvas-kit-styling', '@workday/canvas-tokens-web'];
|
|
10
6
|
const transform = (file, api) => {
|
|
11
7
|
const j = api.jscodeshift;
|
|
12
8
|
const root = j(file.source);
|
|
@@ -19,7 +15,7 @@ const transform = (file, api) => {
|
|
|
19
15
|
.forEach(nodePath => {
|
|
20
16
|
importDeclaration = { ...importDeclaration, ...getImports(nodePath) };
|
|
21
17
|
});
|
|
22
|
-
if (!Object.values(importDeclaration).some(importedValue => importedValue === '
|
|
18
|
+
if (!Object.values(importDeclaration).some(importedValue => importedValue === 'base')) {
|
|
23
19
|
return root.toSource();
|
|
24
20
|
}
|
|
25
21
|
root
|
|
@@ -55,13 +51,6 @@ const transform = (file, api) => {
|
|
|
55
51
|
const map = importedName === 'base' ? { type: 'base' } : mapping[importedName];
|
|
56
52
|
if (map.type === 'base' && lowestProperty.type === 'Identifier') {
|
|
57
53
|
const colorName = baseMapping[lowestProperty.name];
|
|
58
|
-
if (mainName === 'colors') {
|
|
59
|
-
addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['base'] });
|
|
60
|
-
addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
|
|
61
|
-
return j.callExpression(j.identifier('cssVar'), [
|
|
62
|
-
j.memberExpression(j.identifier(map.type), j.identifier(colorName || lowestProperty.name)),
|
|
63
|
-
]);
|
|
64
|
-
}
|
|
65
54
|
if (mainName === 'base') {
|
|
66
55
|
addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['base'] });
|
|
67
56
|
return j.memberExpression(j.identifier(map.type), j.identifier(colorName));
|
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": "14.1.
|
|
5
|
+
"version": "14.1.8",
|
|
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,
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"resolutions": {
|
|
47
47
|
"recast": "0.20.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ff982533fc1812c0ef704246fe432f9ec1164098"
|
|
50
50
|
}
|