@atlaskit/codemod-cli 0.27.0 → 0.27.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.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/cli.js +3 -3
- package/dist/cjs/filepath.js +4 -2
- package/dist/cjs/main.js +6 -6
- package/dist/cjs/presets/migrate-to-link/codemods/migrate-to-link.js +2 -2
- package/dist/cjs/presets/migrate-to-new-buttons/codemods/next-split-imports.js +1 -1
- package/dist/cjs/presets/migrate-to-new-buttons/migrate-to-new-buttons.js +2 -2
- package/dist/cjs/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js +1 -1
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.js +3 -3
- package/dist/cjs/sinceRef.js +2 -1
- package/dist/cjs/transforms.js +3 -1
- package/dist/cjs/types.js +8 -9
- package/dist/es2019/cli.js +3 -3
- package/dist/es2019/filepath.js +4 -2
- package/dist/es2019/main.js +6 -6
- package/dist/es2019/presets/migrate-to-link/codemods/migrate-to-link.js +2 -3
- package/dist/es2019/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.js +1 -1
- package/dist/es2019/presets/migrate-to-new-buttons/codemods/next-split-imports.js +2 -2
- package/dist/es2019/presets/migrate-to-new-buttons/migrate-to-new-buttons.js +2 -2
- package/dist/es2019/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js +1 -1
- package/dist/es2019/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.js +1 -1
- package/dist/es2019/presets/theme-remove-deprecated-mixins/theme-remove-deprecated-mixins.js +1 -1
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.js +3 -3
- package/dist/es2019/sinceRef.js +2 -1
- package/dist/es2019/transforms.js +3 -1
- package/dist/es2019/types.js +2 -1
- package/dist/esm/cli.js +3 -3
- package/dist/esm/filepath.js +4 -2
- package/dist/esm/main.js +7 -7
- package/dist/esm/presets/migrate-to-link/codemods/migrate-to-link.js +2 -3
- package/dist/esm/presets/migrate-to-new-buttons/codemods/next-remove-unsafe-size.js +1 -1
- package/dist/esm/presets/migrate-to-new-buttons/codemods/next-split-imports.js +2 -2
- package/dist/esm/presets/migrate-to-new-buttons/migrate-to-new-buttons.js +2 -2
- package/dist/esm/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js +1 -1
- package/dist/esm/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.js +1 -1
- package/dist/esm/presets/theme-remove-deprecated-mixins/theme-remove-deprecated-mixins.js +1 -1
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.js +3 -3
- package/dist/esm/sinceRef.js +2 -1
- package/dist/esm/transforms.js +3 -1
- package/dist/esm/types.js +8 -9
- package/dist/types/filepath.d.ts +3 -1
- package/dist/types/main.d.ts +1 -2
- package/dist/types/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.d.ts +1 -1
- package/dist/types/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.d.ts +1 -1
- package/dist/types/presets/styled-to-emotion/styled-to-emotion.d.ts +1 -1
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.d.ts +1 -1
- package/dist/types/sinceRef.d.ts +2 -1
- package/dist/types/transforms.d.ts +3 -1
- package/dist/types/types.d.ts +3 -2
- package/dist/types-ts4.5/filepath.d.ts +3 -1
- package/dist/types-ts4.5/main.d.ts +1 -2
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.d.ts +1 -1
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/move-icon-value-from-link-button-to-link-children.d.ts +1 -1
- package/dist/types-ts4.5/presets/styled-to-emotion/styled-to-emotion.d.ts +1 -1
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.d.ts +1 -1
- package/dist/types-ts4.5/sinceRef.d.ts +2 -1
- package/dist/types-ts4.5/transforms.d.ts +3 -1
- package/dist/types-ts4.5/types.d.ts +3 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/codemod-cli
|
|
2
2
|
|
|
3
|
+
## 0.27.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#105698](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105698)
|
|
8
|
+
[`e2455bc212b5c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2455bc212b5c) -
|
|
9
|
+
Resolve small ESLint issues.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 0.27.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 0.27.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/cjs/cli.js
CHANGED
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.run = run;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
11
|
var _meow = _interopRequireDefault(require("meow"));
|
|
11
|
-
var _types = require("./types");
|
|
12
12
|
var _main = _interopRequireDefault(require("./main"));
|
|
13
|
-
var
|
|
13
|
+
var _types = require("./types");
|
|
14
14
|
function run() {
|
|
15
15
|
return _run.apply(this, arguments);
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@ function _run() {
|
|
|
20
20
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
23
|
-
cli = (0, _meow.default)("\nUsage\n $ npx @atlaskit/codemod-cli [options] <file-paths>...\n\nOptions\n --preset, -n select transform by preset name, avoid user interaction\n --transform, -t the transform to run, will prompt for a transform if not provided and no module is passed\n --since-ref, runs transforms for all packages that have been upgraded since the specified git ref\n --packages, runs transforms for the specified comma separated list of packages, optionally include a version for each package to run all transforms since that version\n --parser, -p babel|babylon|flow|ts|tsx parser to use for parsing the source files (default: babel)\n --extensions, -e transform files with these file extensions (comma separated list) (default: js)\n --ignore-pattern, ignore files that match a provided glob expression\n --fail-on-error, return a 1 exit code when errors were found during execution of codemods\n --version, -v version number\n --no-filter-paths disables dependant package file path filtering logic
|
|
23
|
+
cli = (0, _meow.default)("\nUsage\n $ npx @atlaskit/codemod-cli [options] <file-paths>...\n\nOptions\n --preset, -n select transform by preset name, avoid user interaction\n --transform, -t the transform to run, will prompt for a transform if not provided and no module is passed\n --since-ref, runs transforms for all packages that have been upgraded since the specified git ref\n --packages, runs transforms for the specified comma separated list of packages, optionally include a version for each package to run all transforms since that version\n --parser, -p babel|babylon|flow|ts|tsx parser to use for parsing the source files (default: babel)\n --extensions, -e transform files with these file extensions (comma separated list) (default: js)\n --ignore-pattern, ignore files that match a provided glob expression\n --fail-on-error, return a 1 exit code when errors were found during execution of codemods\n --version, -v version number\n --no-filter-paths disables dependant package file path filtering logic\n --help Help me \uD83D\uDE31\n\nExamples\n # Run a codemod over the /project/src directory, will be prompted for which codemod to run\n $ npx @atlaskit/codemod-cli /project/src\n\n # Run the \"4.0.0-remove-appearance-prop\" transform of the \"button\" package\n $ npx @atlaskit/codemod-cli -t button@4.0.0-remove-appearance-prop /project/src\n\n # Run all transforms for \"@atlaskit/button\" greater than version 3.0.0 and @atlaskit/range greater than 4.0.0\n $ npx @atlaskit/codemod-cli --packages @atlaskit/button@3.0.0,@atlaskit/range@4.0.0 /project/src\n", {
|
|
24
24
|
flags: {
|
|
25
25
|
transform: {
|
|
26
26
|
type: 'string',
|
package/dist/cjs/filepath.js
CHANGED
|
@@ -7,11 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.findDependentPackagePaths = findDependentPackagePaths;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _glob = require("glob");
|
|
11
10
|
var _fs = require("fs");
|
|
11
|
+
var _glob = require("glob");
|
|
12
12
|
var readFile = _fs.promises.readFile;
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Return products packages filePaths for running codemods from specified dependent package
|
|
16
|
+
*/
|
|
15
17
|
function findDependentPackagePaths(_x, _x2) {
|
|
16
18
|
return _findDependentPackagePaths.apply(this, arguments);
|
|
17
19
|
}
|
package/dist/cjs/main.js
CHANGED
|
@@ -9,16 +9,16 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
13
12
|
var _fs = _interopRequireDefault(require("fs"));
|
|
14
|
-
var
|
|
13
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
15
14
|
var _enquirer = require("enquirer");
|
|
15
|
+
var _projectorSpawn = _interopRequireDefault(require("projector-spawn"));
|
|
16
16
|
var _semver = _interopRequireDefault(require("semver"));
|
|
17
|
-
var
|
|
17
|
+
var _filepath = require("./filepath");
|
|
18
|
+
var _sinceRef = require("./sinceRef");
|
|
18
19
|
var _transforms = require("./transforms");
|
|
19
20
|
var _types = require("./types");
|
|
20
|
-
var
|
|
21
|
-
var _filepath = require("./filepath");
|
|
21
|
+
var _utils = require("./utils");
|
|
22
22
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
23
23
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
24
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -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.27.
|
|
308
|
+
_process$env$_PACKAGE = "0.27.2", _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) {
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = transformer;
|
|
7
|
-
var _codemodUtils = require("@atlaskit/codemod-utils");
|
|
8
7
|
var _utils = require("@hypermod/utils");
|
|
9
|
-
var
|
|
8
|
+
var _codemodUtils = require("@atlaskit/codemod-utils");
|
|
10
9
|
var _comments = require("../utils/comments");
|
|
10
|
+
var _constants = require("../utils/constants");
|
|
11
11
|
var _findAttributeWithValue = require("../utils/find-attribute-with-value");
|
|
12
12
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
13
13
|
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _utils = require("@hypermod/utils");
|
|
9
10
|
var _constants = require("../utils/constants");
|
|
10
11
|
var _renameElements = _interopRequireDefault(require("../utils/rename-elements"));
|
|
11
|
-
var _utils = require("@hypermod/utils");
|
|
12
12
|
var transformer = function transformer(file, api) {
|
|
13
13
|
var j = api.jscodeshift;
|
|
14
14
|
var fileSource = j(file.source);
|
|
@@ -8,10 +8,10 @@ exports.default = transformer;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var
|
|
11
|
+
var _nextMigrateLinkButtonToLink = _interopRequireDefault(require("./codemods/next-migrate-link-button-to-link"));
|
|
12
12
|
var _nextMigrateToNewButtonVariants = _interopRequireDefault(require("./codemods/next-migrate-to-new-button-variants"));
|
|
13
13
|
var _nextRemoveUnsafeSize = _interopRequireDefault(require("./codemods/next-remove-unsafe-size"));
|
|
14
|
-
var
|
|
14
|
+
var _nextSplitImports = _interopRequireDefault(require("./codemods/next-split-imports"));
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
17
|
function transformer(_x, _x2) {
|
package/dist/cjs/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.addCommentForCustomThemeButtons = void 0;
|
|
7
7
|
var _codemodUtils = require("@atlaskit/codemod-utils");
|
|
8
|
-
var _constants = require("./constants");
|
|
9
8
|
var _addCommentForOverlayProp = require("./add-comment-for-overlay-prop");
|
|
9
|
+
var _constants = require("./constants");
|
|
10
10
|
var addCommentForCustomThemeButtons = exports.addCommentForCustomThemeButtons = function addCommentForCustomThemeButtons(fileSource, j) {
|
|
11
11
|
var _fileSource$find$filt;
|
|
12
12
|
var customThemeButtonImportName;
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
9
|
+
var _autoScroll = require("./transformers/auto-scroll");
|
|
10
|
+
var _elementAdapterTypes = require("./transformers/element-adapter-types");
|
|
10
11
|
var _externalAdapter = require("./transformers/external-adapter");
|
|
11
12
|
var _moveToReactDropIndicator = require("./transformers/move-to-react-drop-indicator");
|
|
12
|
-
var _autoScroll = require("./transformers/auto-scroll");
|
|
13
13
|
var _pointerOutsideOfPreview = require("./transformers/pointer-outside-of-preview");
|
|
14
14
|
var _preventUnhandled = require("./transformers/prevent-unhandled");
|
|
15
|
-
var
|
|
15
|
+
var _updateSafeImports = require("./transformers/update-safe-imports");
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
18
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
package/dist/cjs/sinceRef.js
CHANGED
|
@@ -23,7 +23,8 @@ var parseDiffLine = function parseDiffLine(line) {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Returns packages that have been upgraded in package.json since ref. The version refers to their previous
|
|
27
28
|
* version
|
|
28
29
|
*/
|
|
29
30
|
var getPackagesSinceRef = exports.getPackagesSinceRef = /*#__PURE__*/function () {
|
package/dist/cjs/transforms.js
CHANGED
|
@@ -20,7 +20,9 @@ var hasTransform = exports.hasTransform = function hasTransform(transformPath) {
|
|
|
20
20
|
return (0, _glob.globSync)(transformPath).length > 0;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves transforms for `packages` if provided, otherwise all transforms including presets
|
|
25
|
+
*/
|
|
24
26
|
var getTransforms = exports.getTransforms = function getTransforms(packages) {
|
|
25
27
|
var transforms = [_path.default.join(basePath(packages), '*.@(ts|tsx|js)'), _path.default.join(basePath(packages), '*', 'index.@(ts|tsx|js)')];
|
|
26
28
|
if (!packages) {
|
package/dist/cjs/types.js
CHANGED
|
@@ -7,30 +7,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ValidationError = exports.NoTransformsExistError = void 0;
|
|
8
8
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
14
|
-
function
|
|
14
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
15
15
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Converts required args to optional if they have a default
|
|
17
18
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
18
19
|
*/
|
|
19
20
|
var ValidationError = exports.ValidationError = /*#__PURE__*/function (_Error) {
|
|
20
|
-
(0, _inherits2.default)(ValidationError, _Error);
|
|
21
|
-
var _super = _createSuper(ValidationError);
|
|
22
21
|
function ValidationError() {
|
|
23
22
|
(0, _classCallCheck2.default)(this, ValidationError);
|
|
24
|
-
return
|
|
23
|
+
return _callSuper(this, ValidationError, arguments);
|
|
25
24
|
}
|
|
25
|
+
(0, _inherits2.default)(ValidationError, _Error);
|
|
26
26
|
return (0, _createClass2.default)(ValidationError);
|
|
27
27
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
28
28
|
var NoTransformsExistError = exports.NoTransformsExistError = /*#__PURE__*/function (_Error2) {
|
|
29
|
-
(0, _inherits2.default)(NoTransformsExistError, _Error2);
|
|
30
|
-
var _super2 = _createSuper(NoTransformsExistError);
|
|
31
29
|
function NoTransformsExistError() {
|
|
32
30
|
(0, _classCallCheck2.default)(this, NoTransformsExistError);
|
|
33
|
-
return
|
|
31
|
+
return _callSuper(this, NoTransformsExistError, arguments);
|
|
34
32
|
}
|
|
33
|
+
(0, _inherits2.default)(NoTransformsExistError, _Error2);
|
|
35
34
|
return (0, _createClass2.default)(NoTransformsExistError);
|
|
36
35
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
package/dist/es2019/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
1
2
|
import meow from 'meow';
|
|
2
|
-
import { ValidationError, NoTransformsExistError } from './types';
|
|
3
3
|
import main from './main';
|
|
4
|
-
import
|
|
4
|
+
import { NoTransformsExistError, ValidationError } from './types';
|
|
5
5
|
export async function run() {
|
|
6
6
|
const cli = meow(`
|
|
7
7
|
Usage
|
|
@@ -17,7 +17,7 @@ Options
|
|
|
17
17
|
--ignore-pattern, ignore files that match a provided glob expression
|
|
18
18
|
--fail-on-error, return a 1 exit code when errors were found during execution of codemods
|
|
19
19
|
--version, -v version number
|
|
20
|
-
--no-filter-paths disables dependant package file path filtering logic
|
|
20
|
+
--no-filter-paths disables dependant package file path filtering logic
|
|
21
21
|
--help Help me 😱
|
|
22
22
|
|
|
23
23
|
Examples
|
package/dist/es2019/filepath.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { globSync } from 'glob';
|
|
2
1
|
import { promises } from 'fs';
|
|
2
|
+
import { globSync } from 'glob';
|
|
3
3
|
const {
|
|
4
4
|
readFile
|
|
5
5
|
} = promises;
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Return products packages filePaths for running codemods from specified dependent package
|
|
9
|
+
*/
|
|
8
10
|
export async function findDependentPackagePaths(crawlPaths, dependencyPackage) {
|
|
9
11
|
// Get file paths leading to package.jsons
|
|
10
12
|
const searchStrings = crawlPaths.map(crawlPath => {
|
package/dist/es2019/main.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import fs from 'fs';
|
|
3
|
-
import
|
|
2
|
+
import chalk from 'chalk';
|
|
4
3
|
import { AutoComplete } from 'enquirer';
|
|
4
|
+
import spawn from 'projector-spawn';
|
|
5
5
|
import semver from 'semver';
|
|
6
6
|
const jscodeshift = require.resolve('.bin/jscodeshift');
|
|
7
|
-
import { fixLineEnding } from './utils';
|
|
8
|
-
import { getTransforms, getTransformPath, hasTransform, parseTransformPath, getTransformModule } from './transforms';
|
|
9
|
-
import { ValidationError, NoTransformsExistError } from './types';
|
|
10
|
-
import { getPackagesSinceRef } from './sinceRef';
|
|
11
7
|
import { findDependentPackagePaths } from './filepath';
|
|
8
|
+
import { getPackagesSinceRef } from './sinceRef';
|
|
9
|
+
import { getTransformModule, getTransformPath, getTransforms, hasTransform, parseTransformPath } from './transforms';
|
|
10
|
+
import { NoTransformsExistError, ValidationError } from './types';
|
|
11
|
+
import { fixLineEnding } from './utils';
|
|
12
12
|
const applyTransformMeta = transforms => transforms.map(transform => {
|
|
13
13
|
const moduleMatch = transform.dir.match(/\/@atlaskit\/[^\/]+\//);
|
|
14
14
|
if (moduleMatch) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
2
|
-
|
|
3
|
-
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
4
2
|
import { getImportDeclaration } from '@hypermod/utils';
|
|
5
|
-
import {
|
|
3
|
+
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
6
4
|
import { genericUnsupportedMigrationComment, spreadPropsComment, stylePropComment } from '../utils/comments';
|
|
5
|
+
import { LINK_ENTRY_POINT, LINK_EXPORT_NAME, PRINT_SETTINGS, UNSUPPORTED_STYLE_PROPS } from '../utils/constants';
|
|
7
6
|
import { findJSXAttributeWithValue } from '../utils/find-attribute-with-value';
|
|
8
7
|
export default function transformer(file, api) {
|
|
9
8
|
const j = api.jscodeshift;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getImportDeclaration, hasJSXAttributes } from '@hypermod/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { NEW_BUTTON_ENTRY_POINT, PRINT_SETTINGS, UNSAFE_SIZE_PROPS_MAP } from '../utils/constants';
|
|
3
3
|
function transformer(file, api) {
|
|
4
4
|
const j = api.jscodeshift;
|
|
5
5
|
const source = j(file.source);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PRINT_SETTINGS, entryPointsMapping, BUTTON_TYPES, NEW_BUTTON_ENTRY_POINT } from '../utils/constants';
|
|
2
|
-
import renameElements from '../utils/rename-elements';
|
|
3
1
|
import { getDefaultImportSpecifierName } from '@hypermod/utils';
|
|
2
|
+
import { BUTTON_TYPES, entryPointsMapping, NEW_BUTTON_ENTRY_POINT, PRINT_SETTINGS } from '../utils/constants';
|
|
3
|
+
import renameElements from '../utils/rename-elements';
|
|
4
4
|
const transformer = (file, api) => {
|
|
5
5
|
const j = api.jscodeshift;
|
|
6
6
|
const fileSource = j(file.source);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import migrateLinkButtonToLinkTransformer from './codemods/next-migrate-link-button-to-link';
|
|
2
2
|
import migrateToNewButtonVariantsTransformer from './codemods/next-migrate-to-new-button-variants';
|
|
3
3
|
import removeUnsafeSizeTransformer from './codemods/next-remove-unsafe-size';
|
|
4
|
-
import
|
|
4
|
+
import splitImportsTransformer from './codemods/next-split-imports';
|
|
5
5
|
export default async function transformer(file, api) {
|
|
6
6
|
const transformers = [splitImportsTransformer, migrateToNewButtonVariantsTransformer, removeUnsafeSizeTransformer, migrateLinkButtonToLinkTransformer];
|
|
7
7
|
let src = file.source;
|
package/dist/es2019/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
2
|
-
import { entryPointsMapping, customThemeButtonComment } from './constants';
|
|
3
2
|
import { addCommentForOverlayProp } from './add-comment-for-overlay-prop';
|
|
3
|
+
import { customThemeButtonComment, entryPointsMapping } from './constants';
|
|
4
4
|
export const addCommentForCustomThemeButtons = (fileSource, j) => {
|
|
5
5
|
var _fileSource$find$filt;
|
|
6
6
|
let customThemeButtonImportName;
|
package/dist/es2019/presets/migrate-to-new-buttons/utils/migrate-fit-container-icon-button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
2
2
|
import { getIconAttributes, getIconElement } from '../utils/generate-new-button-element';
|
|
3
|
-
import {
|
|
3
|
+
import { migrateFitContainerButtonToDefaultButtonComment, migrateFitContainerButtonToIconButtonComment, NEW_BUTTON_VARIANTS } from './constants';
|
|
4
4
|
export const migrateFitContainerIconButton = (element, j) => {
|
|
5
5
|
var _iconElement$openingE, _labelAttribute$value;
|
|
6
6
|
const {
|
package/dist/es2019/presets/theme-remove-deprecated-mixins/theme-remove-deprecated-mixins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getImportDeclaration, hasImportDeclaration, insertImportSpecifier } from '@codeshift/utils';
|
|
2
2
|
import { colorReplacements } from './utils/replacements';
|
|
3
3
|
function isDecendantOfType(j, path, type) {
|
|
4
4
|
return j(path).closest(type).length > 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { updateAutoScroll } from './transformers/auto-scroll';
|
|
2
|
+
import { shiftCanMonitorArgType } from './transformers/element-adapter-types';
|
|
2
3
|
import { moveFromFileAdapterToExternalAdapter } from './transformers/external-adapter';
|
|
3
4
|
import { moveToReactDropIndicator } from './transformers/move-to-react-drop-indicator';
|
|
4
|
-
import { updateAutoScroll } from './transformers/auto-scroll';
|
|
5
5
|
import { shiftToPointerOutsideOfPreview } from './transformers/pointer-outside-of-preview';
|
|
6
6
|
import { shiftToPreventUnhandled } from './transformers/prevent-unhandled';
|
|
7
|
-
import {
|
|
7
|
+
import { updateSafeImports } from './transformers/update-safe-imports';
|
|
8
8
|
const transformers = [updateSafeImports, moveFromFileAdapterToExternalAdapter, moveToReactDropIndicator, updateAutoScroll, shiftToPointerOutsideOfPreview, shiftToPreventUnhandled, shiftCanMonitorArgType];
|
|
9
9
|
export default function transformer(file, api) {
|
|
10
10
|
let source = file.source;
|
package/dist/es2019/sinceRef.js
CHANGED
|
@@ -14,7 +14,8 @@ const parseDiffLine = line => {
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Returns packages that have been upgraded in package.json since ref. The version refers to their previous
|
|
18
19
|
* version
|
|
19
20
|
*/
|
|
20
21
|
export const getPackagesSinceRef = async ref => {
|
|
@@ -8,7 +8,9 @@ const basePath = packages => {
|
|
|
8
8
|
};
|
|
9
9
|
export const hasTransform = transformPath => globSync(transformPath).length > 0;
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves transforms for `packages` if provided, otherwise all transforms including presets
|
|
13
|
+
*/
|
|
12
14
|
export const getTransforms = packages => {
|
|
13
15
|
const transforms = [path.join(basePath(packages), '*.@(ts|tsx|js)'), path.join(basePath(packages), '*', 'index.@(ts|tsx|js)')];
|
|
14
16
|
if (!packages) {
|
package/dist/es2019/types.js
CHANGED
package/dist/esm/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import chalk from 'chalk';
|
|
3
4
|
import meow from 'meow';
|
|
4
|
-
import { ValidationError, NoTransformsExistError } from './types';
|
|
5
5
|
import main from './main';
|
|
6
|
-
import
|
|
6
|
+
import { NoTransformsExistError, ValidationError } from './types';
|
|
7
7
|
export function run() {
|
|
8
8
|
return _run.apply(this, arguments);
|
|
9
9
|
}
|
|
@@ -13,7 +13,7 @@ function _run() {
|
|
|
13
13
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
14
|
while (1) switch (_context.prev = _context.next) {
|
|
15
15
|
case 0:
|
|
16
|
-
cli = meow("\nUsage\n $ npx @atlaskit/codemod-cli [options] <file-paths>...\n\nOptions\n --preset, -n select transform by preset name, avoid user interaction\n --transform, -t the transform to run, will prompt for a transform if not provided and no module is passed\n --since-ref, runs transforms for all packages that have been upgraded since the specified git ref\n --packages, runs transforms for the specified comma separated list of packages, optionally include a version for each package to run all transforms since that version\n --parser, -p babel|babylon|flow|ts|tsx parser to use for parsing the source files (default: babel)\n --extensions, -e transform files with these file extensions (comma separated list) (default: js)\n --ignore-pattern, ignore files that match a provided glob expression\n --fail-on-error, return a 1 exit code when errors were found during execution of codemods\n --version, -v version number\n --no-filter-paths disables dependant package file path filtering logic
|
|
16
|
+
cli = meow("\nUsage\n $ npx @atlaskit/codemod-cli [options] <file-paths>...\n\nOptions\n --preset, -n select transform by preset name, avoid user interaction\n --transform, -t the transform to run, will prompt for a transform if not provided and no module is passed\n --since-ref, runs transforms for all packages that have been upgraded since the specified git ref\n --packages, runs transforms for the specified comma separated list of packages, optionally include a version for each package to run all transforms since that version\n --parser, -p babel|babylon|flow|ts|tsx parser to use for parsing the source files (default: babel)\n --extensions, -e transform files with these file extensions (comma separated list) (default: js)\n --ignore-pattern, ignore files that match a provided glob expression\n --fail-on-error, return a 1 exit code when errors were found during execution of codemods\n --version, -v version number\n --no-filter-paths disables dependant package file path filtering logic\n --help Help me \uD83D\uDE31\n\nExamples\n # Run a codemod over the /project/src directory, will be prompted for which codemod to run\n $ npx @atlaskit/codemod-cli /project/src\n\n # Run the \"4.0.0-remove-appearance-prop\" transform of the \"button\" package\n $ npx @atlaskit/codemod-cli -t button@4.0.0-remove-appearance-prop /project/src\n\n # Run all transforms for \"@atlaskit/button\" greater than version 3.0.0 and @atlaskit/range greater than 4.0.0\n $ npx @atlaskit/codemod-cli --packages @atlaskit/button@3.0.0,@atlaskit/range@4.0.0 /project/src\n", {
|
|
17
17
|
flags: {
|
|
18
18
|
transform: {
|
|
19
19
|
type: 'string',
|
package/dist/esm/filepath.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { globSync } from 'glob';
|
|
4
3
|
import { promises } from 'fs';
|
|
4
|
+
import { globSync } from 'glob';
|
|
5
5
|
var readFile = promises.readFile;
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Return products packages filePaths for running codemods from specified dependent package
|
|
9
|
+
*/
|
|
8
10
|
export function findDependentPackagePaths(_x, _x2) {
|
|
9
11
|
return _findDependentPackagePaths.apply(this, arguments);
|
|
10
12
|
}
|
package/dist/esm/main.js
CHANGED
|
@@ -7,17 +7,17 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
-
import chalk from 'chalk';
|
|
11
10
|
import fs from 'fs';
|
|
12
|
-
import
|
|
11
|
+
import chalk from 'chalk';
|
|
13
12
|
import { AutoComplete } from 'enquirer';
|
|
13
|
+
import spawn from 'projector-spawn';
|
|
14
14
|
import semver from 'semver';
|
|
15
15
|
var jscodeshift = require.resolve('.bin/jscodeshift');
|
|
16
|
-
import { fixLineEnding } from './utils';
|
|
17
|
-
import { getTransforms, getTransformPath, hasTransform, parseTransformPath, getTransformModule } from './transforms';
|
|
18
|
-
import { ValidationError, NoTransformsExistError } from './types';
|
|
19
|
-
import { getPackagesSinceRef } from './sinceRef';
|
|
20
16
|
import { findDependentPackagePaths } from './filepath';
|
|
17
|
+
import { getPackagesSinceRef } from './sinceRef';
|
|
18
|
+
import { getTransformModule, getTransformPath, getTransforms, hasTransform, parseTransformPath } from './transforms';
|
|
19
|
+
import { NoTransformsExistError, ValidationError } from './types';
|
|
20
|
+
import { fixLineEnding } from './utils';
|
|
21
21
|
var applyTransformMeta = function applyTransformMeta(transforms) {
|
|
22
22
|
return transforms.map(function (transform) {
|
|
23
23
|
var moduleMatch = transform.dir.match(/\/@atlaskit\/[^\/]+\//);
|
|
@@ -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.27.
|
|
301
|
+
_process$env$_PACKAGE = "0.27.2", _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) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/fs/filename-pattern-match */
|
|
2
|
-
|
|
3
|
-
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
4
2
|
import { getImportDeclaration } from '@hypermod/utils';
|
|
5
|
-
import {
|
|
3
|
+
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
6
4
|
import { genericUnsupportedMigrationComment, spreadPropsComment, stylePropComment } from '../utils/comments';
|
|
5
|
+
import { LINK_ENTRY_POINT, LINK_EXPORT_NAME, PRINT_SETTINGS, UNSUPPORTED_STYLE_PROPS } from '../utils/constants';
|
|
7
6
|
import { findJSXAttributeWithValue } from '../utils/find-attribute-with-value';
|
|
8
7
|
export default function transformer(file, api) {
|
|
9
8
|
var j = api.jscodeshift;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getImportDeclaration, hasJSXAttributes } from '@hypermod/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { NEW_BUTTON_ENTRY_POINT, PRINT_SETTINGS, UNSAFE_SIZE_PROPS_MAP } from '../utils/constants';
|
|
3
3
|
function transformer(file, api) {
|
|
4
4
|
var j = api.jscodeshift;
|
|
5
5
|
var source = j(file.source);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { PRINT_SETTINGS, entryPointsMapping, BUTTON_TYPES, NEW_BUTTON_ENTRY_POINT } from '../utils/constants';
|
|
3
|
-
import renameElements from '../utils/rename-elements';
|
|
4
2
|
import { getDefaultImportSpecifierName } from '@hypermod/utils';
|
|
3
|
+
import { BUTTON_TYPES, entryPointsMapping, NEW_BUTTON_ENTRY_POINT, PRINT_SETTINGS } from '../utils/constants';
|
|
4
|
+
import renameElements from '../utils/rename-elements';
|
|
5
5
|
var transformer = function transformer(file, api) {
|
|
6
6
|
var j = api.jscodeshift;
|
|
7
7
|
var fileSource = j(file.source);
|
|
@@ -3,10 +3,10 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import
|
|
6
|
+
import migrateLinkButtonToLinkTransformer from './codemods/next-migrate-link-button-to-link';
|
|
7
7
|
import migrateToNewButtonVariantsTransformer from './codemods/next-migrate-to-new-button-variants';
|
|
8
8
|
import removeUnsafeSizeTransformer from './codemods/next-remove-unsafe-size';
|
|
9
|
-
import
|
|
9
|
+
import splitImportsTransformer from './codemods/next-split-imports';
|
|
10
10
|
export default function transformer(_x, _x2) {
|
|
11
11
|
return _transformer.apply(this, arguments);
|
|
12
12
|
}
|
package/dist/esm/presets/migrate-to-new-buttons/utils/add-comment-for-custom-theme-buttons.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
2
|
-
import { entryPointsMapping, customThemeButtonComment } from './constants';
|
|
3
2
|
import { addCommentForOverlayProp } from './add-comment-for-overlay-prop';
|
|
3
|
+
import { customThemeButtonComment, entryPointsMapping } from './constants';
|
|
4
4
|
export var addCommentForCustomThemeButtons = function addCommentForCustomThemeButtons(fileSource, j) {
|
|
5
5
|
var _fileSource$find$filt;
|
|
6
6
|
var customThemeButtonImportName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addCommentBefore } from '@atlaskit/codemod-utils';
|
|
2
2
|
import { getIconAttributes, getIconElement } from '../utils/generate-new-button-element';
|
|
3
|
-
import {
|
|
3
|
+
import { migrateFitContainerButtonToDefaultButtonComment, migrateFitContainerButtonToIconButtonComment, NEW_BUTTON_VARIANTS } from './constants';
|
|
4
4
|
export var migrateFitContainerIconButton = function migrateFitContainerIconButton(element, j) {
|
|
5
5
|
var _iconElement$openingE, _labelAttribute$value;
|
|
6
6
|
var attributes = element.value.openingElement.attributes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getImportDeclaration, hasImportDeclaration, insertImportSpecifier } from '@codeshift/utils';
|
|
2
2
|
import { colorReplacements } from './utils/replacements';
|
|
3
3
|
function isDecendantOfType(j, path, type) {
|
|
4
4
|
return j(path).closest(type).length > 0;
|
|
@@ -4,13 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
5
5
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
-
import {
|
|
7
|
+
import { updateAutoScroll } from './transformers/auto-scroll';
|
|
8
|
+
import { shiftCanMonitorArgType } from './transformers/element-adapter-types';
|
|
8
9
|
import { moveFromFileAdapterToExternalAdapter } from './transformers/external-adapter';
|
|
9
10
|
import { moveToReactDropIndicator } from './transformers/move-to-react-drop-indicator';
|
|
10
|
-
import { updateAutoScroll } from './transformers/auto-scroll';
|
|
11
11
|
import { shiftToPointerOutsideOfPreview } from './transformers/pointer-outside-of-preview';
|
|
12
12
|
import { shiftToPreventUnhandled } from './transformers/prevent-unhandled';
|
|
13
|
-
import {
|
|
13
|
+
import { updateSafeImports } from './transformers/update-safe-imports';
|
|
14
14
|
var transformers = [updateSafeImports, moveFromFileAdapterToExternalAdapter, moveToReactDropIndicator, updateAutoScroll, shiftToPointerOutsideOfPreview, shiftToPreventUnhandled, shiftCanMonitorArgType];
|
|
15
15
|
export default function transformer(file, api) {
|
|
16
16
|
var source = file.source;
|
package/dist/esm/sinceRef.js
CHANGED
|
@@ -16,7 +16,8 @@ var parseDiffLine = function parseDiffLine(line) {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Returns packages that have been upgraded in package.json since ref. The version refers to their previous
|
|
20
21
|
* version
|
|
21
22
|
*/
|
|
22
23
|
export var getPackagesSinceRef = /*#__PURE__*/function () {
|
package/dist/esm/transforms.js
CHANGED
|
@@ -13,7 +13,9 @@ export var hasTransform = function hasTransform(transformPath) {
|
|
|
13
13
|
return globSync(transformPath).length > 0;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves transforms for `packages` if provided, otherwise all transforms including presets
|
|
18
|
+
*/
|
|
17
19
|
export var getTransforms = function getTransforms(packages) {
|
|
18
20
|
var transforms = [path.join(basePath(packages), '*.@(ts|tsx|js)'), path.join(basePath(packages), '*', 'index.@(ts|tsx|js)')];
|
|
19
21
|
if (!packages) {
|
package/dist/esm/types.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
7
|
-
function
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Converts required args to optional if they have a default
|
|
10
11
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
export var ValidationError = /*#__PURE__*/function (_Error) {
|
|
14
|
-
_inherits(ValidationError, _Error);
|
|
15
|
-
var _super = _createSuper(ValidationError);
|
|
16
15
|
function ValidationError() {
|
|
17
16
|
_classCallCheck(this, ValidationError);
|
|
18
|
-
return
|
|
17
|
+
return _callSuper(this, ValidationError, arguments);
|
|
19
18
|
}
|
|
19
|
+
_inherits(ValidationError, _Error);
|
|
20
20
|
return _createClass(ValidationError);
|
|
21
21
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
22
22
|
export var NoTransformsExistError = /*#__PURE__*/function (_Error2) {
|
|
23
|
-
_inherits(NoTransformsExistError, _Error2);
|
|
24
|
-
var _super2 = _createSuper(NoTransformsExistError);
|
|
25
23
|
function NoTransformsExistError() {
|
|
26
24
|
_classCallCheck(this, NoTransformsExistError);
|
|
27
|
-
return
|
|
25
|
+
return _callSuper(this, NoTransformsExistError, arguments);
|
|
28
26
|
}
|
|
27
|
+
_inherits(NoTransformsExistError, _Error2);
|
|
29
28
|
return _createClass(NoTransformsExistError);
|
|
30
29
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
package/dist/types/filepath.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Return products packages filePaths for running codemods from specified dependent package
|
|
3
|
+
*/
|
|
2
4
|
export declare function findDependentPackagePaths(crawlPaths: string[], dependencyPackage: string): Promise<string[]>;
|
package/dist/types/main.d.ts
CHANGED
package/dist/types/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Collection, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, JSCodeshift } from 'jscodeshift';
|
|
2
2
|
export declare const importTypesFromNewEntryPoint: (buttonImports: Collection<ImportDeclaration>, specifiers: (ImportDefaultSpecifier | ImportSpecifier)[], j: JSCodeshift, fileSource: Collection<any>) => (ImportDefaultSpecifier | ImportSpecifier)[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type API, type ASTPath, type JSXElement, type JSXExpressionContainer } from 'jscodeshift';
|
|
2
2
|
declare const moveIcon: (j: API['jscodeshift'], path: ASTPath<JSXElement>, iconNode: JSXExpressionContainer | undefined | null, beforeOrAfter: 'iconBefore' | 'iconAfter') => void;
|
|
3
3
|
export default moveIcon;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type API, type FileInfo } from 'jscodeshift';
|
|
2
2
|
export default function transformer(file: FileInfo, api: API): string;
|
package/dist/types/sinceRef.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ParsedPkg } from './types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Returns packages that have been upgraded in package.json since ref. The version refers to their previous
|
|
3
4
|
* version
|
|
4
5
|
*/
|
|
5
6
|
export declare const getPackagesSinceRef: (ref: string) => Promise<ParsedPkg[]>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import path, { type ParsedPath } from 'path';
|
|
3
3
|
import { type ParsedPkg } from './types';
|
|
4
4
|
export declare const hasTransform: (transformPath: string) => boolean;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves transforms for `packages` if provided, otherwise all transforms including presets
|
|
7
|
+
*/
|
|
6
8
|
export declare const getTransforms: (packages?: ParsedPkg[]) => ParsedPath[];
|
|
7
9
|
export declare const parseTransformPath: (transformPath: string) => path.ParsedPath;
|
|
8
10
|
export declare const getTransformPath: ({ dir, base }: ParsedPath) => string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type API, type FileInfo, type Options } from 'jscodeshift';
|
|
2
2
|
export type Transform = (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string;
|
|
3
3
|
export type CliFlags = {
|
|
4
4
|
/**
|
|
@@ -48,7 +48,8 @@ export type ParsedPkg = {
|
|
|
48
48
|
name: string;
|
|
49
49
|
version: string | null;
|
|
50
50
|
};
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Converts required args to optional if they have a default
|
|
52
53
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
53
54
|
*/
|
|
54
55
|
export type Default<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Return products packages filePaths for running codemods from specified dependent package
|
|
3
|
+
*/
|
|
2
4
|
export declare function findDependentPackagePaths(crawlPaths: string[], dependencyPackage: string): Promise<string[]>;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Collection, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, JSCodeshift } from 'jscodeshift';
|
|
2
2
|
export declare const importTypesFromNewEntryPoint: (buttonImports: Collection<ImportDeclaration>, specifiers: (ImportDefaultSpecifier | ImportSpecifier)[], j: JSCodeshift, fileSource: Collection<any>) => (ImportDefaultSpecifier | ImportSpecifier)[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type API, type ASTPath, type JSXElement, type JSXExpressionContainer } from 'jscodeshift';
|
|
2
2
|
declare const moveIcon: (j: API['jscodeshift'], path: ASTPath<JSXElement>, iconNode: JSXExpressionContainer | undefined | null, beforeOrAfter: 'iconBefore' | 'iconAfter') => void;
|
|
3
3
|
export default moveIcon;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type API, type FileInfo } from 'jscodeshift';
|
|
2
2
|
export default function transformer(file: FileInfo, api: API): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ParsedPkg } from './types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Returns packages that have been upgraded in package.json since ref. The version refers to their previous
|
|
3
4
|
* version
|
|
4
5
|
*/
|
|
5
6
|
export declare const getPackagesSinceRef: (ref: string) => Promise<ParsedPkg[]>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import path, { type ParsedPath } from 'path';
|
|
3
3
|
import { type ParsedPkg } from './types';
|
|
4
4
|
export declare const hasTransform: (transformPath: string) => boolean;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves transforms for `packages` if provided, otherwise all transforms including presets
|
|
7
|
+
*/
|
|
6
8
|
export declare const getTransforms: (packages?: ParsedPkg[]) => ParsedPath[];
|
|
7
9
|
export declare const parseTransformPath: (transformPath: string) => path.ParsedPath;
|
|
8
10
|
export declare const getTransformPath: ({ dir, base }: ParsedPath) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type API, type FileInfo, type Options } from 'jscodeshift';
|
|
2
2
|
export type Transform = (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string;
|
|
3
3
|
export type CliFlags = {
|
|
4
4
|
/**
|
|
@@ -48,7 +48,8 @@ export type ParsedPkg = {
|
|
|
48
48
|
name: string;
|
|
49
49
|
version: string | null;
|
|
50
50
|
};
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Converts required args to optional if they have a default
|
|
52
53
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
53
54
|
*/
|
|
54
55
|
export type Default<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/codemod-cli",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.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/"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"bin": "./bin/codemod-cli.js",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
42
|
-
"@atlaskit/tokens": "^2.
|
|
42
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@codeshift/utils": "^0.2.4",
|
|
45
45
|
"@hypermod/utils": "^0.4.2",
|