@atlaskit/codemod-cli 0.13.0 → 0.13.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +178 -50
  3. package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +11 -5
  4. package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +21 -3
  5. package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +36 -20
  6. package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +1 -1
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +178 -50
  9. package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +11 -5
  10. package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +19 -2
  11. package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +36 -20
  12. package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +1 -1
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/main.js +1 -1
  15. package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +194 -75
  16. package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +10 -2
  17. package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +19 -2
  18. package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +36 -20
  19. package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +1 -1
  20. package/dist/esm/version.json +1 -1
  21. package/dist/types/main.d.ts +1 -0
  22. package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +4 -3
  23. package/dist/types-ts4.5/main.d.ts +1 -0
  24. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast.d.ts +4 -3
  25. package/package.json +2 -3
  26. package/report.api.md +2 -0
  27. package/tmp/api-report-tmp.d.ts +2 -0
@@ -1,26 +1,21 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  /* eslint-disable no-console */
3
3
 
4
- import { isDecendantOfToken, isDecendantOfType } from './utils/ast';
4
+ import { isDecendantOfType, hasImportDeclaration } from '@codeshift/utils';
5
+ import { isDecendantOfToken, isParentOfToken } from './utils/ast';
5
6
  import { cleanMeta, getMetaFromAncestors } from './utils/ast-meta';
6
7
  import { includesHardCodedColor, isHardCodedColor, isLegacyColor, isLegacyNamedColor } from './utils/color';
7
8
  import Search from './utils/fuzzy-search';
8
9
  import { legacyColorMetaMap } from './utils/legacy-colors';
9
10
  import { tokens } from './utils/tokens';
10
- var search = Search(tokens, false);
11
- function hasImportDeclaration(j, source, sourcePath) {
12
- return !!source.find(j.ImportDeclaration).filter(function (path) {
13
- return path.node.source.value === sourcePath;
14
- }).length;
15
- }
16
- function hasImportSpecifier(j, source, specifier, sourcePath) {
17
- return !!source.find(j.ImportDeclaration).filter(function (path) {
18
- return path.node.source.value === sourcePath;
19
- }).find(j.ImportSpecifier, {
20
- local: {
21
- name: specifier
22
- }
23
- }).length;
11
+ var kebabize = function kebabize(str) {
12
+ return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, function ($, ofs) {
13
+ return (ofs ? '-' : '') + $.toLowerCase();
14
+ });
15
+ };
16
+ function isBoldColor(color) {
17
+ var number = parseInt(color.replace(/^./, ''), 10);
18
+ return number > 300;
24
19
  }
25
20
  function insertTokenImport(j, source) {
26
21
  if (hasImportDeclaration(j, source, '@atlaskit/tokens')) {
@@ -33,10 +28,106 @@ function buildToken(j, tokenId, node) {
33
28
  var callExpr = j.callExpression(j.identifier('token'), [j.stringLiteral(tokenId), node].filter(Boolean));
34
29
  return callExpr;
35
30
  }
36
- function getTokenFromNode(j, path) {
37
- var baseMeta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
38
- var foundMeta = getMetaFromAncestors(j, path);
39
- var meta = cleanMeta([].concat(_toConsumableArray(foundMeta), _toConsumableArray(baseMeta)));
31
+ function getColorFromIdentifier(expression) {
32
+ var value = '';
33
+ if (expression.type === 'Identifier') {
34
+ value = expression.name;
35
+ }
36
+ if (expression.type === 'StringLiteral') {
37
+ value = expression.value;
38
+ }
39
+ if (expression.type === 'MemberExpression' && expression.object.name === 'colors' && isLegacyColor(expression.property.name)) {
40
+ value = expression.property.name;
41
+ }
42
+ return value;
43
+ }
44
+ function getTokenFromNode(j, path, value, propertyName) {
45
+ var valueMeta = cleanMeta(legacyColorMetaMap[value] || []);
46
+ var ancestorMeta = cleanMeta([].concat(_toConsumableArray(getMetaFromAncestors(j, path)), _toConsumableArray(kebabize(propertyName).split('-'))) || []);
47
+ var property = cleanMeta([kebabize(propertyName)])[0];
48
+
49
+ // Attempt to find a property from ancestors if one is not found
50
+ if (!property || !['border', 'icon', 'background', 'text'].includes(property)) {
51
+ if (ancestorMeta.includes('border')) {
52
+ property = 'border';
53
+ }
54
+ if (ancestorMeta.includes('icon')) {
55
+ property = 'icon';
56
+ }
57
+ if (ancestorMeta.includes('background')) {
58
+ property = 'background';
59
+ }
60
+ if (ancestorMeta.includes('color')) {
61
+ property = 'text';
62
+ }
63
+ }
64
+ var meta = [];
65
+ var possibleTokens = tokens;
66
+ if (property === 'text') {
67
+ possibleTokens = tokens.filter(function (token) {
68
+ return token.includes('.text');
69
+ });
70
+ if (valueMeta.includes('neutral')) {
71
+ meta.push('color', 'text');
72
+ }
73
+ if (valueMeta.includes('neutral') && (value === 'N400' || value === 'N500')) {
74
+ meta.push('color', 'text', 'subtle');
75
+ }
76
+ if (valueMeta.includes('neutral') && (value === 'N80' || value === 'N100' || value === 'N200' || value === 'N300' || value === 'N400')) {
77
+ meta.push('color', 'text', 'subtlest');
78
+ }
79
+
80
+ // handle non-neutrals
81
+ if (!valueMeta.includes('neutral')) {
82
+ meta.push.apply(meta, ['color'].concat(_toConsumableArray(ancestorMeta), _toConsumableArray(valueMeta)));
83
+ }
84
+ }
85
+ if (property === 'background' || property === 'background-color') {
86
+ if (ancestorMeta.includes('disabled')) {
87
+ // disabled backgrounds
88
+ meta.push.apply(meta, [property].concat(_toConsumableArray(ancestorMeta)));
89
+ } else if (
90
+ // Surfaces
91
+ valueMeta.includes('neutral') && value !== 'N100' && value !== 'N200' && value !== 'N300' && value !== 'N400' && value !== 'N500' && value !== 'N600' && value !== 'N700' && value !== 'N800') {
92
+ meta.push.apply(meta, ['surface'].concat(_toConsumableArray(ancestorMeta)));
93
+ } else if (value.includes('N0')) {
94
+ // default surface
95
+ meta.push('elevation', 'surface');
96
+ } else if (valueMeta.includes('neutral') && isBoldColor(value)) {
97
+ // bold netural backgrounds
98
+ meta.push('background', 'neutral', 'bold');
99
+ } else if (valueMeta.includes('neutral')) {
100
+ // netural backgrounds
101
+ meta.push('background', 'neutral');
102
+ }
103
+ }
104
+ if (property === 'border' || property === 'border-color' || property === 'border-left' || property === 'border-right' || property === 'border-top' || property === 'border-bottom' || property === 'outline' || property === 'outline-color') {
105
+ possibleTokens = tokens.filter(function (token) {
106
+ return token.includes('.border') || token.includes('.focus');
107
+ });
108
+ if (valueMeta.includes('neutral')) {
109
+ // standard netural boarder
110
+ meta.push.apply(meta, ['color', 'border'].concat(_toConsumableArray(ancestorMeta)));
111
+ } else {
112
+ meta.push.apply(meta, ['border'].concat(_toConsumableArray(valueMeta), _toConsumableArray(ancestorMeta)));
113
+ }
114
+ }
115
+ if (ancestorMeta.includes('icon')) {
116
+ possibleTokens = tokens.filter(function (token) {
117
+ return token.includes('.icon');
118
+ });
119
+ if (ancestorMeta.includes('disabled')) {
120
+ // disabled backgrounds
121
+ meta.push('disabled');
122
+ }
123
+ meta.push.apply(meta, ['color', 'icon'].concat(_toConsumableArray(valueMeta)));
124
+ }
125
+
126
+ // Fallback if guided behavior yields nothing
127
+ if (meta.length === 0) {
128
+ meta.push.apply(meta, [property].concat(_toConsumableArray(valueMeta), _toConsumableArray(ancestorMeta)));
129
+ }
130
+ var search = Search(possibleTokens, false);
40
131
  var results = search.get(meta.join(' '));
41
132
  var tokenId = ['MISSING_TOKEN'];
42
133
  if (results) {
@@ -46,74 +137,102 @@ function getTokenFromNode(j, path) {
46
137
  }
47
138
  return tokenId[0];
48
139
  }
140
+ function parseCSSPropertyName(cssString) {
141
+ var lastColonIndex = cssString.lastIndexOf(':');
142
+ var propertyNameEndIndex = Math.max(cssString.lastIndexOf(';', lastColonIndex), cssString.lastIndexOf(' ', lastColonIndex));
143
+ return cssString.slice(propertyNameEndIndex + 1, lastColonIndex).trim();
144
+ }
49
145
  export default function transformer(file, api) {
50
146
  var debug = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
51
147
  var j = api.jscodeshift;
52
148
  var source = j(file.source);
53
149
  var transformed = false;
54
- source
55
- // Handle colors.N100
56
- .find(j.MemberExpression).filter(function (path) {
57
- return path.value.object.type === 'Identifier' && path.value.object.name === 'colors' && path.value.property.type === 'Identifier' && isLegacyColor(path.value.property.name);
58
- }).filter(function (path) {
59
- return !isDecendantOfToken(j, path);
60
- }).forEach(function (path) {
61
- debug && console.log('file:', file.path);
62
- insertTokenImport(j, source);
63
- var key = path.value.property.type === 'Identifier' ? path.value.property.name : undefined;
64
- var colorMeta = legacyColorMetaMap[key] || [];
65
- var tokenId = getTokenFromNode(j, path, colorMeta);
66
- j(path).replaceWith(buildToken(j, tokenId, path.value));
67
- transformed = true;
68
- });
69
- source.find(j.ObjectProperty).filter(function (path) {
70
- return path.value.value.type === 'Identifier' && (isLegacyColor(path.value.value.name) || isLegacyNamedColor(path.value.value.name));
71
- }).filter(function (path) {
72
- return hasImportSpecifier(j, source, path.value.value.type === 'Identifier' ? path.value.value.name : '', '@atlaskit/theme') || hasImportSpecifier(j, source, path.value.value.type === 'Identifier' ? path.value.value.name : '', '@atlaskit/theme/colors');
73
- }).filter(function (path) {
74
- return !isDecendantOfToken(j, path.value.value);
75
- }).forEach(function (path) {
76
- var valuePath = path.get('value');
77
- debug && console.log('file:', file.path);
150
+
151
+ // Objects
152
+ source.find(j.ObjectProperty).forEach(function (path) {
153
+ if (path.value.value.type === 'ObjectExpression') {
154
+ return;
155
+ }
156
+
157
+ // Avoid transforming objects that are default arguments
158
+ if (path.parent.parent.value.type === 'ArrowFunctionExpression' || path.parent.parent.value.type === 'FunctionDeclaration') {
159
+ return;
160
+ }
161
+ if (isParentOfToken(j, path.value.value)) {
162
+ return;
163
+ }
164
+ var value = getColorFromIdentifier(path.value.value);
165
+ if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
166
+ return;
167
+ }
168
+ var key;
169
+ if (path.value.key.type === 'NumericLiteral' || path.value.key.type === 'StringLiteral') {
170
+ key = path.value.key.value.toString();
171
+ }
172
+ if (path.value.key.type === 'Identifier') {
173
+ key = path.value.key.name;
174
+ }
175
+
176
+ // Key is a node type we do not support
177
+ if (!key) {
178
+ return;
179
+ }
180
+ var tokenId = getTokenFromNode(j, path, value, key);
78
181
  insertTokenImport(j, source);
79
- var colorMeta = legacyColorMetaMap[valuePath.name] || [];
80
- var tokenId = getTokenFromNode(j, valuePath, colorMeta);
81
- j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, valuePath.value)));
182
+ j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, path.value.value)));
82
183
  transformed = true;
83
184
  });
84
- source.find(j.Identifier).filter(function (path) {
85
- return isLegacyColor(path.value.name) || isLegacyNamedColor(path.value.name);
86
- }).filter(function (path) {
87
- return hasImportSpecifier(j, source, path.value.name, '@atlaskit/theme') || hasImportSpecifier(j, source, path.value.name, '@atlaskit/theme/colors');
88
- }).filter(function (path) {
89
- return !['ImportSpecifier', 'MemberExpression', 'ObjectProperty'].includes(path.parentPath.value.type);
90
- }).filter(function (path) {
91
- return !isDecendantOfToken(j, path);
92
- }).forEach(function (path) {
93
- debug && console.log('file:', file.path);
94
- insertTokenImport(j, source);
95
- var colorMeta = legacyColorMetaMap[path.value.name] || [];
96
- var tokenId = getTokenFromNode(j, path, colorMeta);
97
- j(path).replaceWith(buildToken(j, tokenId, path.value));
185
+
186
+ // Template literals
187
+ source.find(j.TemplateLiteral).forEach(function (path) {
188
+ function replaceTemplateLiteralExpressions(j, expression, index) {
189
+ if (isDecendantOfToken(j, expression)) {
190
+ return;
191
+ }
192
+ if (index >= path.value.quasis.length) {
193
+ return;
194
+ }
195
+ var quasi = path.value.quasis[index];
196
+ var value = getColorFromIdentifier(expression.value);
197
+ if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
198
+ return;
199
+ }
200
+ var tokenId = getTokenFromNode(j, expression, value, parseCSSPropertyName(quasi.value.cooked || ''));
201
+ insertTokenImport(j, source);
202
+ expression.replace(buildToken(j, tokenId, expression.value));
203
+ }
204
+ j(path).find(j.Identifier).filter(function (expression) {
205
+ return !isDecendantOfType(j, expression, j.MemberExpression);
206
+ }).forEach(function (expression, i) {
207
+ return replaceTemplateLiteralExpressions(j, expression, i);
208
+ });
209
+ j(path).find(j.MemberExpression).forEach(function (expression, i) {
210
+ return replaceTemplateLiteralExpressions(j, expression, i);
211
+ });
98
212
  transformed = true;
99
213
  });
100
- source.find(j.Literal).filter(function (path) {
101
- return typeof path.value.value === 'string' && (includesHardCodedColor(path.value.value) || isHardCodedColor(path.value.value));
102
- }).filter(function (path) {
103
- return !isDecendantOfToken(j, path);
104
- }).forEach(function (path) {
214
+
215
+ // JSX props
216
+ source.find(j.JSXAttribute).forEach(function (path) {
105
217
  var _path$value, _path$value$value;
106
- debug && console.log('file:', file.path);
218
+ if (((_path$value = path.value) === null || _path$value === void 0 ? void 0 : (_path$value$value = _path$value.value) === null || _path$value$value === void 0 ? void 0 : _path$value$value.type) !== 'JSXExpressionContainer') {
219
+ return;
220
+ }
221
+ if (isParentOfToken(j, path)) {
222
+ return;
223
+ }
224
+ var expression = path.value.value.expression;
225
+ var value = getColorFromIdentifier(expression);
226
+ if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
227
+ return;
228
+ }
229
+ var tokenId = getTokenFromNode(j, path, value, path.value.name.name);
107
230
  insertTokenImport(j, source);
108
- var value = path === null || path === void 0 ? void 0 : (_path$value = path.value) === null || _path$value === void 0 ? void 0 : (_path$value$value = _path$value.value) === null || _path$value$value === void 0 ? void 0 : _path$value$value.toString();
109
- var colorMeta = legacyColorMetaMap[value] || [];
110
- var tokenId = getTokenFromNode(j, path, colorMeta);
111
- var tokenNode = buildToken(j, tokenId, path.value);
112
- j(path).replaceWith(isDecendantOfType(j, path, j.JSXAttribute) ? j.jsxExpressionContainer(tokenNode) : tokenNode);
231
+ j(path).find(j.JSXExpressionContainer).forEach(function (path) {
232
+ var tokenNode = buildToken(j, tokenId, path.value.expression);
233
+ j(path).replaceWith(j.jsxExpressionContainer(tokenNode));
234
+ });
113
235
  transformed = true;
114
236
  });
115
- if (transformed) {
116
- return source.toSource();
117
- }
118
- return file.source;
237
+ return transformed ? source.toSource() : file.source;
119
238
  }
@@ -1,4 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { getClosestDecendantOfType } from './ast';
2
3
  import { getUniqueWordsFromTokens } from './tokens';
3
4
  export function getMetaFromAncestors(j, path) {
4
5
  var meta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
@@ -35,10 +36,16 @@ export function getMetaFromAncestors(j, path) {
35
36
  meta.push(propertyName);
36
37
  }
37
38
  if (parent && parent.value.type === 'JSXAttribute') {
38
- if (!['css', 'styles', 'style'].includes(parent.value.name.name)) {
39
+ if (!['css', 'styles', 'style', 'fill', 'stopColor', 'startColor'].includes(parent.value.name.name)) {
39
40
  meta.push(parent.value.name.name);
40
41
  }
41
42
  }
43
+ var closestJSXElement = getClosestDecendantOfType(j, path, j.JSXOpeningElement);
44
+ if (closestJSXElement) {
45
+ var jsxElementName = closestJSXElement.value.name.name;
46
+ var nameComponents = jsxElementName.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
47
+ meta.push.apply(meta, _toConsumableArray(nameComponents));
48
+ }
42
49
  if (parent && parent.value.type === 'VariableDeclarator') {
43
50
  meta.push(parent.value.id.name);
44
51
  }
@@ -53,7 +60,8 @@ export function cleanMeta(meta) {
53
60
  return e.toLowerCase();
54
61
  }) : []));
55
62
  }, []).reduce(function (accum, val) {
56
- accum.push(val.replace(/:/g, '').replace(/,/g, '').replace('grey', 'neutral').replace('skeleton', 'neutral').replace('texts', 'text').replace('red', 'danger').replace('error', 'danger').replace('invalid', 'danger').replace('removed', 'danger').replace('removal', 'danger').replace('remove', 'danger').replace('focus', 'focused').replace('valid', 'success').replace('successful', 'success').replace('risk', 'warning').replace('caution', 'warning').replace('warn', 'warning').replace('primary', 'bold').replace('info', 'bold').replace('secondary', 'subtle').replace('hyperlink', 'link').replace('anchor', 'link').replace('active', 'pressed').replace('hover', 'hovered').replace('dragged', 'overlay').replace('dragging', 'overlay').replace('drag', 'overlay').replace('background-color', 'background').replace('color', 'text').replace('icons', 'icon').replace('glyph', 'icon').replace('stroke', 'border').replace('border-left', 'border').replace('border-right', 'border').replace('border-top', 'border').replace('border-bottom', 'border').replace('box-shadow', 'shadow'));
63
+ var cleanVal = val.replace(/:/g, '').replace(/,/g, '').replace('grey', 'neutral').replace('skeleton', 'neutral').replace('texts', 'text').replace('red', 'danger').replace('error', 'danger').replace('invalid', 'danger').replace('removed', 'danger').replace('removal', 'danger').replace('remove', 'danger').replace('focus', 'focused').replace('valid', 'success').replace('successful', 'success').replace('risk', 'warning').replace('caution', 'warning').replace('primary', 'bold').replace('secondary', 'subtle').replace('hyperlink', 'link').replace('anchor', 'link').replace('active', 'pressed').replace('hover', 'hovered').replace('card', 'raised').replace('dragged', 'surface overlay').replace('dragging', 'surface overlay').replace('drag', 'surface overlay').replace('background-color', 'background').replace('color', 'text').replace('icons', 'icon').replace('glyph', 'icon').replace('stroke', 'border').replace('border-left', 'border').replace('border-right', 'border').replace('border-top', 'border').replace('border-bottom', 'border').replace('box-shadow', 'shadow');
64
+ accum.push.apply(accum, _toConsumableArray(cleanVal.split(' ')));
57
65
  return accum;
58
66
  }, []).filter(function (val) {
59
67
  return getUniqueWordsFromTokens.includes(val);
@@ -1,10 +1,27 @@
1
+ import { isDecendantOfType } from '@codeshift/utils';
1
2
  export function isDecendantOfToken(j, path) {
3
+ if (path.type === 'CallExpression' && path.callee.type === 'Identifier' && path.callee.name === 'token') {
4
+ return true;
5
+ }
2
6
  return j(path).closest(j.CallExpression, {
3
7
  callee: {
4
8
  name: 'token'
5
9
  }
6
10
  }).length > 0;
7
11
  }
8
- export function isDecendantOfType(j, path, type) {
9
- return j(path).closest(type).length > 0;
12
+ export function isParentOfToken(j, path) {
13
+ if (path.type === 'CallExpression' && path.callee.type === 'Identifier' && path.callee.name === 'token') {
14
+ return true;
15
+ }
16
+ return j(path).find(j.CallExpression, {
17
+ callee: {
18
+ name: 'token'
19
+ }
20
+ }).length > 0;
21
+ }
22
+ export function getClosestDecendantOfType(j, path, type) {
23
+ if (!isDecendantOfType(j, path, type)) {
24
+ return;
25
+ }
26
+ return j(path).closest(type).get();
10
27
  }
@@ -5,16 +5,16 @@ export var legacyColorMetaMap = {
5
5
  R75: ['danger'],
6
6
  R100: ['danger'],
7
7
  R200: ['danger'],
8
- R300: ['danger'],
9
- R400: ['danger'],
10
- R500: ['danger'],
8
+ R300: ['danger', 'bold'],
9
+ R400: ['danger', 'bold'],
10
+ R500: ['danger', 'bold'],
11
11
  Y50: ['warning'],
12
12
  Y75: ['warning'],
13
13
  Y100: ['warning'],
14
14
  Y200: ['warning'],
15
- Y300: ['warning'],
16
- Y400: ['warning'],
17
- Y500: ['warning'],
15
+ Y300: ['warning', 'bold'],
16
+ Y400: ['warning', 'bold'],
17
+ Y500: ['warning', 'bold'],
18
18
  G50: ['success'],
19
19
  G75: ['success'],
20
20
  G100: ['success'],
@@ -22,20 +22,20 @@ export var legacyColorMetaMap = {
22
22
  G300: ['success'],
23
23
  G400: ['success'],
24
24
  G500: ['success'],
25
- B50: ['brand'],
26
- B75: ['brand'],
27
- B100: ['brand'],
28
- B200: ['brand'],
29
- B300: ['brand'],
30
- B400: ['brand'],
31
- B500: ['brand'],
25
+ B50: ['information'],
26
+ B75: ['information'],
27
+ B100: ['information'],
28
+ B200: ['information'],
29
+ B300: ['information', 'bold'],
30
+ B400: ['information', 'bold'],
31
+ B500: ['information', 'bold'],
32
32
  P50: ['discovery'],
33
33
  P75: ['discovery'],
34
34
  P100: ['discovery'],
35
35
  P200: ['discovery'],
36
- P300: ['discovery'],
37
- P400: ['discovery'],
38
- P500: ['discovery'],
36
+ P300: ['discovery', 'bold'],
37
+ P400: ['discovery', 'bold'],
38
+ P500: ['discovery', 'bold'],
39
39
  T50: ['accent', 'teal'],
40
40
  T75: ['accent', 'teal'],
41
41
  T100: ['accent', 'teal'],
@@ -44,9 +44,24 @@ export var legacyColorMetaMap = {
44
44
  T400: ['accent', 'teal'],
45
45
  T500: ['accent', 'teal'],
46
46
  N0: ['inverse'],
47
- N700: ['text'],
48
- N800: ['text'],
49
- N900: ['text'],
47
+ N10: ['neutral'],
48
+ N20: ['neutral'],
49
+ N30: ['neutral'],
50
+ N40: ['neutral'],
51
+ N50: ['neutral'],
52
+ N60: ['neutral'],
53
+ N70: ['neutral'],
54
+ N80: ['neutral'],
55
+ N90: ['neutral'],
56
+ N100: ['neutral'],
57
+ N200: ['neutral'],
58
+ N300: ['neutral'],
59
+ N400: ['neutral'],
60
+ N500: ['neutral'],
61
+ N600: ['neutral'],
62
+ N700: ['neutral'],
63
+ N800: ['neutral'],
64
+ N900: ['neutral'],
50
65
  background: ['background', 'default'],
51
66
  backgroundActive: ['background', 'pressed'],
52
67
  backgroundHover: ['background', 'hovered'],
@@ -70,5 +85,6 @@ export var legacyColorMetaMap = {
70
85
  yellow: ['accent', 'orange'],
71
86
  green: ['accent', 'green'],
72
87
  grey: ['background', 'neutral'],
73
- skeleton: ['background', 'neutral']
88
+ skeleton: ['skeleton'],
89
+ white: ['inverse']
74
90
  };
@@ -5,7 +5,7 @@ export var tokens = rawTokens.filter(function (t) {
5
5
  }).map(function (t) {
6
6
  return t.name.replace(/\.\[default\]/g, '');
7
7
  }).filter(function (t) {
8
- return !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart');
8
+ return !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart') && !t.includes('elevation.shadow.overflow');
9
9
  });
10
10
  export var getUniqueWordsFromTokens = tokens.reduce(function (accum, val) {
11
11
  return [].concat(_toConsumableArray(accum), _toConsumableArray(val.split('.')));
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.13.0"
3
+ "version": "0.13.2"
4
4
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { Flags, Default } from './types';
2
3
  declare const defaultFlags: {
3
4
  parser: "babel";
@@ -1,3 +1,4 @@
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;
1
+ import core, { ASTNode, ASTPath } from 'jscodeshift';
2
+ export declare function isDecendantOfToken(j: core.JSCodeshift, path: ASTNode): boolean;
3
+ export declare function isParentOfToken(j: core.JSCodeshift, path: any): boolean;
4
+ export declare function getClosestDecendantOfType(j: core.JSCodeshift, path: ASTPath, type: any): any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { Flags, Default } from './types';
2
3
  declare const defaultFlags: {
3
4
  parser: "babel";
@@ -1,3 +1,4 @@
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;
1
+ import core, { ASTNode, ASTPath } from 'jscodeshift';
2
+ export declare function isDecendantOfToken(j: core.JSCodeshift, path: ASTNode): boolean;
3
+ export declare function isParentOfToken(j: core.JSCodeshift, path: any): boolean;
4
+ export declare function getClosestDecendantOfType(j: core.JSCodeshift, path: ASTPath, type: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "A cli for distributing codemods for atlassian-frontend components and services",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/tokens": "^1.5.0",
36
36
  "@babel/runtime": "^7.0.0",
37
- "@codeshift/utils": "^0.2.1",
37
+ "@codeshift/utils": "^0.2.4",
38
38
  "@types/jscodeshift": "^0.11.0",
39
39
  "chalk": "^4.1.2",
40
40
  "enquirer": "^2.3.4",
@@ -48,7 +48,6 @@
48
48
  "simple-git": "^3.16.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@atlaskit/docs": "*",
52
51
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
53
52
  "ts-node": "^10.9.1",
54
53
  "typescript": "~4.9.5"
package/report.api.md CHANGED
@@ -15,6 +15,8 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ /// <reference types="node" />
19
+
18
20
  // @public (undocumented)
19
21
  type CliFlags = {
20
22
  transform?: string;
@@ -4,6 +4,8 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ /// <reference types="node" />
8
+
7
9
  // @public (undocumented)
8
10
  type CliFlags = {
9
11
  transform?: string;