@workday/canvas-kit-codemod 9.0.0-alpha.293-next.1 → 9.0.0-alpha.301-next.2
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":"softDeprecateLayout.d.ts","sourceRoot":"","sources":["../../../lib/v8/softDeprecateLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAiC,OAAO,EAAC,MAAM,aAAa,CAAC;AAMlF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"softDeprecateLayout.d.ts","sourceRoot":"","sources":["../../../lib/v8/softDeprecateLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAiC,OAAO,EAAC,MAAM,aAAa,CAAC;AAMlF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAkF7E"}
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
var mainPackage = '@workday/canvas-kit-react';
|
|
2
|
-
var layoutPackage = '@workday/canvas-kit-react/layout';
|
|
3
2
|
var allImportNames = ['Layout', 'LayoutProps', 'Column', 'ColumnProps'];
|
|
3
|
+
var importPackages = [mainPackage, mainPackage + "/layout"];
|
|
4
4
|
export default function transformer(file, api, options) {
|
|
5
5
|
var j = api.jscodeshift;
|
|
6
6
|
var root = j(file.source);
|
|
7
7
|
var hasLayoutImports = false;
|
|
8
8
|
// This toggles the failsafe that prevents us from accidentally transforming something unintentionally.
|
|
9
9
|
root.find(j.ImportDeclaration, function (nodePath) {
|
|
10
|
-
var
|
|
11
|
-
// If there's an import from the layout package
|
|
12
|
-
if
|
|
13
|
-
hasLayoutImports = true;
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
// If there's an import from the main package, check to see if Layout or LayoutProps are among the named imports
|
|
10
|
+
var _a;
|
|
11
|
+
// If there's an import from the layout package or an import from the main package,
|
|
12
|
+
// check to see if Layout or LayoutProps are among the named imports
|
|
17
13
|
// e.g. import {Layout} from '@workday/canvas-kit-react';
|
|
18
|
-
if (value
|
|
19
|
-
(nodePath.specifiers ||
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
hasLayoutImports = true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
14
|
+
if (importPackages.includes(nodePath.source.value)) {
|
|
15
|
+
(_a = nodePath.specifiers) === null || _a === void 0 ? void 0 : _a.forEach(function (specifier) {
|
|
16
|
+
hasLayoutImports =
|
|
17
|
+
specifier.type === 'ImportSpecifier' && allImportNames.includes(specifier.imported.name);
|
|
25
18
|
});
|
|
26
19
|
}
|
|
27
20
|
return false;
|
|
@@ -37,11 +30,10 @@ export default function transformer(file, api, options) {
|
|
|
37
30
|
.forEach(function (nodePath) {
|
|
38
31
|
var _a;
|
|
39
32
|
(_a = nodePath.value.specifiers) === null || _a === void 0 ? void 0 : _a.forEach(function (specifier) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
33
|
+
// Adds Deprecated part to a import name for Layout, LayoutProps, Column, ColumnProps
|
|
34
|
+
if (specifier.type === 'ImportSpecifier' &&
|
|
35
|
+
allImportNames.includes(specifier.imported.name)) {
|
|
36
|
+
specifier.imported.name = "Deprecated" + specifier.imported.name;
|
|
45
37
|
}
|
|
46
38
|
return specifier;
|
|
47
39
|
});
|
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": "9.0.0-alpha.
|
|
5
|
+
"version": "9.0.0-alpha.301-next.2+7e1d9559",
|
|
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": "7e1d955981a61462e437ad3e68f916b133facf37"
|
|
47
47
|
}
|