@atlaskit/codemod-cli 0.11.5 → 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 (31) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/cli.js +75 -68
  3. package/dist/cjs/filepath.js +29 -69
  4. package/dist/cjs/index.js +3 -3
  5. package/dist/cjs/main.js +167 -337
  6. package/dist/cjs/presets/css-to-design-tokens/css-to-design-tokens.js +31 -73
  7. package/dist/cjs/presets/css-to-design-tokens/utils/legacy-colors.js +3 -3
  8. package/dist/cjs/presets/css-to-design-tokens/utils/meta.js +6 -19
  9. package/dist/cjs/presets/index.js +1 -3
  10. package/dist/cjs/presets/styled-to-emotion/styled-to-emotion.js +12 -19
  11. package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +32 -61
  12. package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +13 -26
  13. package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +7 -11
  14. package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +6 -10
  15. package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +3 -3
  16. package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +1 -1
  17. package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +2 -16
  18. package/dist/cjs/sinceRef.js +35 -70
  19. package/dist/cjs/transforms.js +26 -44
  20. package/dist/cjs/types.js +3 -27
  21. package/dist/cjs/utils.js +6 -6
  22. package/dist/cjs/version.json +1 -1
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/cli.js +53 -55
  25. package/dist/esm/filepath.js +50 -54
  26. package/dist/esm/main.js +220 -230
  27. package/dist/esm/presets/css-to-design-tokens/css-to-design-tokens.js +11 -13
  28. package/dist/esm/sinceRef.js +48 -50
  29. package/dist/esm/version.json +1 -1
  30. package/package.json +2 -2
  31. package/tmp/api-report-tmp.d.ts +0 -66
@@ -160,19 +160,17 @@ export default function transformer(_x) {
160
160
  function _transformer() {
161
161
  _transformer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
162
162
  return _regeneratorRuntime.wrap(function _callee$(_context) {
163
- while (1) {
164
- switch (_context.prev = _context.next) {
165
- case 0:
166
- _context.next = 2;
167
- return postcss([plugin()]).process(file.source, {
168
- syntax: lessSyntax
169
- }).css;
170
- case 2:
171
- return _context.abrupt("return", _context.sent);
172
- case 3:
173
- case "end":
174
- return _context.stop();
175
- }
163
+ while (1) switch (_context.prev = _context.next) {
164
+ case 0:
165
+ _context.next = 2;
166
+ return postcss([plugin()]).process(file.source, {
167
+ syntax: lessSyntax
168
+ }).css;
169
+ case 2:
170
+ return _context.abrupt("return", _context.sent);
171
+ case 3:
172
+ case "end":
173
+ return _context.stop();
176
174
  }
177
175
  }, _callee);
178
176
  }));
@@ -23,56 +23,54 @@ export var getPackagesSinceRef = /*#__PURE__*/function () {
23
23
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ref) {
24
24
  var git, commit, diff, modifiedPackages, addedPackages, upgradedPackages;
25
25
  return _regeneratorRuntime.wrap(function _callee$(_context) {
26
- while (1) {
27
- switch (_context.prev = _context.next) {
28
- case 0:
29
- git = simpleGit();
30
- _context.prev = 1;
31
- _context.next = 4;
32
- return git.revparse(['--verify', ref]);
33
- case 4:
34
- commit = _context.sent;
35
- _context.next = 10;
36
- break;
37
- case 7:
38
- _context.prev = 7;
39
- _context.t0 = _context["catch"](1);
40
- throw new ValidationError("Invalid git ref \"".concat(ref, "\""));
41
- case 10:
42
- _context.next = 12;
43
- return git.diff([commit, '--', 'package.json']);
44
- case 12:
45
- diff = _context.sent;
46
- modifiedPackages = diff.split('\n').map(parseDiffLine).filter(function (pkg) {
47
- return Boolean(pkg);
48
- });
49
- addedPackages = new Map(modifiedPackages.filter(function (pkg) {
50
- return pkg.type === 'added';
51
- }).map(function (pkg) {
52
- return [pkg.name, pkg];
53
- }));
54
- /* This is holds the previous version of packages that have been upgraded. Packages are treated as
55
- * upgraded if they have both an addition/deletion entry in the diff and their versions differ
56
- */
57
- upgradedPackages = modifiedPackages.filter(function (pkg) {
58
- var addedEntry = addedPackages.get(pkg.name);
59
- if (pkg.type !== 'deleted' || !addedEntry) {
60
- return false;
61
- }
62
- return pkg.version !== addedEntry.version;
63
- }).map(function (_ref2) {
64
- var name = _ref2.name,
65
- version = _ref2.version;
66
- return {
67
- name: name,
68
- version: version
69
- };
70
- });
71
- return _context.abrupt("return", upgradedPackages);
72
- case 17:
73
- case "end":
74
- return _context.stop();
75
- }
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ git = simpleGit();
29
+ _context.prev = 1;
30
+ _context.next = 4;
31
+ return git.revparse(['--verify', ref]);
32
+ case 4:
33
+ commit = _context.sent;
34
+ _context.next = 10;
35
+ break;
36
+ case 7:
37
+ _context.prev = 7;
38
+ _context.t0 = _context["catch"](1);
39
+ throw new ValidationError("Invalid git ref \"".concat(ref, "\""));
40
+ case 10:
41
+ _context.next = 12;
42
+ return git.diff([commit, '--', 'package.json']);
43
+ case 12:
44
+ diff = _context.sent;
45
+ modifiedPackages = diff.split('\n').map(parseDiffLine).filter(function (pkg) {
46
+ return Boolean(pkg);
47
+ });
48
+ addedPackages = new Map(modifiedPackages.filter(function (pkg) {
49
+ return pkg.type === 'added';
50
+ }).map(function (pkg) {
51
+ return [pkg.name, pkg];
52
+ }));
53
+ /* This is holds the previous version of packages that have been upgraded. Packages are treated as
54
+ * upgraded if they have both an addition/deletion entry in the diff and their versions differ
55
+ */
56
+ upgradedPackages = modifiedPackages.filter(function (pkg) {
57
+ var addedEntry = addedPackages.get(pkg.name);
58
+ if (pkg.type !== 'deleted' || !addedEntry) {
59
+ return false;
60
+ }
61
+ return pkg.version !== addedEntry.version;
62
+ }).map(function (_ref2) {
63
+ var name = _ref2.name,
64
+ version = _ref2.version;
65
+ return {
66
+ name: name,
67
+ version: version
68
+ };
69
+ });
70
+ return _context.abrupt("return", upgradedPackages);
71
+ case 17:
72
+ case "end":
73
+ return _context.stop();
76
74
  }
77
75
  }, _callee, null, [[1, 7]]);
78
76
  }));
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.11.5"
3
+ "version": "0.12.0"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.11.5",
3
+ "version": "0.12.0",
4
4
  "description": "A cli for distributing codemods for atlassian-frontend components and services",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,7 +24,7 @@
24
24
  "codemod-cli": "./bin/codemod-cli.js"
25
25
  },
26
26
  "dependencies": {
27
- "@atlaskit/tokens": "^1.0.0",
27
+ "@atlaskit/tokens": "^1.3.0",
28
28
  "@babel/runtime": "^7.0.0",
29
29
  "@types/jscodeshift": "^0.11.0",
30
30
  "chalk": "^4.1.2",
@@ -1,66 +0,0 @@
1
- ## API Report File for "@atlaskit/codemod-cli"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- // @public (undocumented)
8
- type CliFlags = {
9
- transform?: string;
10
- preset?: string;
11
- packages?: string;
12
- parser: 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx';
13
- extensions: string;
14
- ignorePattern: string;
15
- sinceRef?: string;
16
- failOnError?: boolean;
17
- filterPaths?: boolean;
18
- };
19
-
20
- // @public
21
- type Default<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
22
-
23
- // @public (undocumented)
24
- const defaultFlags: {
25
- parser: "babel";
26
- extensions: string;
27
- ignorePattern: string;
28
- logger: Console;
29
- };
30
-
31
- // @public (undocumented)
32
- type Flags_2 = CliFlags & {
33
- logger: {
34
- log: (...args: any) => void;
35
- warn: (...args: any) => void;
36
- };
37
- };
38
- export { Flags_2 as Flags }
39
-
40
- // @public (undocumented)
41
- function main(input: string[], userFlags: UserFlags): Promise<{
42
- transforms: {
43
- module: string;
44
- root: string;
45
- dir: string;
46
- base: string;
47
- ext: string;
48
- name: string;
49
- }[];
50
- }>;
51
- export default main;
52
-
53
- // @public (undocumented)
54
- export class NoTransformsExistError extends Error {
55
- }
56
-
57
- // @public (undocumented)
58
- export type UserFlags = Default<Flags_2, keyof typeof defaultFlags>;
59
-
60
- // @public (undocumented)
61
- export class ValidationError extends Error {
62
- }
63
-
64
- // (No @packageDocumentation comment for this package)
65
-
66
- ```