@strapi/upgrade 0.0.0-experimental.e3e48deb89bd0a1b6cc69b698696566fa7854a95 → 0.0.0-experimental.e576af447d9f97e89e24c6daa32d8f714376cd5f

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.
Files changed (101) hide show
  1. package/LICENSE +19 -4
  2. package/README.md +1 -1
  3. package/dist/chunks/logger-DGi224NW.js +1649 -0
  4. package/dist/chunks/logger-DGi224NW.js.map +1 -0
  5. package/dist/chunks/logger-np_r7rTc.mjs +1599 -0
  6. package/dist/chunks/logger-np_r7rTc.mjs.map +1 -0
  7. package/dist/cli.js +212 -6
  8. package/dist/cli.js.map +1 -1
  9. package/dist/cli.mjs +211 -0
  10. package/dist/cli.mjs.map +1 -0
  11. package/dist/index.js +133 -1172
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +131 -1165
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/modules/codemod/codemod.d.ts +4 -2
  16. package/dist/modules/codemod/codemod.d.ts.map +1 -1
  17. package/dist/modules/codemod/types.d.ts +8 -1
  18. package/dist/modules/codemod/types.d.ts.map +1 -1
  19. package/dist/modules/codemod-repository/repository.d.ts +6 -5
  20. package/dist/modules/codemod-repository/repository.d.ts.map +1 -1
  21. package/dist/modules/codemod-repository/types.d.ts +7 -3
  22. package/dist/modules/codemod-repository/types.d.ts.map +1 -1
  23. package/dist/modules/codemod-runner/codemod-runner.d.ts +3 -0
  24. package/dist/modules/codemod-runner/codemod-runner.d.ts.map +1 -1
  25. package/dist/modules/codemod-runner/index.d.ts +1 -0
  26. package/dist/modules/codemod-runner/index.d.ts.map +1 -1
  27. package/dist/modules/codemod-runner/types.d.ts +1 -0
  28. package/dist/modules/codemod-runner/types.d.ts.map +1 -1
  29. package/dist/modules/error/utils.d.ts +8 -0
  30. package/dist/modules/error/utils.d.ts.map +1 -1
  31. package/dist/modules/file-scanner/scanner.d.ts.map +1 -1
  32. package/dist/modules/format/formats.d.ts +6 -0
  33. package/dist/modules/format/formats.d.ts.map +1 -1
  34. package/dist/modules/project/constants.d.ts +6 -3
  35. package/dist/modules/project/constants.d.ts.map +1 -1
  36. package/dist/modules/project/index.d.ts +2 -0
  37. package/dist/modules/project/index.d.ts.map +1 -1
  38. package/dist/modules/project/project.d.ts +27 -5
  39. package/dist/modules/project/project.d.ts.map +1 -1
  40. package/dist/modules/project/types.d.ts +3 -10
  41. package/dist/modules/project/types.d.ts.map +1 -1
  42. package/dist/modules/project/utils.d.ts +6 -0
  43. package/dist/modules/project/utils.d.ts.map +1 -0
  44. package/dist/modules/report/report.d.ts.map +1 -1
  45. package/dist/modules/requirement/types.d.ts +2 -2
  46. package/dist/modules/requirement/types.d.ts.map +1 -1
  47. package/dist/modules/runner/json/transform.d.ts.map +1 -1
  48. package/dist/modules/upgrader/types.d.ts +6 -0
  49. package/dist/modules/upgrader/types.d.ts.map +1 -1
  50. package/dist/modules/upgrader/upgrader.d.ts +7 -3
  51. package/dist/modules/upgrader/upgrader.d.ts.map +1 -1
  52. package/dist/modules/version/range.d.ts +2 -0
  53. package/dist/modules/version/range.d.ts.map +1 -1
  54. package/dist/modules/version/types.d.ts +2 -1
  55. package/dist/modules/version/types.d.ts.map +1 -1
  56. package/dist/tasks/codemods/index.d.ts +2 -1
  57. package/dist/tasks/codemods/index.d.ts.map +1 -1
  58. package/dist/tasks/codemods/list-codemods.d.ts +3 -0
  59. package/dist/tasks/codemods/list-codemods.d.ts.map +1 -0
  60. package/dist/tasks/codemods/run-codemods.d.ts +3 -0
  61. package/dist/tasks/codemods/run-codemods.d.ts.map +1 -0
  62. package/dist/tasks/codemods/types.d.ts +9 -3
  63. package/dist/tasks/codemods/types.d.ts.map +1 -1
  64. package/dist/tasks/codemods/utils.d.ts +6 -0
  65. package/dist/tasks/codemods/utils.d.ts.map +1 -0
  66. package/dist/tasks/index.d.ts +1 -1
  67. package/dist/tasks/index.d.ts.map +1 -1
  68. package/dist/tasks/upgrade/prompts/index.d.ts +2 -0
  69. package/dist/tasks/upgrade/prompts/index.d.ts.map +1 -0
  70. package/dist/tasks/upgrade/prompts/latest.d.ts +9 -0
  71. package/dist/tasks/upgrade/prompts/latest.d.ts.map +1 -0
  72. package/dist/tasks/upgrade/requirements/major.d.ts.map +1 -1
  73. package/dist/tasks/upgrade/upgrade.d.ts.map +1 -1
  74. package/package.json +16 -15
  75. package/resources/codemods/5.0.0/comment-out-lifecycle-files.code.ts +63 -0
  76. package/resources/codemods/5.0.0/dependency-remove-strapi-plugin-i18n.json.ts +31 -0
  77. package/resources/codemods/5.0.0/dependency-upgrade-react-and-react-dom.json.ts +67 -0
  78. package/resources/codemods/5.0.0/dependency-upgrade-react-router-dom.json.ts +59 -0
  79. package/resources/codemods/5.0.0/dependency-upgrade-styled-components.json.ts +49 -0
  80. package/resources/codemods/5.0.0/deprecate-helper-plugin.code.ts +192 -0
  81. package/resources/codemods/5.0.0/entity-service-document-service.code.ts +437 -0
  82. package/resources/codemods/5.0.0/s3-keys-wrapped-in-credentials.code.ts +1 -1
  83. package/resources/codemods/5.0.0/sqlite3-to-better-sqlite3.json.ts +5 -3
  84. package/resources/codemods/5.0.0/strapi-public-interface.code.ts +126 -0
  85. package/resources/codemods/5.0.0/use-uid-for-config-namespace.code.ts +1 -1
  86. package/resources/codemods/5.0.0/utils-public-interface.code.ts +320 -0
  87. package/resources/codemods/5.1.0/dependency-better-sqlite3.json.ts +48 -0
  88. package/resources/examples/console.log-to-console.info.code.ts +1 -1
  89. package/resources/examples/disable-jsx-buttons.code.ts +42 -0
  90. package/resources/utils/change-import.ts +118 -0
  91. package/resources/utils/replace-jsx.ts +49 -0
  92. package/dist/_chunks/codemod-runner-B5OeSMTQ.js +0 -730
  93. package/dist/_chunks/codemod-runner-B5OeSMTQ.js.map +0 -1
  94. package/dist/_chunks/codemods-10ZKewQx.js +0 -108
  95. package/dist/_chunks/codemods-10ZKewQx.js.map +0 -1
  96. package/dist/_chunks/index-uxCwtuH1.js +0 -103
  97. package/dist/_chunks/index-uxCwtuH1.js.map +0 -1
  98. package/dist/_chunks/upgrade-A4T1OWs5.js +0 -357
  99. package/dist/_chunks/upgrade-A4T1OWs5.js.map +0 -1
  100. package/dist/tasks/codemods/codemods.d.ts +0 -3
  101. package/dist/tasks/codemods/codemods.d.ts.map +0 -1
@@ -0,0 +1,49 @@
1
+ import type { JSCodeshift, Collection } from 'jscodeshift';
2
+
3
+ export const replaceJSXElement = (
4
+ root: Collection,
5
+ j: JSCodeshift,
6
+ {
7
+ oldElementName,
8
+ newElementName,
9
+ oldDependency,
10
+ }: {
11
+ oldElementName: string;
12
+ newElementName: string;
13
+ oldDependency: string;
14
+ }
15
+ ) => {
16
+ // Find the import declaration for the old dependency
17
+ const importDeclaration = root.find(j.ImportDeclaration, {
18
+ source: { value: oldDependency },
19
+ });
20
+
21
+ if (importDeclaration.size() === 0) {
22
+ return;
23
+ }
24
+
25
+ // Get the local name of the imported element
26
+ const localName = importDeclaration
27
+ .find(j.ImportSpecifier, {
28
+ imported: { name: oldElementName },
29
+ })
30
+ .nodes()[0]?.local?.name;
31
+
32
+ if (!localName) {
33
+ return;
34
+ }
35
+
36
+ // Replace JSX elements
37
+ root.findJSXElements(localName).forEach((path) => {
38
+ const openingElement = path.node.openingElement;
39
+ const closingElement = path.node.closingElement;
40
+
41
+ if (j.JSXIdentifier.check(openingElement.name)) {
42
+ openingElement.name.name = newElementName;
43
+ }
44
+
45
+ if (closingElement && j.JSXIdentifier.check(closingElement.name)) {
46
+ closingElement.name.name = newElementName;
47
+ }
48
+ });
49
+ };