@atlaskit/codemod-cli 0.8.1 → 0.8.5

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 (55) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +12 -2
  3. package/dist/cjs/cli.js +1 -1
  4. package/dist/cjs/index.js +4 -4
  5. package/dist/cjs/main.js +6 -4
  6. package/dist/cjs/presets/index.js +4 -2
  7. package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +145 -0
  8. package/dist/cjs/presets/theme-to-design-tokens/types.js +5 -0
  9. package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +88 -0
  10. package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +19 -0
  11. package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +59 -0
  12. package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +348 -0
  13. package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +83 -0
  14. package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +8 -0
  15. package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +38 -0
  16. package/dist/cjs/transforms.js +1 -1
  17. package/dist/cjs/types.js +5 -3
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/cli.js +1 -1
  20. package/dist/es2019/main.js +3 -1
  21. package/dist/es2019/presets/index.js +2 -1
  22. package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +100 -0
  23. package/dist/es2019/presets/theme-to-design-tokens/types.js +1 -0
  24. package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +63 -0
  25. package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +10 -0
  26. package/dist/es2019/presets/theme-to-design-tokens/utils/color.js +35 -0
  27. package/dist/es2019/presets/theme-to-design-tokens/utils/fuzzy-search.js +336 -0
  28. package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +74 -0
  29. package/dist/es2019/presets/theme-to-design-tokens/utils/named-colors.js +1 -0
  30. package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +12 -0
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/cli.js +1 -1
  33. package/dist/esm/main.js +6 -4
  34. package/dist/esm/presets/index.js +3 -2
  35. package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +130 -0
  36. package/dist/esm/presets/theme-to-design-tokens/types.js +1 -0
  37. package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +75 -0
  38. package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +10 -0
  39. package/dist/esm/presets/theme-to-design-tokens/utils/color.js +39 -0
  40. package/dist/esm/presets/theme-to-design-tokens/utils/fuzzy-search.js +340 -0
  41. package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +74 -0
  42. package/dist/esm/presets/theme-to-design-tokens/utils/named-colors.js +1 -0
  43. package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +24 -0
  44. package/dist/esm/types.js +3 -2
  45. package/dist/esm/version.json +1 -1
  46. package/dist/types/presets/index.d.ts +1 -0
  47. package/dist/types/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +2 -0
  48. package/dist/types/presets/theme-to-design-tokens/utils/ast-meta.d.ts +3 -0
  49. package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +3 -0
  50. package/dist/types/presets/theme-to-design-tokens/utils/color.d.ts +4 -0
  51. package/dist/types/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +5 -0
  52. package/dist/types/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +3 -0
  53. package/dist/types/presets/theme-to-design-tokens/utils/named-colors.d.ts +1 -0
  54. package/dist/types/presets/theme-to-design-tokens/utils/tokens.d.ts +2 -0
  55. package/package.json +4 -3
@@ -0,0 +1,24 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import designTokens from '@atlaskit/tokens/token-names';
3
+ import renameMapping from '@atlaskit/tokens/rename-mapping';
4
+ export var tokens = Object.keys(designTokens).filter(function (t) {
5
+ return !t.includes('UNSAFE') && !t.includes('interaction');
6
+ }).filter(function (t) {
7
+ return !renameMapping.find(function (_ref) {
8
+ var path = _ref.path;
9
+ return t === path.replace(/\.[default]\g/, '');
10
+ });
11
+ });
12
+ export var getUniqueWordsFromTokens = Object.keys(designTokens).reduce(function (accum, val) {
13
+ return [].concat(_toConsumableArray(accum), _toConsumableArray(val.split('.')));
14
+ }, []).reduce(function (accum, val) {
15
+ return [].concat(_toConsumableArray(accum), _toConsumableArray(val.split(/(?=[A-Z])/g).map(function (e) {
16
+ return e.toLowerCase();
17
+ })));
18
+ }, []).reduce(function (accum, val) {
19
+ if (!accum.includes(val)) {
20
+ accum.push(val);
21
+ }
22
+
23
+ return accum;
24
+ }, []);
package/dist/esm/types.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _createClass from "@babel/runtime/helpers/createClass";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _inherits from "@babel/runtime/helpers/inherits";
3
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
@@ -22,7 +23,7 @@ export var ValidationError = /*#__PURE__*/function (_Error) {
22
23
  return _super.apply(this, arguments);
23
24
  }
24
25
 
25
- return ValidationError;
26
+ return _createClass(ValidationError);
26
27
  }( /*#__PURE__*/_wrapNativeSuper(Error));
27
28
  export var NoTransformsExistError = /*#__PURE__*/function (_Error2) {
28
29
  _inherits(NoTransformsExistError, _Error2);
@@ -35,5 +36,5 @@ export var NoTransformsExistError = /*#__PURE__*/function (_Error2) {
35
36
  return _super2.apply(this, arguments);
36
37
  }
37
38
 
38
- return NoTransformsExistError;
39
+ return _createClass(NoTransformsExistError);
39
40
  }( /*#__PURE__*/_wrapNativeSuper(Error));
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.8.1"
3
+ "version": "0.8.5"
4
4
  }
@@ -3,5 +3,6 @@
3
3
  * in the final bundle
4
4
  */
5
5
  import './styled-to-emotion/styled-to-emotion';
6
+ import './theme-to-design-tokens/theme-to-design-tokens';
6
7
  declare const presets: string[];
7
8
  export default presets;
@@ -0,0 +1,2 @@
1
+ import { API, FileInfo } from 'jscodeshift';
2
+ export default function transformer(file: FileInfo, api: API, debug?: boolean): string;
@@ -0,0 +1,3 @@
1
+ import core from 'jscodeshift';
2
+ export declare function getMetaFromAncestors(j: core.JSCodeshift, path: any, meta?: string[]): string[];
3
+ export declare function cleanMeta(meta: string[]): string[];
@@ -0,0 +1,3 @@
1
+ import core from 'jscodeshift';
2
+ export declare function isDecendantOfToken(j: core.JSCodeshift, path: any): boolean;
3
+ export declare function isDecendantOfType(j: core.JSCodeshift, path: any, type: any): boolean;
@@ -0,0 +1,4 @@
1
+ export declare const isLegacyColor: (value: string) => boolean;
2
+ export declare const isLegacyNamedColor: (value: string) => boolean;
3
+ export declare const includesHardCodedColor: (raw: string) => boolean;
4
+ export declare const isHardCodedColor: (value: string) => boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Fuzzy search ripped from the internet.
3
+ */
4
+ declare const FuzzySet: (arr?: string[], useLevenshtein?: boolean | undefined, gramSizeLower?: number, gramSizeUpper?: number) => any;
5
+ export default FuzzySet;
@@ -0,0 +1,3 @@
1
+ export declare const legacyColors: string[];
2
+ export declare const legacyColorMixins: string[];
3
+ export declare const legacyColorMetaMap: Record<string, string[]>;
@@ -0,0 +1 @@
1
+ export declare const namedColors: string[];
@@ -0,0 +1,2 @@
1
+ export declare const tokens: string[];
2
+ export declare const getUniqueWordsFromTokens: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.5",
4
4
  "description": "A cli for distributing codemods for atlassian-frontend components and services",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -17,13 +17,14 @@
17
17
  "releaseModel": "continuous"
18
18
  },
19
19
  "scripts": {
20
- "prestart": "cd ../../ && bolt build @atlaskit/codemod-utils",
20
+ "prestart": "cd ../../ && yarn build @atlaskit/codemod-utils",
21
21
  "start": "./bin/codemod-cli.js"
22
22
  },
23
23
  "bin": {
24
24
  "codemod-cli": "./bin/codemod-cli.js"
25
25
  },
26
26
  "dependencies": {
27
+ "@atlaskit/tokens": "^0.6.0",
27
28
  "@babel/runtime": "^7.0.0",
28
29
  "@types/chalk": "^2.2.0",
29
30
  "@types/jscodeshift": "^0.11.0",
@@ -31,7 +32,7 @@
31
32
  "enquirer": "^2.3.4",
32
33
  "glob": "^7.1.2",
33
34
  "jscodeshift": "^0.13.0",
34
- "meow": "^6.0.0",
35
+ "meow": "^8.1.1",
35
36
  "projector-spawn": "^1.0.1",
36
37
  "semver": "^7.3.0",
37
38
  "simple-git": "^1.130.0"