@vkontakte/vkui-codemods 1.0.0 → 1.0.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/README.md CHANGED
@@ -34,7 +34,7 @@ Options:
34
34
  -V, --version output the version number
35
35
  -l --list list available codemods
36
36
  --all apply all available codemods
37
- -tv --transforms-version <transformsVersion> vkui major version transforms (available versions: "6", "7")
37
+ --tv, --transforms-version <transformsVersion> vkui major version transforms (available versions: "6", "7")
38
38
  -p --path [paths...] file paths where codemods need to apply (space separated list), default: current
39
39
  directory
40
40
  --input-file <file> apply codemods only to file/directory listed in the file
@@ -48,9 +48,9 @@ Options:
48
48
  -h, --help display help for command
49
49
  ```
50
50
 
51
- ### `-tv (--transforms-version)`
51
+ ### `--tv (--transforms-version)`
52
52
 
53
- Если приложение запустить без опции `-tv (--transforms-version)`, скрипт попытается автоматически определить версию, на которую необходимо мигрировать. Если этого сделать не удалось - нужно будет выбрать версию из предложенного списка.
53
+ Если приложение запустить без опции `--tv (--transforms-version)`, скрипт попытается автоматически определить версию, на которую необходимо мигрировать. Если этого сделать не удалось - нужно будет выбрать версию из предложенного списка.
54
54
 
55
55
  ### `--all`
56
56
 
@@ -109,5 +109,5 @@ npx @vkontakte/vkui-codemods --path src/App.tsx src/Main.tsx --all
109
109
  Следующий скрипт запустит миграции компонентов `Flex` и `Separator` при обновлении на версию VKUI v7 в текущей директории:
110
110
 
111
111
  ```shell
112
- npx @vkontakte/vkui-codemods flex separator -tv 7
112
+ npx @vkontakte/vkui-codemods flex separator --tv 7
113
113
  ```
package/dist/cli.js CHANGED
@@ -106,7 +106,7 @@ var runCli = function () { return __awaiter(void 0, void 0, void 0, function ()
106
106
  .usage("".concat(chalk_1.default.green('[codemod-names...]')))
107
107
  .option('-l --list', 'list available codemods')
108
108
  .option('--all', 'apply all available codemods')
109
- .option('-tv --transforms-version <transformsVersion>', 'vkui major version transforms (available versions: "6", "7")')
109
+ .option('--tv, --transforms-version <transformsVersion>', 'vkui major version transforms (available versions: "6", "7")')
110
110
  .option('-p --path [paths...]', 'file paths where codemods need to apply (space separated list), default: current directory')
111
111
  .option('--input-file <file>', 'apply codemods only to file/directory listed in the file')
112
112
  .option('--log-file <file>', 'log migration instructions with required manual changes to the file instead of the console')
@@ -115,7 +115,7 @@ var removeProps = function (j, api, source, componentName, propsNames, createRep
115
115
  if (attr.type === 'JSXSpreadAttribute') {
116
116
  needToShowReport = true;
117
117
  }
118
- return false;
118
+ return true;
119
119
  });
120
120
  path.node.openingElement.attributes = newAttributes;
121
121
  });
@@ -17,7 +17,8 @@ function transformer(file, api, options) {
17
17
  .filter(function (path) { return path.node.source.value === alias; })
18
18
  .find(j.ImportSpecifier)
19
19
  .forEach(function (path) {
20
- if (['withInsets', 'useInsets', 'PromoBanner', 'getPlatformClassName'].includes(path.value.imported.name)) {
20
+ if (typeof path.value.imported.name === 'string' &&
21
+ ['withInsets', 'useInsets', 'PromoBanner', 'getPlatformClassName'].includes(path.value.imported.name)) {
21
22
  (0, report_1.report)(api, ": import of ".concat(chalk_1.default.white.bgBlue(path.value.imported.name), " are forbidden."));
22
23
  }
23
24
  });
@@ -30,7 +30,9 @@ function transformer(file, api, options) {
30
30
  .filter(function (path) { return path.node.source.value === alias; })
31
31
  .find(j.ImportSpecifier, { imported: { name: 'Slider' } });
32
32
  componentImport.forEach(function (path) {
33
- if (path.node.local && path.node.local.name !== path.node.imported.name) {
33
+ if (path.node.local &&
34
+ path.node.local.name !== path.node.imported.name &&
35
+ typeof path.node.local.name === 'string') {
34
36
  localImportName = path.node.local.name;
35
37
  needRename = false;
36
38
  }
@@ -28,7 +28,9 @@ function transformer(file, api, options) {
28
28
  return source.toSource();
29
29
  }
30
30
  componentImport.forEach(function (path) {
31
- if (path.node.local && path.node.local.name !== path.node.imported.name) {
31
+ if (path.node.local &&
32
+ path.node.local.name !== path.node.imported.name &&
33
+ typeof path.node.local.name === 'string') {
32
34
  localImportName = path.node.local.name;
33
35
  needRename = false;
34
36
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@vkontakte/vkui-codemods",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Codemods for automatic VKUI major version upgrade",
5
5
  "repository": "https://github.com/VKCOM/VKUI",
6
- "homepage": "https://vkcom.github.io/VKUI/",
6
+ "homepage": "https://vkui.io/",
7
7
  "license": "MIT",
8
8
  "bin": "./dist/index.js",
9
9
  "files": [
@@ -15,22 +15,21 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "chalk": "^4.1.2",
18
- "commander": "^12.1.0",
18
+ "commander": "^14.0.0",
19
19
  "cross-spawn": "^7.0.5",
20
- "jscodeshift": "^17.1.1",
20
+ "jscodeshift": "^17.3.0",
21
21
  "prompts": "^2.4.2",
22
- "typescript": "^5.7.2"
22
+ "typescript": "^5.9.2"
23
23
  },
24
24
  "devDependencies": {
25
- "@swc/core": "^1.9.3",
26
- "@swc/jest": "^0.2.37",
25
+ "@swc/core": "^1.13.3",
26
+ "@swc/jest": "^0.2.39",
27
27
  "@types/cross-spawn": "^6.0.6",
28
- "@types/jest": "^29.5.14",
29
- "@types/jscodeshift": "^0.12.0",
30
- "@types/node": "^22.10.1",
28
+ "@types/jest": "^30.0.0",
29
+ "@types/jscodeshift": "^17.3.0",
30
+ "@types/node": "^24.2.1",
31
31
  "@types/prompts": "^2.4.9",
32
- "jest": "^29.7.0",
33
- "ts-node": "^10.9.2"
32
+ "jest": "^30.0.5"
34
33
  },
35
34
  "scripts": {
36
35
  "prepack": "yarn run build",