@atlaskit/codemod-cli 0.11.4 → 0.12.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/cli.js +72 -75
  3. package/dist/cjs/filepath.js +29 -83
  4. package/dist/cjs/index.js +3 -6
  5. package/dist/cjs/main.js +165 -441
  6. package/dist/cjs/presets/css-to-design-tokens/css-to-design-tokens.js +44 -135
  7. package/dist/cjs/presets/css-to-design-tokens/utils/legacy-colors.js +3 -4
  8. package/dist/cjs/presets/css-to-design-tokens/utils/meta.js +6 -29
  9. package/dist/cjs/presets/index.js +2 -9
  10. package/dist/cjs/presets/styled-to-emotion/styled-to-emotion.js +13 -25
  11. package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +34 -82
  12. package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +14 -41
  13. package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +0 -2
  14. package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +9 -28
  15. package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +44 -106
  16. package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +3 -3
  17. package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +1 -1
  18. package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +2 -22
  19. package/dist/cjs/sinceRef.js +36 -92
  20. package/dist/cjs/transforms.js +27 -72
  21. package/dist/cjs/types.js +2 -45
  22. package/dist/cjs/utils.js +7 -20
  23. package/dist/cjs/version.json +1 -1
  24. package/dist/es2019/filepath.js +7 -5
  25. package/dist/es2019/main.js +17 -51
  26. package/dist/es2019/presets/css-to-design-tokens/css-to-design-tokens.js +19 -51
  27. package/dist/es2019/presets/css-to-design-tokens/utils/legacy-colors.js +0 -1
  28. package/dist/es2019/presets/css-to-design-tokens/utils/meta.js +0 -6
  29. package/dist/es2019/presets/index.js +1 -1
  30. package/dist/es2019/presets/styled-to-emotion/styled-to-emotion.js +1 -4
  31. package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +4 -14
  32. package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +2 -11
  33. package/dist/es2019/presets/theme-to-design-tokens/utils/color.js +2 -7
  34. package/dist/es2019/presets/theme-to-design-tokens/utils/fuzzy-search.js +38 -95
  35. package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +0 -1
  36. package/dist/es2019/sinceRef.js +2 -11
  37. package/dist/es2019/transforms.js +3 -13
  38. package/dist/es2019/types.js +1 -0
  39. package/dist/es2019/utils.js +1 -12
  40. package/dist/es2019/version.json +1 -1
  41. package/dist/esm/cli.js +53 -57
  42. package/dist/esm/filepath.js +51 -63
  43. package/dist/esm/main.js +221 -322
  44. package/dist/esm/presets/css-to-design-tokens/css-to-design-tokens.js +33 -71
  45. package/dist/esm/presets/css-to-design-tokens/utils/legacy-colors.js +0 -1
  46. package/dist/esm/presets/css-to-design-tokens/utils/meta.js +0 -6
  47. package/dist/esm/presets/index.js +1 -1
  48. package/dist/esm/presets/styled-to-emotion/styled-to-emotion.js +1 -4
  49. package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +4 -15
  50. package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +2 -11
  51. package/dist/esm/presets/theme-to-design-tokens/utils/color.js +2 -7
  52. package/dist/esm/presets/theme-to-design-tokens/utils/fuzzy-search.js +38 -95
  53. package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +0 -1
  54. package/dist/esm/sinceRef.js +49 -65
  55. package/dist/esm/transforms.js +4 -14
  56. package/dist/esm/types.js +1 -11
  57. package/dist/esm/utils.js +1 -12
  58. package/dist/esm/version.json +1 -1
  59. package/package.json +2 -2
  60. package/tmp/api-report-tmp.d.ts +0 -66
@@ -3,77 +3,65 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { glob } from 'glob';
4
4
  import { promises } from 'fs';
5
5
  var readFile = promises.readFile;
6
- /** Return products packages filePaths for running codemods from specified dependent package */
7
6
 
7
+ /** Return products packages filePaths for running codemods from specified dependent package */
8
8
  export function findDependentPackagePaths(_x, _x2) {
9
9
  return _findDependentPackagePaths.apply(this, arguments);
10
10
  }
11
-
12
11
  function _findDependentPackagePaths() {
13
12
  _findDependentPackagePaths = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(crawlPaths, dependencyPackage) {
14
13
  var searchStrings, globString, packageJsonPaths, productPackageJsonPathPromises, productPackageJsonPaths, productPackagePaths;
15
14
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
16
- while (1) {
17
- switch (_context2.prev = _context2.next) {
18
- case 0:
19
- // Get file paths leading to package.jsons
20
- searchStrings = crawlPaths.map(function (crawlPath) {
21
- //Replace leading './' due to bug with node-glob not properly ignoring files https://github.com/isaacs/node-glob/issues/309
22
- return "".concat(crawlPath.replace(/^\.\//, ''), "/**/package.json");
23
- }); // Convert array into glob string
24
-
25
- globString = searchStrings.length > 1 ? "{".concat(searchStrings.join(','), "}") : searchStrings[0];
26
- packageJsonPaths = glob.sync(globString, {
27
- ignore: '**/node_modules/**',
28
- nodir: true
29
- });
30
- productPackageJsonPathPromises = packageJsonPaths.map( /*#__PURE__*/function () {
31
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filePath) {
32
- var fileContents, isMatch;
33
- return _regeneratorRuntime.wrap(function _callee$(_context) {
34
- while (1) {
35
- switch (_context.prev = _context.next) {
36
- case 0:
37
- fileContents = readFile(filePath, 'utf8'); // Grep for installedPackage
38
-
39
- _context.next = 3;
40
- return fileContents;
41
-
42
- case 3:
43
- isMatch = _context.sent.toString().split(/\n/).some(function (line) {
44
- return line.match(dependencyPackage);
45
- });
46
- return _context.abrupt("return", isMatch && filePath);
47
-
48
- case 5:
49
- case "end":
50
- return _context.stop();
51
- }
52
- }
53
- }, _callee);
54
- }));
55
-
56
- return function (_x3) {
57
- return _ref.apply(this, arguments);
58
- };
59
- }());
60
- _context2.next = 6;
61
- return Promise.all(productPackageJsonPathPromises);
62
-
63
- case 6:
64
- productPackageJsonPaths = _context2.sent.filter(function (path) {
65
- return path !== false;
66
- });
67
- // Get directory
68
- productPackagePaths = productPackageJsonPaths.map(function (line) {
69
- return line.replace('/package.json', '');
70
- });
71
- return _context2.abrupt("return", productPackagePaths);
72
-
73
- case 9:
74
- case "end":
75
- return _context2.stop();
76
- }
15
+ while (1) switch (_context2.prev = _context2.next) {
16
+ case 0:
17
+ // Get file paths leading to package.jsons
18
+ searchStrings = crawlPaths.map(function (crawlPath) {
19
+ //Replace leading './' due to bug with node-glob not properly ignoring files https://github.com/isaacs/node-glob/issues/309
20
+ return "".concat(crawlPath.replace(/^\.\//, ''), "/**/package.json");
21
+ }); // Convert array into glob string
22
+ globString = searchStrings.length > 1 ? "{".concat(searchStrings.join(','), "}") : searchStrings[0];
23
+ packageJsonPaths = glob.sync(globString, {
24
+ ignore: '**/node_modules/**',
25
+ nodir: true
26
+ });
27
+ productPackageJsonPathPromises = packageJsonPaths.map( /*#__PURE__*/function () {
28
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filePath) {
29
+ var fileContents, isMatch;
30
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
31
+ while (1) switch (_context.prev = _context.next) {
32
+ case 0:
33
+ fileContents = readFile(filePath, 'utf8'); // Grep for installedPackage
34
+ _context.next = 3;
35
+ return fileContents;
36
+ case 3:
37
+ isMatch = _context.sent.toString().split(/\n/).some(function (line) {
38
+ return line.match(dependencyPackage);
39
+ });
40
+ return _context.abrupt("return", isMatch && filePath);
41
+ case 5:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }, _callee);
46
+ }));
47
+ return function (_x3) {
48
+ return _ref.apply(this, arguments);
49
+ };
50
+ }());
51
+ _context2.next = 6;
52
+ return Promise.all(productPackageJsonPathPromises);
53
+ case 6:
54
+ productPackageJsonPaths = _context2.sent.filter(function (path) {
55
+ return path !== false;
56
+ });
57
+ // Get directory
58
+ productPackagePaths = productPackageJsonPaths.map(function (line) {
59
+ return line.replace('/package.json', '');
60
+ });
61
+ return _context2.abrupt("return", productPackagePaths);
62
+ case 9:
63
+ case "end":
64
+ return _context2.stop();
77
65
  }
78
66
  }, _callee2);
79
67
  }));