@atlaskit/codemod-cli 0.34.3 → 0.34.4
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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/remove-token-fallbacks/remove-token-fallbacks.js +1 -2
- package/dist/cjs/presets/remove-token-fallbacks/utils/all-tokens.js +2 -4
- package/dist/es2019/presets/remove-token-fallbacks/remove-token-fallbacks.js +1 -2
- package/dist/es2019/presets/remove-token-fallbacks/utils/all-tokens.js +4 -5
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/remove-token-fallbacks/remove-token-fallbacks.js +1 -2
- package/dist/esm/presets/remove-token-fallbacks/utils/all-tokens.js +3 -5
- package/dist/types/presets/remove-token-fallbacks/utils/all-tokens.d.ts +1 -1
- package/dist/types-ts4.5/presets/remove-token-fallbacks/utils/all-tokens.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/cjs/main.js
CHANGED
|
@@ -362,7 +362,7 @@ function _main() {
|
|
|
362
362
|
case 4:
|
|
363
363
|
_yield$parseArgs = _context6.sent;
|
|
364
364
|
packages = _yield$parseArgs.packages;
|
|
365
|
-
_process$env$_PACKAGE = "0.
|
|
365
|
+
_process$env$_PACKAGE = "0.0.0-development", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
366
366
|
logger.log(_chalk.default.bgBlue(_chalk.default.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
367
367
|
if (packages && packages.length > 0) {
|
|
368
368
|
logger.log(_chalk.default.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -60,7 +60,6 @@ function transformer(_x, _x2, _x3) {
|
|
|
60
60
|
}
|
|
61
61
|
function _transformer() {
|
|
62
62
|
_transformer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(fileInfo, _ref, options) {
|
|
63
|
-
var _options$useLegacyCol;
|
|
64
63
|
var j, rootDir, source, details, tokenMap, teamInfo, transformPromises, results, unusedVars, allImports, allVars;
|
|
65
64
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
66
65
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -110,7 +109,7 @@ function _transformer() {
|
|
|
110
109
|
console.log(_chalk.default.yellow("Border difference threshold set to: ".concat(options.borderDifferenceThreshold, "%")));
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
|
-
tokenMap = (0, _allTokens.getTokenMap)(
|
|
112
|
+
tokenMap = (0, _allTokens.getTokenMap)();
|
|
114
113
|
_context.next = 12;
|
|
115
114
|
return (0, _getTeamInfo.getTeamInfo)(fileInfo.path);
|
|
116
115
|
case 12:
|
|
@@ -34,11 +34,9 @@ var tokenMapCache = [null, null];
|
|
|
34
34
|
// When there is no theme, the babel plugin would use the given theme to provide default token fallbacks. Therefore it's safe to remove fallbacks only when they match the fallbacks that would be generated by the babel plugin with the given theme.
|
|
35
35
|
// The default value is set to use the Light theme to match the behavior of the babel plugin (packages/design-system/tokens/src/babel-plugin/plugin.tsx).
|
|
36
36
|
function getTokenMap() {
|
|
37
|
-
var
|
|
38
|
-
var themeIndex = useLegacyTheme ? 1 : 0;
|
|
37
|
+
var themeIndex = 0;
|
|
39
38
|
if (!tokenMapCache[themeIndex]) {
|
|
40
|
-
|
|
41
|
-
tokenMapCache[themeIndex] = buildCombinedMap(selectedTheme, _tokensRaw.spacing, _tokensRaw.shape, typographyThemeFiltered);
|
|
39
|
+
tokenMapCache[themeIndex] = buildCombinedMap(_tokensRaw.light, _tokensRaw.spacing, _tokensRaw.shape, typographyThemeFiltered);
|
|
42
40
|
}
|
|
43
41
|
return tokenMapCache[themeIndex];
|
|
44
42
|
}
|
|
@@ -42,7 +42,6 @@ const execAsync = promisify(exec);
|
|
|
42
42
|
export default async function transformer(fileInfo, {
|
|
43
43
|
jscodeshift: j
|
|
44
44
|
}, options) {
|
|
45
|
-
var _options$useLegacyCol;
|
|
46
45
|
const rootDir = await findRoot(path.dirname(fileInfo.path));
|
|
47
46
|
const source = j(fileInfo.source);
|
|
48
47
|
if (!hasImportDeclaration(j, source, '@atlaskit/tokens')) {
|
|
@@ -81,7 +80,7 @@ export default async function transformer(fileInfo, {
|
|
|
81
80
|
console.log(chalk.yellow(`Border difference threshold set to: ${options.borderDifferenceThreshold}%`));
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
|
-
const tokenMap = getTokenMap(
|
|
83
|
+
const tokenMap = getTokenMap();
|
|
85
84
|
const teamInfo = await getTeamInfo(fileInfo.path);
|
|
86
85
|
const transformPromises = source.find(j.CallExpression, {
|
|
87
86
|
callee: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { light as lightTheme, shape as shapeTheme, spacing as spacingTheme, typography as typographyTheme } from '@atlaskit/tokens/tokens-raw';
|
|
2
2
|
const typographyGroups = ['typography', 'fontWeight', 'fontFamily'];
|
|
3
3
|
function buildCombinedMap(...arrays) {
|
|
4
4
|
const combinedMap = {};
|
|
@@ -20,11 +20,10 @@ const tokenMapCache = [null, null];
|
|
|
20
20
|
// This should be used with the same value as the @atlaskit/tokens/babel-plugin is cofigured with for the given path.
|
|
21
21
|
// When there is no theme, the babel plugin would use the given theme to provide default token fallbacks. Therefore it's safe to remove fallbacks only when they match the fallbacks that would be generated by the babel plugin with the given theme.
|
|
22
22
|
// The default value is set to use the Light theme to match the behavior of the babel plugin (packages/design-system/tokens/src/babel-plugin/plugin.tsx).
|
|
23
|
-
export function getTokenMap(
|
|
24
|
-
const themeIndex =
|
|
23
|
+
export function getTokenMap() {
|
|
24
|
+
const themeIndex = 0;
|
|
25
25
|
if (!tokenMapCache[themeIndex]) {
|
|
26
|
-
|
|
27
|
-
tokenMapCache[themeIndex] = buildCombinedMap(selectedTheme, spacingTheme, shapeTheme, typographyThemeFiltered);
|
|
26
|
+
tokenMapCache[themeIndex] = buildCombinedMap(lightTheme, spacingTheme, shapeTheme, typographyThemeFiltered);
|
|
28
27
|
}
|
|
29
28
|
return tokenMapCache[themeIndex];
|
|
30
29
|
}
|
package/dist/esm/main.js
CHANGED
|
@@ -355,7 +355,7 @@ function _main() {
|
|
|
355
355
|
case 4:
|
|
356
356
|
_yield$parseArgs = _context6.sent;
|
|
357
357
|
packages = _yield$parseArgs.packages;
|
|
358
|
-
_process$env$_PACKAGE = "0.
|
|
358
|
+
_process$env$_PACKAGE = "0.0.0-development", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
359
359
|
logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
360
360
|
if (packages && packages.length > 0) {
|
|
361
361
|
logger.log(chalk.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -51,7 +51,6 @@ export default function transformer(_x, _x2, _x3) {
|
|
|
51
51
|
}
|
|
52
52
|
function _transformer() {
|
|
53
53
|
_transformer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileInfo, _ref, options) {
|
|
54
|
-
var _options$useLegacyCol;
|
|
55
54
|
var j, rootDir, source, details, tokenMap, teamInfo, transformPromises, results, unusedVars, allImports, allVars;
|
|
56
55
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
56
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -101,7 +100,7 @@ function _transformer() {
|
|
|
101
100
|
console.log(chalk.yellow("Border difference threshold set to: ".concat(options.borderDifferenceThreshold, "%")));
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
|
-
tokenMap = getTokenMap(
|
|
103
|
+
tokenMap = getTokenMap();
|
|
105
104
|
_context.next = 12;
|
|
106
105
|
return getTeamInfo(fileInfo.path);
|
|
107
106
|
case 12:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { light as lightTheme, shape as shapeTheme, spacing as spacingTheme, typography as typographyTheme } from '@atlaskit/tokens/tokens-raw';
|
|
2
2
|
var typographyGroups = ['typography', 'fontWeight', 'fontFamily'];
|
|
3
3
|
function buildCombinedMap() {
|
|
4
4
|
var combinedMap = {};
|
|
@@ -28,11 +28,9 @@ var tokenMapCache = [null, null];
|
|
|
28
28
|
// When there is no theme, the babel plugin would use the given theme to provide default token fallbacks. Therefore it's safe to remove fallbacks only when they match the fallbacks that would be generated by the babel plugin with the given theme.
|
|
29
29
|
// The default value is set to use the Light theme to match the behavior of the babel plugin (packages/design-system/tokens/src/babel-plugin/plugin.tsx).
|
|
30
30
|
export function getTokenMap() {
|
|
31
|
-
var
|
|
32
|
-
var themeIndex = useLegacyTheme ? 1 : 0;
|
|
31
|
+
var themeIndex = 0;
|
|
33
32
|
if (!tokenMapCache[themeIndex]) {
|
|
34
|
-
|
|
35
|
-
tokenMapCache[themeIndex] = buildCombinedMap(selectedTheme, spacingTheme, shapeTheme, typographyThemeFiltered);
|
|
33
|
+
tokenMapCache[themeIndex] = buildCombinedMap(lightTheme, spacingTheme, shapeTheme, typographyThemeFiltered);
|
|
36
34
|
}
|
|
37
35
|
return tokenMapCache[themeIndex];
|
|
38
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getTokenMap(
|
|
1
|
+
export declare function getTokenMap(): Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getTokenMap(
|
|
1
|
+
export declare function getTokenMap(): Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/codemod-cli",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.4",
|
|
4
4
|
"description": "A cli for distributing codemods for atlassian-frontend components and services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
32
32
|
"@atlaskit/icon": "^30.0.0",
|
|
33
|
-
"@atlaskit/icon-lab": "^5.
|
|
34
|
-
"@atlaskit/tokens": "^
|
|
33
|
+
"@atlaskit/icon-lab": "^5.15.0",
|
|
34
|
+
"@atlaskit/tokens": "^11.0.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@codeshift/utils": "^0.2.4",
|
|
37
37
|
"@hypermod/utils": "^0.4.2",
|