@workday/canvas-kit-codemod 14.0.0-alpha.1185-next.0 → 14.0.0-alpha.1188-next.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/dist/es6/v13.2/migrateColorTokens.d.ts.map +1 -1
- package/dist/es6/v13.2/migrateColorTokens.js +3 -1
- package/dist/es6/v13.2/migrateDepthTokens.d.ts.map +1 -1
- package/dist/es6/v13.2/migrateDepthTokens.js +3 -0
- package/dist/es6/v13.2/migrateOtherTokens.d.ts.map +1 -1
- package/dist/es6/v13.2/migrateOtherTokens.js +3 -0
- package/dist/es6/v13.2/migrateTypeTokens.d.ts.map +1 -1
- package/dist/es6/v13.2/migrateTypeTokens.js +3 -0
- package/dist/es6/v13.2/utils/transformObjectPropertyRecursively.d.ts.map +1 -1
- package/dist/es6/v13.2/utils/transformObjectPropertyRecursively.js +2 -0
- package/index.js +7 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAQlD,QAAA,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAQlD,QAAA,MAAM,SAAS,EAAE,SAuFhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -13,6 +13,9 @@ const transform = (file, api) => {
|
|
|
13
13
|
.forEach(nodePath => {
|
|
14
14
|
importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
|
|
15
15
|
});
|
|
16
|
+
if (!Object.values(importDeclaration).includes('colors')) {
|
|
17
|
+
return root.toSource();
|
|
18
|
+
}
|
|
16
19
|
root
|
|
17
20
|
.find(j.CallExpression, {
|
|
18
21
|
callee: {
|
|
@@ -20,7 +23,6 @@ const transform = (file, api) => {
|
|
|
20
23
|
},
|
|
21
24
|
})
|
|
22
25
|
.forEach(nodePath => {
|
|
23
|
-
addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
|
|
24
26
|
const name = nodePath.value.callee.name;
|
|
25
27
|
const stylesDeclaration = nodePath.value.arguments[0];
|
|
26
28
|
const isCanvasKitStyling = importDeclaration[name] === 'createStyles' || importDeclaration[name] === 'createStencil';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateDepthTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateDepthTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAOtC,QAAA,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"migrateDepthTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateDepthTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAOtC,QAAA,MAAM,SAAS,EAAE,SAoKhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -12,6 +12,9 @@ const transform = (file, api) => {
|
|
|
12
12
|
.forEach(nodePath => {
|
|
13
13
|
importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
|
|
14
14
|
});
|
|
15
|
+
if (!Object.values(importDeclaration).includes('depth')) {
|
|
16
|
+
return root.toSource();
|
|
17
|
+
}
|
|
15
18
|
root
|
|
16
19
|
.find(j.SpreadElement, {
|
|
17
20
|
argument: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateOtherTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateOtherTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AAQpE,QAAA,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"migrateOtherTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateOtherTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AAQpE,QAAA,MAAM,SAAS,EAAE,SA4KhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -13,6 +13,9 @@ const transform = (file, api) => {
|
|
|
13
13
|
.forEach(nodePath => {
|
|
14
14
|
importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
|
|
15
15
|
});
|
|
16
|
+
if (!Object.values(importDeclaration).some(value => value === 'space' || value === 'borderRadius')) {
|
|
17
|
+
return root.toSource();
|
|
18
|
+
}
|
|
16
19
|
root
|
|
17
20
|
.find(j.CallExpression, {
|
|
18
21
|
callee: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateTypeTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateTypeTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AASpE,QAAA,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"migrateTypeTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateTypeTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AASpE,QAAA,MAAM,SAAS,EAAE,SAiOhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -14,6 +14,9 @@ const transform = (file, api) => {
|
|
|
14
14
|
.forEach(nodePath => {
|
|
15
15
|
importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
|
|
16
16
|
});
|
|
17
|
+
if (!Object.values(importDeclaration).includes('type')) {
|
|
18
|
+
return root.toSource();
|
|
19
|
+
}
|
|
17
20
|
root
|
|
18
21
|
.find(j.SpreadElement, {
|
|
19
22
|
argument: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformObjectPropertyRecursively.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/utils/transformObjectPropertyRecursively.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kCAAkC,gBAClC,GAAG,YACJ,GAAG;;wBAEQ,OAAO,KAC3B,
|
|
1
|
+
{"version":3,"file":"transformObjectPropertyRecursively.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/utils/transformObjectPropertyRecursively.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kCAAkC,gBAClC,GAAG,YACJ,GAAG;;wBAEQ,OAAO,KAC3B,GAgJF,CAAC"}
|
|
@@ -17,6 +17,7 @@ export const transformObjectPropertyRecursively = ({ j, root }, property, import
|
|
|
17
17
|
if (!isCanvasKitStyling) {
|
|
18
18
|
addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
|
|
19
19
|
}
|
|
20
|
+
addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
|
|
20
21
|
return j.objectProperty(j.identifier(key), isCanvasKitStyling
|
|
21
22
|
? varToMemberExpression(j, colorToken)
|
|
22
23
|
: j.callExpression(j.identifier('cssVar'), [varToMemberExpression(j, colorToken)]));
|
|
@@ -35,6 +36,7 @@ export const transformObjectPropertyRecursively = ({ j, root }, property, import
|
|
|
35
36
|
const colorToken = tokens === null || tokens === void 0 ? void 0 : tokens[expr.property.name];
|
|
36
37
|
if (colorToken) {
|
|
37
38
|
addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
|
|
39
|
+
addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
|
|
38
40
|
return j.callExpression(j.identifier('cssVar'), [varToMemberExpression(j, colorToken)]);
|
|
39
41
|
}
|
|
40
42
|
}
|
package/index.js
CHANGED
|
@@ -88,6 +88,13 @@ const {
|
|
|
88
88
|
describe: chalk.gray('The path to execute the transform in (recursively).'),
|
|
89
89
|
});
|
|
90
90
|
})
|
|
91
|
+
.command('v13.2 [path]', chalk.gray('Canvas React Tokens > Canvas Tokens Web v2'), yargs => {
|
|
92
|
+
yargs.positional('path', {
|
|
93
|
+
type: 'string',
|
|
94
|
+
default: '.',
|
|
95
|
+
describe: chalk.gray('The path to execute the transform in (recursively).'),
|
|
96
|
+
});
|
|
97
|
+
})
|
|
91
98
|
.command('v14 [path]', chalk.gray('Canvas Kit v13 > v14 upgrade transform'), yargs => {
|
|
92
99
|
yargs.positional('path', {
|
|
93
100
|
type: 'string',
|
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.0.0-alpha.
|
|
5
|
+
"version": "14.0.0-alpha.1188-next.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,
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"resolutions": {
|
|
47
47
|
"recast": "0.20.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "01e7a4006fd0b21919589e074f091f9c3b353e39"
|
|
50
50
|
}
|