@vkontakte/vkui-codemods 0.0.7-alpha.0 → 0.0.7

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/README.md CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  > Пока для перевода доступны только `Typescript`-файлы (_.ts/_.tsx)
10
10
 
11
+ > Из-за особенностей работы `jscodeshift` после применения миграции у вас могут появиться лишние скобки вокруг `JSX`-элементов, пожалуйста, запустите `prettier`, чтобы отформатировать код в соответствии с вашими настройками.
12
+
11
13
  Перейдите в директорию с исходниками вашего проекта (обычно это `src/`) и запустите следующую команду:
12
14
 
13
15
  ```shell
package/dist/index.js CHANGED
@@ -183,7 +183,7 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
183
183
  });
184
184
  _b.label = 6;
185
185
  case 6:
186
- logger_js_1.default.info("\n All done! Please check if everything is applied correctly. \n If it's not the case - feel free to contact VKUI Team. \n Happy coding with ".concat(chalk_1.default.green.bold('v6'), "!"));
186
+ logger_js_1.default.info("\n All done! Please check that everything is applied correctly. \n If it's not the case - feel free to contact VKUI Team. \n Do not forget to run ".concat(chalk_1.default.cyan.bold('prettier'), " to eliminate unwanted code formatting after applying migrations. \n Happy coding with ").concat(chalk_1.default.green.bold('v6'), "!"));
187
187
  return [2 /*return*/];
188
188
  }
189
189
  });
@@ -5,11 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.defineSnapshotTestFromFixture = exports.getTestFixturesInputPath = exports.applyTransform = void 0;
7
7
  /**
8
- * Adopted version of https://github.com/facebook/jscodeshift/blob/v0.15.0/src/testUtils.js
9
- * TODO [jscodeshift@>0.13.0]: Remove it
10
- * More info - PR #6254
8
+ * Файл для упрощенной работы с дефолтными функциями запуска `jscodeshift`
11
9
  */
12
- var fs_1 = __importDefault(require("fs"));
13
10
  var path_1 = __importDefault(require("path"));
14
11
  var testUtils_1 = require("jscodeshift/dist/testUtils");
15
12
  Object.defineProperty(exports, "applyTransform", { enumerable: true, get: function () { return testUtils_1.applyTransform; } });
@@ -20,14 +17,12 @@ function getTestFixturesInputPath(dirName, testFilePrefix, extension) {
20
17
  }
21
18
  exports.getTestFixturesInputPath = getTestFixturesInputPath;
22
19
  /**
23
- * Handles file-loading boilerplates, using same defaults as defineTest
20
+ * У оригинального defineSnapshotTestFromFixture нет типов
21
+ * Избавляемся от необходимости в тестах постоянно указывать `module`
24
22
  */
25
- function defineSnapshotTestFromFixture(dirName, transformName, options, testFilePrefix, extension) {
26
- if (extension === void 0) { extension = 'tsx'; }
23
+ function defineSnapshotTestFromFixture(dirName, transformName, options, testFilePrefix) {
27
24
  // Assumes transform is one level up from __tests__ directory
28
25
  var module = require(path_1.default.join(dirName, '..', transformName));
29
- var inputPath = getTestFixturesInputPath(dirName, testFilePrefix, extension);
30
- var source = fs_1.default.readFileSync(inputPath, 'utf8');
31
- (0, testUtils_1.defineSnapshotTest)(module, options, source, 'transforms correctly');
26
+ (0, testUtils_1.defineSnapshotTestFromFixture)(dirName, module, options, testFilePrefix, 'transforms correctly', { parser: 'tsx' });
32
27
  }
33
28
  exports.defineSnapshotTestFromFixture = defineSnapshotTestFromFixture;
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parser = void 0;
6
7
  var chalk_1 = __importDefault(require("chalk"));
7
8
  var codemod_helpers_1 = require("../codemod-helpers");
8
9
  var report_1 = require("../report");
10
+ exports.parser = 'tsx';
9
11
  function transformer(file, api, options) {
10
12
  var alias = options.alias;
11
13
  var j = api.jscodeshift;
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parser = void 0;
6
7
  var chalk_1 = __importDefault(require("chalk"));
7
8
  var codemod_helpers_1 = require("../codemod-helpers");
8
9
  var report_1 = require("../report");
10
+ exports.parser = 'tsx';
9
11
  function transformer(file, api, options) {
10
12
  var alias = options.alias;
11
13
  var j = api.jscodeshift;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/vkui-codemods",
3
- "version": "0.0.7-alpha.0",
3
+ "version": "0.0.7",
4
4
  "description": "Codemods for automatic VKUI major version upgrade",
5
5
  "repository": "https://github.com/VKCOM/VKUI",
6
6
  "homepage": "https://vkcom.github.io/VKUI/",
@@ -22,12 +22,12 @@
22
22
  "typescript": "^5.4.5"
23
23
  },
24
24
  "devDependencies": {
25
- "@swc/core": "^1.5.24",
25
+ "@swc/core": "^1.6.1",
26
26
  "@swc/jest": "^0.2.36",
27
27
  "@types/cross-spawn": "^6.0.6",
28
28
  "@types/jest": "^29.5.12",
29
29
  "@types/jscodeshift": "^0.11.11",
30
- "@types/node": "^20.14.0",
30
+ "@types/node": "^20.14.2",
31
31
  "@types/prompts": "^2.4.9",
32
32
  "jest": "^29.7.0",
33
33
  "ts-node": "^10.9.2"