@atlaskit/codemod-cli 0.17.10 → 0.19.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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/filepath.js +1 -1
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/index.js +2 -4
- package/dist/cjs/transforms.js +3 -3
- package/dist/es2019/filepath.js +2 -2
- package/dist/es2019/presets/index.js +2 -4
- package/dist/es2019/transforms.js +3 -3
- package/dist/esm/filepath.js +2 -2
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/index.js +2 -4
- package/dist/esm/transforms.js +3 -3
- package/dist/types/presets/index.d.ts +1 -3
- package/dist/types-ts4.5/presets/index.d.ts +1 -3
- package/package.json +3 -6
- package/dist/cjs/presets/css-to-design-tokens/css-to-design-tokens.js +0 -117
- package/dist/cjs/presets/css-to-design-tokens/lib/colors.js +0 -49
- package/dist/cjs/presets/css-to-design-tokens/lib/declaration.js +0 -29
- package/dist/cjs/presets/css-to-design-tokens/lib/legacy-colors.js +0 -338
- package/dist/cjs/presets/css-to-design-tokens/lib/logger.js +0 -18
- package/dist/cjs/presets/css-to-design-tokens/lib/meta.js +0 -157
- package/dist/cjs/presets/css-to-design-tokens/lib/tokens.js +0 -47
- package/dist/cjs/presets/css-to-design-tokens/lib/value.js +0 -80
- package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -489
- package/dist/cjs/presets/theme-to-design-tokens/types.js +0 -5
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +0 -82
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +0 -35
- package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +0 -44
- package/dist/cjs/presets/theme-to-design-tokens/utils/css-utils.js +0 -38
- package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -289
- package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -96
- package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +0 -7
- package/dist/cjs/presets/theme-to-design-tokens/utils/string-utils.js +0 -25
- package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +0 -28
- package/dist/es2019/presets/css-to-design-tokens/css-to-design-tokens.js +0 -89
- package/dist/es2019/presets/css-to-design-tokens/lib/colors.js +0 -34
- package/dist/es2019/presets/css-to-design-tokens/lib/declaration.js +0 -17
- package/dist/es2019/presets/css-to-design-tokens/lib/legacy-colors.js +0 -332
- package/dist/es2019/presets/css-to-design-tokens/lib/logger.js +0 -11
- package/dist/es2019/presets/css-to-design-tokens/lib/meta.js +0 -133
- package/dist/es2019/presets/css-to-design-tokens/lib/tokens.js +0 -24
- package/dist/es2019/presets/css-to-design-tokens/lib/value.js +0 -68
- package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -377
- package/dist/es2019/presets/theme-to-design-tokens/types.js +0 -1
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +0 -60
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +0 -27
- package/dist/es2019/presets/theme-to-design-tokens/utils/color.js +0 -32
- package/dist/es2019/presets/theme-to-design-tokens/utils/css-utils.js +0 -31
- package/dist/es2019/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -279
- package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -90
- package/dist/es2019/presets/theme-to-design-tokens/utils/named-colors.js +0 -1
- package/dist/es2019/presets/theme-to-design-tokens/utils/string-utils.js +0 -13
- package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +0 -8
- package/dist/esm/presets/css-to-design-tokens/css-to-design-tokens.js +0 -109
- package/dist/esm/presets/css-to-design-tokens/lib/colors.js +0 -38
- package/dist/esm/presets/css-to-design-tokens/lib/declaration.js +0 -19
- package/dist/esm/presets/css-to-design-tokens/lib/legacy-colors.js +0 -332
- package/dist/esm/presets/css-to-design-tokens/lib/logger.js +0 -11
- package/dist/esm/presets/css-to-design-tokens/lib/meta.js +0 -146
- package/dist/esm/presets/css-to-design-tokens/lib/tokens.js +0 -40
- package/dist/esm/presets/css-to-design-tokens/lib/value.js +0 -73
- package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -484
- package/dist/esm/presets/theme-to-design-tokens/types.js +0 -1
- package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +0 -74
- package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +0 -27
- package/dist/esm/presets/theme-to-design-tokens/utils/color.js +0 -36
- package/dist/esm/presets/theme-to-design-tokens/utils/css-utils.js +0 -31
- package/dist/esm/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -283
- package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -90
- package/dist/esm/presets/theme-to-design-tokens/utils/named-colors.js +0 -1
- package/dist/esm/presets/theme-to-design-tokens/utils/string-utils.js +0 -17
- package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +0 -21
- package/dist/types/presets/css-to-design-tokens/css-to-design-tokens.d.ts +0 -2
- package/dist/types/presets/css-to-design-tokens/lib/colors.d.ts +0 -6
- package/dist/types/presets/css-to-design-tokens/lib/declaration.d.ts +0 -5
- package/dist/types/presets/css-to-design-tokens/lib/legacy-colors.d.ts +0 -3
- package/dist/types/presets/css-to-design-tokens/lib/logger.d.ts +0 -4
- package/dist/types/presets/css-to-design-tokens/lib/meta.d.ts +0 -6
- package/dist/types/presets/css-to-design-tokens/lib/tokens.d.ts +0 -7
- package/dist/types/presets/css-to-design-tokens/lib/value.d.ts +0 -6
- package/dist/types/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +0 -2
- package/dist/types/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -3
- package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +0 -4
- package/dist/types/presets/theme-to-design-tokens/utils/color.d.ts +0 -5
- package/dist/types/presets/theme-to-design-tokens/utils/css-utils.d.ts +0 -2
- package/dist/types/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +0 -5
- package/dist/types/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +0 -3
- package/dist/types/presets/theme-to-design-tokens/utils/named-colors.d.ts +0 -1
- package/dist/types/presets/theme-to-design-tokens/utils/string-utils.d.ts +0 -3
- package/dist/types/presets/theme-to-design-tokens/utils/tokens.d.ts +0 -2
- package/dist/types-ts4.5/presets/css-to-design-tokens/css-to-design-tokens.d.ts +0 -2
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/colors.d.ts +0 -6
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/declaration.d.ts +0 -5
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/legacy-colors.d.ts +0 -3
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/logger.d.ts +0 -4
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/meta.d.ts +0 -6
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/tokens.d.ts +0 -7
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/value.d.ts +0 -6
- package/dist/types-ts4.5/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +0 -2
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -3
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast.d.ts +0 -4
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/color.d.ts +0 -5
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/css-utils.d.ts +0 -2
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +0 -5
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +0 -3
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/named-colors.d.ts +0 -1
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/string-utils.d.ts +0 -6
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/tokens.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/codemod-cli
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#60956](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60956) [`3c438c899565`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c438c899565) - Updated glob dependency to 9.0.0 to fix VULN-1129796
|
|
8
|
+
|
|
9
|
+
## 0.18.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#71146](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71146) [`3e20d00d3d46`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3e20d00d3d46) - Moves tokens codemods into the tokens package.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 0.17.10
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/filepath.js
CHANGED
|
@@ -27,7 +27,7 @@ function _findDependentPackagePaths() {
|
|
|
27
27
|
return "".concat(crawlPath.replace(/^\.\//, ''), "/**/package.json");
|
|
28
28
|
}); // Convert array into glob string
|
|
29
29
|
globString = searchStrings.length > 1 ? "{".concat(searchStrings.join(','), "}") : searchStrings[0];
|
|
30
|
-
packageJsonPaths = _glob.
|
|
30
|
+
packageJsonPaths = (0, _glob.globSync)(globString, {
|
|
31
31
|
ignore: '**/node_modules/**',
|
|
32
32
|
nodir: true
|
|
33
33
|
});
|
package/dist/cjs/main.js
CHANGED
|
@@ -305,7 +305,7 @@ function _main() {
|
|
|
305
305
|
case 4:
|
|
306
306
|
_yield$parseArgs = _context5.sent;
|
|
307
307
|
packages = _yield$parseArgs.packages;
|
|
308
|
-
_process$env$_PACKAGE = "0.
|
|
308
|
+
_process$env$_PACKAGE = "0.19.0", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
309
309
|
logger.log(_chalk.default.bgBlue(_chalk.default.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
310
310
|
if (packages && packages.length > 0) {
|
|
311
311
|
logger.log(_chalk.default.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -7,16 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
require("./styled-to-emotion/styled-to-emotion");
|
|
10
|
-
require("./theme-to-design-tokens/theme-to-design-tokens");
|
|
11
10
|
require("./theme-remove-deprecated-mixins/theme-remove-deprecated-mixins");
|
|
12
|
-
require("./css-to-design-tokens/css-to-design-tokens");
|
|
13
11
|
require("./migrate-to-new-buttons/migrate-to-new-buttons");
|
|
14
12
|
/**
|
|
15
13
|
* Manually import presets to make sure typescript includes them
|
|
16
|
-
* in the final bundle
|
|
14
|
+
* in the final bundle.
|
|
17
15
|
*/
|
|
18
16
|
|
|
19
|
-
var presets = ['styled-to-emotion', 'theme-
|
|
17
|
+
var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-new-buttons'].map(function (preset) {
|
|
20
18
|
return _path.default.join(__dirname, preset, "".concat(preset, ".@(ts|js|tsx)"));
|
|
21
19
|
});
|
|
22
20
|
var _default = exports.default = presets;
|
package/dist/cjs/transforms.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.parseTransformPath = exports.hasTransform = exports.getTransforms = exports.getTransformVersion = exports.getTransformPath = exports.getTransformModule = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var _glob =
|
|
10
|
+
var _glob = require("glob");
|
|
11
11
|
var _semver = _interopRequireDefault(require("semver"));
|
|
12
12
|
var _presets = _interopRequireDefault(require("./presets"));
|
|
13
13
|
var basePath = function basePath(packages) {
|
|
@@ -17,7 +17,7 @@ var basePath = function basePath(packages) {
|
|
|
17
17
|
return _path.default.join.apply(_path.default, [process.cwd(), 'node_modules'].concat(packageDirectory, ['codemods']));
|
|
18
18
|
};
|
|
19
19
|
var hasTransform = exports.hasTransform = function hasTransform(transformPath) {
|
|
20
|
-
return _glob.
|
|
20
|
+
return (0, _glob.globSync)(transformPath).length > 0;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/** Retrieves transforms for `packages` if provided, otherwise all transforms including presets */
|
|
@@ -27,7 +27,7 @@ var getTransforms = exports.getTransforms = function getTransforms(packages) {
|
|
|
27
27
|
transforms.unshift.apply(transforms, (0, _toConsumableArray2.default)(_presets.default));
|
|
28
28
|
}
|
|
29
29
|
return transforms.map(function (transform) {
|
|
30
|
-
return _glob.
|
|
30
|
+
return (0, _glob.globSync)(transform);
|
|
31
31
|
}).reduce(function (acc, val) {
|
|
32
32
|
return acc.concat(val);
|
|
33
33
|
}, []).map(function (transform) {
|
package/dist/es2019/filepath.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { globSync } from 'glob';
|
|
2
2
|
import { promises } from 'fs';
|
|
3
3
|
const {
|
|
4
4
|
readFile
|
|
@@ -14,7 +14,7 @@ export async function findDependentPackagePaths(crawlPaths, dependencyPackage) {
|
|
|
14
14
|
|
|
15
15
|
// Convert array into glob string
|
|
16
16
|
const globString = searchStrings.length > 1 ? `{${searchStrings.join(',')}}` : searchStrings[0];
|
|
17
|
-
const packageJsonPaths =
|
|
17
|
+
const packageJsonPaths = globSync(globString, {
|
|
18
18
|
ignore: '**/node_modules/**',
|
|
19
19
|
nodir: true
|
|
20
20
|
});
|
|
@@ -2,12 +2,10 @@ import path from 'path';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Manually import presets to make sure typescript includes them
|
|
5
|
-
* in the final bundle
|
|
5
|
+
* in the final bundle.
|
|
6
6
|
*/
|
|
7
7
|
import './styled-to-emotion/styled-to-emotion';
|
|
8
|
-
import './theme-to-design-tokens/theme-to-design-tokens';
|
|
9
8
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
10
|
-
import './css-to-design-tokens/css-to-design-tokens';
|
|
11
9
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
12
|
-
const presets = ['styled-to-emotion', 'theme-
|
|
10
|
+
const presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-new-buttons'].map(preset => path.join(__dirname, preset, `${preset}.@(ts|js|tsx)`));
|
|
13
11
|
export default presets;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import
|
|
2
|
+
import { globSync } from 'glob';
|
|
3
3
|
import semver from 'semver';
|
|
4
4
|
import presets from './presets';
|
|
5
5
|
const basePath = packages => {
|
|
6
6
|
const packageDirectory = packages && packages.length > 0 ? [`{${packages.map(pkg => pkg.name).join(',')},}`] : ['@{atlaskit,atlassian,atlassiansox}', '*'];
|
|
7
7
|
return path.join(process.cwd(), 'node_modules', ...packageDirectory, 'codemods');
|
|
8
8
|
};
|
|
9
|
-
export const hasTransform = transformPath =>
|
|
9
|
+
export const hasTransform = transformPath => globSync(transformPath).length > 0;
|
|
10
10
|
|
|
11
11
|
/** Retrieves transforms for `packages` if provided, otherwise all transforms including presets */
|
|
12
12
|
export const getTransforms = packages => {
|
|
@@ -14,7 +14,7 @@ export const getTransforms = packages => {
|
|
|
14
14
|
if (!packages) {
|
|
15
15
|
transforms.unshift(...presets);
|
|
16
16
|
}
|
|
17
|
-
return transforms.map(transform =>
|
|
17
|
+
return transforms.map(transform => globSync(transform)).reduce((acc, val) => acc.concat(val), []).map(transform => parseTransformPath(transform)).filter(filterTransforms(packages)).sort();
|
|
18
18
|
};
|
|
19
19
|
export const parseTransformPath = transformPath => path.parse(transformPath);
|
|
20
20
|
export const getTransformPath = ({
|
package/dist/esm/filepath.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import {
|
|
3
|
+
import { globSync } from 'glob';
|
|
4
4
|
import { promises } from 'fs';
|
|
5
5
|
var readFile = promises.readFile;
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ function _findDependentPackagePaths() {
|
|
|
20
20
|
return "".concat(crawlPath.replace(/^\.\//, ''), "/**/package.json");
|
|
21
21
|
}); // Convert array into glob string
|
|
22
22
|
globString = searchStrings.length > 1 ? "{".concat(searchStrings.join(','), "}") : searchStrings[0];
|
|
23
|
-
packageJsonPaths =
|
|
23
|
+
packageJsonPaths = globSync(globString, {
|
|
24
24
|
ignore: '**/node_modules/**',
|
|
25
25
|
nodir: true
|
|
26
26
|
});
|
package/dist/esm/main.js
CHANGED
|
@@ -298,7 +298,7 @@ function _main() {
|
|
|
298
298
|
case 4:
|
|
299
299
|
_yield$parseArgs = _context5.sent;
|
|
300
300
|
packages = _yield$parseArgs.packages;
|
|
301
|
-
_process$env$_PACKAGE = "0.
|
|
301
|
+
_process$env$_PACKAGE = "0.19.0", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
302
302
|
logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
303
303
|
if (packages && packages.length > 0) {
|
|
304
304
|
logger.log(chalk.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -2,14 +2,12 @@ import path from 'path';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Manually import presets to make sure typescript includes them
|
|
5
|
-
* in the final bundle
|
|
5
|
+
* in the final bundle.
|
|
6
6
|
*/
|
|
7
7
|
import './styled-to-emotion/styled-to-emotion';
|
|
8
|
-
import './theme-to-design-tokens/theme-to-design-tokens';
|
|
9
8
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
10
|
-
import './css-to-design-tokens/css-to-design-tokens';
|
|
11
9
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
12
|
-
var presets = ['styled-to-emotion', 'theme-
|
|
10
|
+
var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-new-buttons'].map(function (preset) {
|
|
13
11
|
return path.join(__dirname, preset, "".concat(preset, ".@(ts|js|tsx)"));
|
|
14
12
|
});
|
|
15
13
|
export default presets;
|
package/dist/esm/transforms.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import
|
|
3
|
+
import { globSync } from 'glob';
|
|
4
4
|
import semver from 'semver';
|
|
5
5
|
import presets from './presets';
|
|
6
6
|
var basePath = function basePath(packages) {
|
|
@@ -10,7 +10,7 @@ var basePath = function basePath(packages) {
|
|
|
10
10
|
return path.join.apply(path, [process.cwd(), 'node_modules'].concat(packageDirectory, ['codemods']));
|
|
11
11
|
};
|
|
12
12
|
export var hasTransform = function hasTransform(transformPath) {
|
|
13
|
-
return
|
|
13
|
+
return globSync(transformPath).length > 0;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/** Retrieves transforms for `packages` if provided, otherwise all transforms including presets */
|
|
@@ -20,7 +20,7 @@ export var getTransforms = function getTransforms(packages) {
|
|
|
20
20
|
transforms.unshift.apply(transforms, _toConsumableArray(presets));
|
|
21
21
|
}
|
|
22
22
|
return transforms.map(function (transform) {
|
|
23
|
-
return
|
|
23
|
+
return globSync(transform);
|
|
24
24
|
}).reduce(function (acc, val) {
|
|
25
25
|
return acc.concat(val);
|
|
26
26
|
}, []).map(function (transform) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Manually import presets to make sure typescript includes them
|
|
3
|
-
* in the final bundle
|
|
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';
|
|
7
6
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
8
|
-
import './css-to-design-tokens/css-to-design-tokens';
|
|
9
7
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
10
8
|
declare const presets: string[];
|
|
11
9
|
export default presets;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Manually import presets to make sure typescript includes them
|
|
3
|
-
* in the final bundle
|
|
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';
|
|
7
6
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
8
|
-
import './css-to-design-tokens/css-to-design-tokens';
|
|
9
7
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
10
8
|
declare const presets: string[];
|
|
11
9
|
export default presets;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/codemod-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.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/"
|
|
@@ -40,24 +40,21 @@
|
|
|
40
40
|
"bin": "./bin/codemod-cli.js",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
43
|
-
"@atlaskit/tokens": "^1.
|
|
43
|
+
"@atlaskit/tokens": "^1.37.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@codeshift/utils": "^0.2.4",
|
|
46
46
|
"@types/jscodeshift": "^0.11.0",
|
|
47
47
|
"chalk": "^4.1.2",
|
|
48
48
|
"enquirer": "^2.3.4",
|
|
49
|
-
"glob": "
|
|
49
|
+
"glob": "9.0.0",
|
|
50
50
|
"jscodeshift": "^0.13.0",
|
|
51
51
|
"meow": "^8.1.1",
|
|
52
|
-
"postcss": "^8.4.7",
|
|
53
|
-
"postcss-less": "^6.0.0",
|
|
54
52
|
"projector-spawn": "^1.0.1",
|
|
55
53
|
"semver": "^7.5.2",
|
|
56
54
|
"simple-git": "^3.16.0"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
60
|
-
"@types/glob": "^7.1.3",
|
|
61
58
|
"ts-node": "^10.9.1",
|
|
62
59
|
"typescript": "~4.9.5"
|
|
63
60
|
},
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = transformer;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _postcss = _interopRequireDefault(require("postcss"));
|
|
12
|
-
var _postcssLess = _interopRequireDefault(require("postcss-less"));
|
|
13
|
-
var _declaration = require("./lib/declaration");
|
|
14
|
-
var _meta = require("./lib/meta");
|
|
15
|
-
var _tokens = _interopRequireDefault(require("./lib/tokens"));
|
|
16
|
-
var _value = _interopRequireDefault(require("./lib/value"));
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
|
|
19
|
-
var POSTCSS_OPTIONS = {
|
|
20
|
-
syntax: _postcssLess.default,
|
|
21
|
-
from: undefined
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// https://github.com/postcss/postcss/blob/main/docs/writing-a-plugin.md
|
|
25
|
-
// https://astexplorer.net/#/2uBU1BLuJ1
|
|
26
|
-
var plugin = function plugin() {
|
|
27
|
-
var processed = Symbol('processed');
|
|
28
|
-
return {
|
|
29
|
-
postcssPlugin: 'UsingTokens',
|
|
30
|
-
AtRule: function AtRule(atRule, helper) {
|
|
31
|
-
// @ts-expect-error
|
|
32
|
-
if (atRule[processed]) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// @ts-expect-error: The 'variable' property does not exist on 'AtRule' according to the TypeScript definitions.
|
|
37
|
-
// However, the 'postcss-less' library adds a 'variable' property to 'AtRule' when parsing LESS variables.
|
|
38
|
-
// This property indicates whether the 'AtRule' is a LESS variable.
|
|
39
|
-
if (atRule.variable) {
|
|
40
|
-
// TODO https://hello.atlassian.net/browse/DCA11Y-637
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// @ts-expect-error
|
|
44
|
-
atRule[processed] = true;
|
|
45
|
-
},
|
|
46
|
-
Declaration: function Declaration(decl) {
|
|
47
|
-
// @ts-expect-error
|
|
48
|
-
if (decl[processed]) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (decl.value === 'none') {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
var baseMeta = (0, _meta.getBaseDeclarationMeta)(decl);
|
|
55
|
-
if ((0, _declaration.isCssDeclaration)(decl.prop)) {
|
|
56
|
-
// TODO https://hello.atlassian.net/browse/DCA11Y-637
|
|
57
|
-
}
|
|
58
|
-
if ((0, _declaration.isColorRelatedProperty)(decl.prop)) {
|
|
59
|
-
var values = (0, _declaration.splitCssValue)(decl.value);
|
|
60
|
-
if (!values) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
switch (decl.prop) {
|
|
64
|
-
case 'box-shadow':
|
|
65
|
-
var meta = values.reduce(function (acc, curr) {
|
|
66
|
-
var parsedValue = (0, _value.default)(curr);
|
|
67
|
-
if (!parsedValue) {
|
|
68
|
-
return acc;
|
|
69
|
-
}
|
|
70
|
-
return [].concat((0, _toConsumableArray2.default)(acc), (0, _toConsumableArray2.default)(parsedValue.getMeta()));
|
|
71
|
-
}, baseMeta);
|
|
72
|
-
var token = (0, _tokens.default)(meta);
|
|
73
|
-
decl.value = "var(".concat(token, ", ").concat(decl.value, ")");
|
|
74
|
-
break;
|
|
75
|
-
default:
|
|
76
|
-
var replacedValues = values.map(function (value) {
|
|
77
|
-
var parsedValue = (0, _value.default)(value);
|
|
78
|
-
if (!parsedValue) {
|
|
79
|
-
return value;
|
|
80
|
-
}
|
|
81
|
-
return parsedValue.getReplacement(baseMeta);
|
|
82
|
-
});
|
|
83
|
-
decl.value = replacedValues.join(' ');
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// @ts-expect-error
|
|
89
|
-
decl[processed] = true;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
function transformer(_x) {
|
|
94
|
-
return _transformer.apply(this, arguments);
|
|
95
|
-
}
|
|
96
|
-
function _transformer() {
|
|
97
|
-
_transformer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(file) {
|
|
98
|
-
var processor, src, _yield$processor$proc, css;
|
|
99
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
100
|
-
while (1) switch (_context.prev = _context.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
processor = (0, _postcss.default)([plugin()]);
|
|
103
|
-
src = typeof file === 'string' ? file : file.source;
|
|
104
|
-
_context.next = 4;
|
|
105
|
-
return processor.process(src, POSTCSS_OPTIONS);
|
|
106
|
-
case 4:
|
|
107
|
-
_yield$processor$proc = _context.sent;
|
|
108
|
-
css = _yield$processor$proc.css;
|
|
109
|
-
return _context.abrupt("return", css);
|
|
110
|
-
case 7:
|
|
111
|
-
case "end":
|
|
112
|
-
return _context.stop();
|
|
113
|
-
}
|
|
114
|
-
}, _callee);
|
|
115
|
-
}));
|
|
116
|
-
return _transformer.apply(this, arguments);
|
|
117
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractBetweenParentheses = extractBetweenParentheses;
|
|
7
|
-
exports.isGradient = isGradient;
|
|
8
|
-
exports.isKnownCssVariable = isKnownCssVariable;
|
|
9
|
-
exports.isLessFunction = isLessFunction;
|
|
10
|
-
exports.isNamedColor = isNamedColor;
|
|
11
|
-
exports.isRawColor = isRawColor;
|
|
12
|
-
var _legacyColors = require("./legacy-colors");
|
|
13
|
-
var NAMED_COLORS = Object.keys(_legacyColors.knownNamedColors);
|
|
14
|
-
var GRADIENT_TYPES = ['linear', 'radial', 'conic'];
|
|
15
|
-
var LESS_COLOR_FUNCTIONS = ['lighten', 'darken', 'saturate', 'desaturate', 'fadein', 'fadeout', 'fade', 'spin', 'mix', 'greyscale', 'contrast', 'multiply', 'screen', 'overlay', 'softlight', 'hardlight', 'difference', 'exclusion', 'average', 'negation', 'tint', 'shade', 'luma', 'hue', 'saturation', 'lightness', 'alpha', 'red', 'green', 'blue'];
|
|
16
|
-
var REGEXES = {
|
|
17
|
-
// The CSS regular expression matches CSS variable declarations.
|
|
18
|
-
// It looks for the string "var(" followed by any characters except a closing parenthesis, and ending with a closing parenthesis.
|
|
19
|
-
CSS: /var\([^\)]+\)/g,
|
|
20
|
-
// The RAW_COLOR regular expression matches various CSS color formats including hexadecimal, RGB(A), HSL(A), LAB, LCH, and HWB.
|
|
21
|
-
// It allows for optional leading and trailing white spaces.
|
|
22
|
-
// For RGBA and HSLA, it allows any number (including negative numbers and numbers greater than 1) for the alpha channel.
|
|
23
|
-
// For RGB, HSL, LAB, LCH, and HWB, it expects three comma-separated values.
|
|
24
|
-
// It also allows optional white spaces around the commas and the values.
|
|
25
|
-
RAW_COLOR: /^\s*(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\s*\d{1,3}%?\s*(,\s*\d{1,3}%?\s*){2},\s*-?\d*\.?\d+\s*\)|(rgb|hsl)\(\s*\d{1,3}%?\s*(,\s*\d{1,3}%?\s*){2}\)\s*|(lab|lch)\(\s*\d{1,3}%?\s+\d{1,3}%?\s+\d{1,3}%?\s*\)|hwb\(\s*\d{1,3}\s+\d{1,3}%?\s+\d{1,3}%?\s*\))\s*$/i
|
|
26
|
-
};
|
|
27
|
-
function isKnownCssVariable(value) {
|
|
28
|
-
return value in _legacyColors.knownVariables;
|
|
29
|
-
}
|
|
30
|
-
function isRawColor(value) {
|
|
31
|
-
return REGEXES.RAW_COLOR.test(value);
|
|
32
|
-
}
|
|
33
|
-
function isNamedColor(value) {
|
|
34
|
-
return NAMED_COLORS.includes(value);
|
|
35
|
-
}
|
|
36
|
-
function isGradient(value) {
|
|
37
|
-
return GRADIENT_TYPES.some(function (gradient) {
|
|
38
|
-
return value.startsWith("".concat(gradient, "-gradient("));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function extractBetweenParentheses(value) {
|
|
42
|
-
var match = value.match(/\((.*?)\)/);
|
|
43
|
-
return match ? match[1] : '';
|
|
44
|
-
}
|
|
45
|
-
function isLessFunction(value) {
|
|
46
|
-
return LESS_COLOR_FUNCTIONS.some(function (func) {
|
|
47
|
-
return value.startsWith("".concat(func, "("));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractCssVarName = extractCssVarName;
|
|
7
|
-
exports.extractLessVarName = extractLessVarName;
|
|
8
|
-
exports.isColorRelatedProperty = isColorRelatedProperty;
|
|
9
|
-
exports.isCssDeclaration = isCssDeclaration;
|
|
10
|
-
exports.splitCssValue = splitCssValue;
|
|
11
|
-
var COLOR_PROPERTIES = ['color', 'background', 'background-color', 'box-shadow', 'border', 'border-left', 'border-right', 'border-top', 'border-bottom', 'border-color', 'border-left-color', 'border-right-color', 'border-top-color', 'border-bottom-color', 'outline', 'outline-color', 'accent-color', 'caret-color', 'scrollbar-color', 'text-stroke'];
|
|
12
|
-
function isColorRelatedProperty(prop) {
|
|
13
|
-
return COLOR_PROPERTIES.some(function (property) {
|
|
14
|
-
return property === prop;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function isCssDeclaration(prop) {
|
|
18
|
-
return prop.startsWith('--');
|
|
19
|
-
}
|
|
20
|
-
function extractCssVarName(prop) {
|
|
21
|
-
return prop.substring(prop.indexOf('(') + 1).split(/\,|\)/)[0];
|
|
22
|
-
}
|
|
23
|
-
function extractLessVarName(prop) {
|
|
24
|
-
return prop.substring(1);
|
|
25
|
-
}
|
|
26
|
-
function splitCssValue(value) {
|
|
27
|
-
var regex = /(?:[^\s()]+|\((?:[^()]+|\([^()]*\))*\))+/g;
|
|
28
|
-
return value.match(regex);
|
|
29
|
-
}
|