@sentry/wizard 3.42.1 → 4.0.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.
Files changed (338) hide show
  1. package/.node-cache/node-v22.14.0-darwin-arm64 +0 -0
  2. package/.node-cache/node-v22.14.0-darwin-x64 +0 -0
  3. package/.node-cache/node-v22.14.0-linux-arm64 +0 -0
  4. package/.node-cache/node-v22.14.0-linux-x64 +0 -0
  5. package/.node-cache/node-v22.14.0-win-x64.exe +0 -0
  6. package/CHANGELOG.md +26 -0
  7. package/COPYING +3575 -0
  8. package/bin.ts +85 -80
  9. package/dist/bin.js +44 -35
  10. package/dist/bin.js.map +1 -1
  11. package/dist/e2e-tests/jest.config.js +1 -1
  12. package/dist/e2e-tests/jest.config.js.map +1 -1
  13. package/dist/e2e-tests/tests/flutter.test.js +62 -147
  14. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  15. package/dist/e2e-tests/tests/nextjs.test.js +77 -175
  16. package/dist/e2e-tests/tests/nextjs.test.js.map +1 -1
  17. package/dist/e2e-tests/tests/nuxt-3.test.js +61 -162
  18. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  19. package/dist/e2e-tests/tests/nuxt-4.test.js +62 -163
  20. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  21. package/dist/e2e-tests/tests/remix.test.js +147 -189
  22. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  23. package/dist/e2e-tests/tests/sveltekit.test.js +133 -187
  24. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  25. package/dist/e2e-tests/utils/index.d.ts +1 -1
  26. package/dist/e2e-tests/utils/index.js +113 -195
  27. package/dist/e2e-tests/utils/index.js.map +1 -1
  28. package/dist/lib/Constants.js +5 -5
  29. package/dist/lib/Constants.js.map +1 -1
  30. package/dist/lib/Helper/BottomBar.d.ts +1 -1
  31. package/dist/lib/Helper/BottomBar.js +14 -15
  32. package/dist/lib/Helper/BottomBar.js.map +1 -1
  33. package/dist/lib/Helper/Env.js +5 -2
  34. package/dist/lib/Helper/Env.js.map +1 -1
  35. package/dist/lib/Helper/File.js +14 -27
  36. package/dist/lib/Helper/File.js.map +1 -1
  37. package/dist/lib/Helper/Git.js +24 -59
  38. package/dist/lib/Helper/Git.js.map +1 -1
  39. package/dist/lib/Helper/Logging.js +2 -2
  40. package/dist/lib/Helper/Logging.js.map +1 -1
  41. package/dist/lib/Helper/MergeConfig.js +4 -4
  42. package/dist/lib/Helper/MergeConfig.js.map +1 -1
  43. package/dist/lib/Helper/Package.d.ts +4 -1
  44. package/dist/lib/Helper/Package.js +12 -38
  45. package/dist/lib/Helper/Package.js.map +1 -1
  46. package/dist/lib/Helper/SentryCli.js +77 -149
  47. package/dist/lib/Helper/SentryCli.js.map +1 -1
  48. package/dist/lib/Helper/Wizard.js +29 -124
  49. package/dist/lib/Helper/Wizard.js.map +1 -1
  50. package/dist/lib/Helper/__tests__/File.js +4 -4
  51. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  52. package/dist/lib/Helper/__tests__/MergeConfig.js +24 -24
  53. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  54. package/dist/lib/Helper/__tests__/SentryCli.js +33 -23
  55. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  56. package/dist/lib/Setup.js +23 -85
  57. package/dist/lib/Setup.js.map +1 -1
  58. package/dist/lib/Steps/BaseStep.js +8 -8
  59. package/dist/lib/Steps/BaseStep.js.map +1 -1
  60. package/dist/lib/Steps/ChooseIntegration.js +80 -125
  61. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  62. package/dist/lib/Steps/ConfigureProject.js +6 -66
  63. package/dist/lib/Steps/ConfigureProject.js.map +1 -1
  64. package/dist/lib/Steps/Initial.js +16 -104
  65. package/dist/lib/Steps/Initial.js.map +1 -1
  66. package/dist/lib/Steps/Integrations/BaseIntegration.js +24 -118
  67. package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
  68. package/dist/lib/Steps/Integrations/Cordova.js +95 -183
  69. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  70. package/dist/lib/Steps/Integrations/Electron.js +87 -145
  71. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  72. package/dist/lib/Steps/Integrations/MobileProject.js +40 -148
  73. package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
  74. package/dist/lib/Steps/OpenSentry.js +63 -126
  75. package/dist/lib/Steps/OpenSentry.js.map +1 -1
  76. package/dist/lib/Steps/PromptForParameters.js +110 -206
  77. package/dist/lib/Steps/PromptForParameters.js.map +1 -1
  78. package/dist/lib/Steps/Result.js +19 -79
  79. package/dist/lib/Steps/Result.js.map +1 -1
  80. package/dist/lib/Steps/SentryProjectSelector.js +57 -148
  81. package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
  82. package/dist/lib/Steps/ShouldConfigure.js +6 -66
  83. package/dist/lib/Steps/ShouldConfigure.js.map +1 -1
  84. package/dist/lib/Steps/WaitForSentry.js +43 -120
  85. package/dist/lib/Steps/WaitForSentry.js.map +1 -1
  86. package/dist/lib/Steps/Welcome.js +17 -76
  87. package/dist/lib/Steps/Welcome.js.map +1 -1
  88. package/dist/lib/__tests__/Env.js +3 -3
  89. package/dist/lib/__tests__/Env.js.map +1 -1
  90. package/dist/src/android/android-wizard.js +100 -176
  91. package/dist/src/android/android-wizard.js.map +1 -1
  92. package/dist/src/android/code-tools.js +24 -33
  93. package/dist/src/android/code-tools.js.map +1 -1
  94. package/dist/src/android/gradle.js +106 -165
  95. package/dist/src/android/gradle.js.map +1 -1
  96. package/dist/src/android/manifest.js +26 -27
  97. package/dist/src/android/manifest.js.map +1 -1
  98. package/dist/src/android/templates.js +76 -23
  99. package/dist/src/android/templates.js.map +1 -1
  100. package/dist/src/apple/apple-wizard.js +129 -225
  101. package/dist/src/apple/apple-wizard.js.map +1 -1
  102. package/dist/src/apple/cocoapod.js +47 -109
  103. package/dist/src/apple/cocoapod.js.map +1 -1
  104. package/dist/src/apple/code-tools.js +32 -35
  105. package/dist/src/apple/code-tools.js.map +1 -1
  106. package/dist/src/apple/fastlane.js +51 -97
  107. package/dist/src/apple/fastlane.js.map +1 -1
  108. package/dist/src/apple/templates.js +41 -5
  109. package/dist/src/apple/templates.js.map +1 -1
  110. package/dist/src/apple/xcode-manager.d.ts +2 -2
  111. package/dist/src/apple/xcode-manager.js +93 -108
  112. package/dist/src/apple/xcode-manager.js.map +1 -1
  113. package/dist/src/flutter/code-tools.js +79 -127
  114. package/dist/src/flutter/code-tools.js.map +1 -1
  115. package/dist/src/flutter/flutter-wizard.js +75 -136
  116. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  117. package/dist/src/flutter/templates.js +48 -12
  118. package/dist/src/flutter/templates.js.map +1 -1
  119. package/dist/src/nextjs/nextjs-wizard.js +527 -805
  120. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  121. package/dist/src/nextjs/templates.js +380 -40
  122. package/dist/src/nextjs/templates.js.map +1 -1
  123. package/dist/src/nextjs/utils.js +5 -5
  124. package/dist/src/nextjs/utils.js.map +1 -1
  125. package/dist/src/nuxt/nuxt-wizard.js +91 -188
  126. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  127. package/dist/src/nuxt/sdk-example.js +68 -137
  128. package/dist/src/nuxt/sdk-example.js.map +1 -1
  129. package/dist/src/nuxt/sdk-setup.d.ts +4 -4
  130. package/dist/src/nuxt/sdk-setup.js +180 -336
  131. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  132. package/dist/src/nuxt/templates.js +195 -18
  133. package/dist/src/nuxt/templates.js.map +1 -1
  134. package/dist/src/nuxt/utils.js +29 -76
  135. package/dist/src/nuxt/utils.js.map +1 -1
  136. package/dist/src/react-native/expo-env-file.js +41 -94
  137. package/dist/src/react-native/expo-env-file.js.map +1 -1
  138. package/dist/src/react-native/expo-metro.d.ts +1 -1
  139. package/dist/src/react-native/expo-metro.js +75 -130
  140. package/dist/src/react-native/expo-metro.js.map +1 -1
  141. package/dist/src/react-native/expo.js +61 -114
  142. package/dist/src/react-native/expo.js.map +1 -1
  143. package/dist/src/react-native/git.js +23 -56
  144. package/dist/src/react-native/git.js.map +1 -1
  145. package/dist/src/react-native/glob.js +3 -3
  146. package/dist/src/react-native/glob.js.map +1 -1
  147. package/dist/src/react-native/gradle.js +4 -4
  148. package/dist/src/react-native/gradle.js.map +1 -1
  149. package/dist/src/react-native/javascript.js +51 -95
  150. package/dist/src/react-native/javascript.js.map +1 -1
  151. package/dist/src/react-native/metro.js +176 -296
  152. package/dist/src/react-native/metro.js.map +1 -1
  153. package/dist/src/react-native/react-native-wizard.js +267 -418
  154. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  155. package/dist/src/react-native/uninstall.js +37 -80
  156. package/dist/src/react-native/uninstall.js.map +1 -1
  157. package/dist/src/react-native/xcode.js +57 -55
  158. package/dist/src/react-native/xcode.js.map +1 -1
  159. package/dist/src/remix/codemods/express-server.js +27 -82
  160. package/dist/src/remix/codemods/express-server.js.map +1 -1
  161. package/dist/src/remix/codemods/handle-error.js +28 -31
  162. package/dist/src/remix/codemods/handle-error.js.map +1 -1
  163. package/dist/src/remix/codemods/root-common.js +11 -11
  164. package/dist/src/remix/codemods/root-common.js.map +1 -1
  165. package/dist/src/remix/codemods/root-v1.js +17 -67
  166. package/dist/src/remix/codemods/root-v1.js.map +1 -1
  167. package/dist/src/remix/codemods/root-v2.js +89 -140
  168. package/dist/src/remix/codemods/root-v2.js.map +1 -1
  169. package/dist/src/remix/remix-wizard.js +181 -343
  170. package/dist/src/remix/remix-wizard.js.map +1 -1
  171. package/dist/src/remix/sdk-example.js +84 -66
  172. package/dist/src/remix/sdk-example.js.map +1 -1
  173. package/dist/src/remix/sdk-setup.js +161 -293
  174. package/dist/src/remix/sdk-setup.js.map +1 -1
  175. package/dist/src/remix/templates.js +10 -2
  176. package/dist/src/remix/templates.js.map +1 -1
  177. package/dist/src/remix/utils.js +13 -14
  178. package/dist/src/remix/utils.js.map +1 -1
  179. package/dist/src/run.js +106 -178
  180. package/dist/src/run.js.map +1 -1
  181. package/dist/src/sourcemaps/sourcemaps-wizard.js +248 -372
  182. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  183. package/dist/src/sourcemaps/tools/angular.js +32 -66
  184. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  185. package/dist/src/sourcemaps/tools/create-react-app.js +14 -59
  186. package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
  187. package/dist/src/sourcemaps/tools/esbuild.js +34 -77
  188. package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
  189. package/dist/src/sourcemaps/tools/nextjs.d.ts +2 -2
  190. package/dist/src/sourcemaps/tools/nextjs.js +75 -102
  191. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
  192. package/dist/src/sourcemaps/tools/remix.js +53 -93
  193. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  194. package/dist/src/sourcemaps/tools/rollup.js +35 -76
  195. package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
  196. package/dist/src/sourcemaps/tools/sentry-cli.js +157 -289
  197. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  198. package/dist/src/sourcemaps/tools/tsc.js +68 -134
  199. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  200. package/dist/src/sourcemaps/tools/vite.js +111 -196
  201. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  202. package/dist/src/sourcemaps/tools/webpack.d.ts +1 -1
  203. package/dist/src/sourcemaps/tools/webpack.js +158 -260
  204. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  205. package/dist/src/sourcemaps/utils/detect-tool.js +9 -54
  206. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  207. package/dist/src/sourcemaps/utils/other-wizards.js +77 -144
  208. package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
  209. package/dist/src/sourcemaps/utils/sdk-version.js +112 -191
  210. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  211. package/dist/src/sveltekit/sdk-example.js +20 -70
  212. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  213. package/dist/src/sveltekit/sdk-setup.js +250 -411
  214. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  215. package/dist/src/sveltekit/sveltekit-wizard.js +107 -191
  216. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  217. package/dist/src/sveltekit/templates.js +147 -13
  218. package/dist/src/sveltekit/templates.js.map +1 -1
  219. package/dist/src/sveltekit/utils.js +3 -3
  220. package/dist/src/sveltekit/utils.js.map +1 -1
  221. package/dist/src/telemetry.d.ts +2 -2
  222. package/dist/src/telemetry.js +58 -108
  223. package/dist/src/telemetry.js.map +1 -1
  224. package/dist/src/utils/ast-utils.js +39 -54
  225. package/dist/src/utils/ast-utils.js.map +1 -1
  226. package/dist/src/utils/bash.js +28 -75
  227. package/dist/src/utils/bash.js.map +1 -1
  228. package/dist/src/utils/clack-utils.d.ts +3 -7
  229. package/dist/src/utils/clack-utils.js +688 -1083
  230. package/dist/src/utils/clack-utils.js.map +1 -1
  231. package/dist/src/utils/debug.js +6 -10
  232. package/dist/src/utils/debug.js.map +1 -1
  233. package/dist/src/utils/package-json.js +5 -6
  234. package/dist/src/utils/package-json.js.map +1 -1
  235. package/dist/src/utils/package-manager.js +65 -139
  236. package/dist/src/utils/package-manager.js.map +1 -1
  237. package/dist/src/utils/release-registry.js +12 -59
  238. package/dist/src/utils/release-registry.js.map +1 -1
  239. package/dist/src/utils/semver.js +3 -4
  240. package/dist/src/utils/semver.js.map +1 -1
  241. package/dist/src/utils/sentrycli-utils.js +4 -4
  242. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  243. package/dist/src/utils/url.js +5 -6
  244. package/dist/src/utils/url.js.map +1 -1
  245. package/dist/test/android/code-tools.test.js +18 -18
  246. package/dist/test/android/code-tools.test.js.map +1 -1
  247. package/dist/test/apple/cocoapod.test.js +154 -299
  248. package/dist/test/apple/cocoapod.test.js.map +1 -1
  249. package/dist/test/apple/code-tools.test.js +375 -263
  250. package/dist/test/apple/code-tools.test.js.map +1 -1
  251. package/dist/test/apple/fastfile.test.js +319 -271
  252. package/dist/test/apple/fastfile.test.js.map +1 -1
  253. package/dist/test/apple/templates.test.js +114 -30
  254. package/dist/test/apple/templates.test.js.map +1 -1
  255. package/dist/test/apple/xcode-manager.test.js +230 -234
  256. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  257. package/dist/test/flutter/code-tools.test.js +119 -48
  258. package/dist/test/flutter/code-tools.test.js.map +1 -1
  259. package/dist/test/flutter/templates.test.js +63 -20
  260. package/dist/test/flutter/templates.test.js.map +1 -1
  261. package/dist/test/nextjs/templates.test.js +332 -43
  262. package/dist/test/nextjs/templates.test.js.map +1 -1
  263. package/dist/test/nuxt/templates.test.js +161 -33
  264. package/dist/test/nuxt/templates.test.js.map +1 -1
  265. package/dist/test/react-native/expo-metro.test.js +61 -15
  266. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  267. package/dist/test/react-native/expo.test.js +37 -17
  268. package/dist/test/react-native/expo.test.js.map +1 -1
  269. package/dist/test/react-native/gradle.test.js +260 -28
  270. package/dist/test/react-native/gradle.test.js.map +1 -1
  271. package/dist/test/react-native/javascript.test.js +85 -19
  272. package/dist/test/react-native/javascript.test.js.map +1 -1
  273. package/dist/test/react-native/metro.test.js +261 -187
  274. package/dist/test/react-native/metro.test.js.map +1 -1
  275. package/dist/test/react-native/xcode.test.js +243 -62
  276. package/dist/test/react-native/xcode.test.js.map +1 -1
  277. package/dist/test/remix/client-entry.test.js +81 -21
  278. package/dist/test/remix/client-entry.test.js.map +1 -1
  279. package/dist/test/remix/server-instrumentation.test.js +21 -8
  280. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  281. package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -72
  282. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  283. package/dist/test/sourcemaps/tools/tsc.test.js +142 -68
  284. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  285. package/dist/test/sourcemaps/tools/vite.test.js +106 -75
  286. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  287. package/dist/test/sourcemaps/tools/webpack.test.js +226 -102
  288. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  289. package/dist/test/sveltekit/templates.test.js +117 -18
  290. package/dist/test/sveltekit/templates.test.js.map +1 -1
  291. package/dist/test/utils/ast-utils.test.js +99 -58
  292. package/dist/test/utils/ast-utils.test.js.map +1 -1
  293. package/dist/test/utils/clack-utils.test.js +142 -247
  294. package/dist/test/utils/clack-utils.test.js.map +1 -1
  295. package/e2e-tests/package.json +1 -1
  296. package/e2e-tests/tests/flutter.test.ts +20 -20
  297. package/e2e-tests/tests/nextjs.test.ts +2 -2
  298. package/e2e-tests/tests/nuxt-3.test.ts +4 -4
  299. package/e2e-tests/tests/nuxt-4.test.ts +3 -3
  300. package/e2e-tests/tests/remix.test.ts +3 -3
  301. package/e2e-tests/tests/sveltekit.test.ts +3 -3
  302. package/e2e-tests/utils/index.ts +33 -15
  303. package/lib/Helper/BottomBar.ts +1 -1
  304. package/lib/Helper/Env.ts +1 -1
  305. package/lib/Helper/Package.ts +12 -10
  306. package/lib/Helper/SentryCli.ts +18 -27
  307. package/lib/Helper/Wizard.ts +1 -2
  308. package/lib/Setup.ts +4 -5
  309. package/lib/Steps/ChooseIntegration.ts +40 -8
  310. package/lib/Steps/Initial.ts +17 -26
  311. package/lib/Steps/Integrations/BaseIntegration.ts +2 -8
  312. package/lib/Steps/Integrations/Cordova.ts +9 -15
  313. package/lib/Steps/Integrations/Electron.ts +23 -20
  314. package/lib/Steps/Integrations/MobileProject.ts +18 -15
  315. package/lib/Steps/OpenSentry.ts +12 -7
  316. package/lib/Steps/PromptForParameters.ts +12 -19
  317. package/lib/Steps/SentryProjectSelector.ts +30 -29
  318. package/lib/Steps/WaitForSentry.ts +29 -23
  319. package/package.json +12 -8
  320. package/src/apple/xcode-manager.ts +10 -10
  321. package/src/nextjs/templates.ts +2 -3
  322. package/src/nuxt/sdk-setup.ts +21 -18
  323. package/src/react-native/expo-metro.ts +2 -2
  324. package/src/react-native/react-native-wizard.ts +1 -2
  325. package/src/react-native/uninstall.ts +1 -2
  326. package/src/react-native/xcode.ts +1 -1
  327. package/src/run.ts +12 -5
  328. package/src/sourcemaps/tools/nextjs.ts +2 -2
  329. package/src/sourcemaps/tools/webpack.ts +3 -3
  330. package/src/telemetry.ts +27 -7
  331. package/src/utils/clack-utils.ts +50 -47
  332. package/test/apple/cocoapod.test.ts +4 -0
  333. package/test/apple/fastfile.test.ts +12 -7
  334. package/test/apple/xcode-manager.test.ts +13 -11
  335. package/test/utils/clack-utils.test.ts +40 -50
  336. package/types/read-env.d.ts +3 -0
  337. package/types/xcode.d.ts +1 -0
  338. package/dist/package.json +0 -128
@@ -1,5 +1,8 @@
1
- import * as path from 'path';
1
+ import * as path from 'node:path';
2
+ import { Integration } from '../../lib/Constants';
2
3
  import {
4
+ KEYS,
5
+ TEST_ARGS,
3
6
  checkEnvBuildPlugin,
4
7
  checkFileContents,
5
8
  checkFileExists,
@@ -7,12 +10,9 @@ import {
7
10
  checkIfRunsOnProdMode,
8
11
  checkPackageJson,
9
12
  cleanupGit,
10
- KEYS,
11
13
  revertLocalChanges,
12
14
  startWizardInstance,
13
- TEST_ARGS,
14
15
  } from '../utils';
15
- import { Integration } from '../../lib/Constants';
16
16
 
17
17
  describe('Nuxt-3', () => {
18
18
  const projectDir = path.resolve(
@@ -1,16 +1,16 @@
1
- import * as path from 'path';
1
+ import * as path from 'node:path';
2
2
  import { Integration } from '../../lib/Constants';
3
3
  import { cleanupGit, revertLocalChanges } from '../utils';
4
4
  import {
5
+ KEYS,
6
+ TEST_ARGS,
5
7
  checkEnvBuildPlugin,
6
8
  checkFileContents,
7
9
  checkFileExists,
8
10
  checkIfBuilds,
9
11
  checkIfRunsOnProdMode,
10
12
  checkPackageJson,
11
- KEYS,
12
13
  startWizardInstance,
13
- TEST_ARGS,
14
14
  } from '../utils';
15
15
 
16
16
  describe('Nuxt-4', () => {
@@ -1,6 +1,9 @@
1
1
  /* eslint-disable jest/expect-expect */
2
+ import * as path from 'node:path';
2
3
  import { Integration } from '../../lib/Constants';
3
4
  import {
5
+ KEYS,
6
+ TEST_ARGS,
4
7
  checkEnvBuildPlugin,
5
8
  checkFileContents,
6
9
  checkFileExists,
@@ -10,13 +13,10 @@ import {
10
13
  checkPackageJson,
11
14
  cleanupGit,
12
15
  createFile,
13
- KEYS,
14
16
  modifyFile,
15
17
  revertLocalChanges,
16
18
  startWizardInstance,
17
- TEST_ARGS,
18
19
  } from '../utils';
19
- import * as path from 'path';
20
20
 
21
21
  const SERVER_TEMPLATE = `import { createRequestHandler } from '@remix-run/express';
22
22
  import { installGlobals } from '@remix-run/node';
@@ -1,6 +1,9 @@
1
1
  /* eslint-disable jest/expect-expect */
2
+ import * as path from 'node:path';
2
3
  import { Integration } from '../../lib/Constants';
3
4
  import {
5
+ KEYS,
6
+ TEST_ARGS,
4
7
  checkEnvBuildPlugin,
5
8
  checkFileContents,
6
9
  checkFileExists,
@@ -10,12 +13,9 @@ import {
10
13
  checkPackageJson,
11
14
  cleanupGit,
12
15
  createFile,
13
- KEYS,
14
16
  revertLocalChanges,
15
17
  startWizardInstance,
16
- TEST_ARGS,
17
18
  } from '../utils';
18
- import * as path from 'path';
19
19
 
20
20
  const SERVER_HOOK_TEMPLATE = `import type { Handle } from '@sveltejs/kit';
21
21
 
@@ -1,9 +1,9 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
3
 
4
4
  import type { Integration } from '../../lib/Constants';
5
- import { spawn, execSync } from 'child_process';
6
- import type { ChildProcess } from 'child_process';
5
+ import { spawn, execSync } from 'node:child_process';
6
+ import type { ChildProcess } from 'node:child_process';
7
7
  import { dim, green, red } from '../../lib/Helper/Logging';
8
8
 
9
9
  export const KEYS = {
@@ -49,13 +49,13 @@ export class WizardTestEnv {
49
49
  this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });
50
50
 
51
51
  if (opts?.debug) {
52
- this.taskHandle.stdout.pipe(process.stdout);
53
- this.taskHandle.stderr.pipe(process.stderr);
52
+ this.taskHandle.stdout?.pipe(process.stdout);
53
+ this.taskHandle.stderr?.pipe(process.stderr);
54
54
  }
55
55
  }
56
56
 
57
57
  sendStdin(input: string) {
58
- this.taskHandle.stdin.write(input);
58
+ this.taskHandle.stdin?.write(input);
59
59
  }
60
60
 
61
61
  /**
@@ -100,9 +100,15 @@ export class WizardTestEnv {
100
100
 
101
101
  return new Promise<boolean>((resolve, reject) => {
102
102
  const timeoutId = setTimeout(() => {
103
+ this.kill();
103
104
  reject(new Error(`Timeout waiting for status code: ${statusCode}`));
104
105
  }, timeout);
105
106
 
107
+ this.taskHandle.on('error', (err: Error) => {
108
+ clearTimeout(timeoutId);
109
+ reject(err);
110
+ });
111
+
106
112
  this.taskHandle.on('exit', (code: number | null) => {
107
113
  clearTimeout(timeoutId);
108
114
  resolve(code === statusCode);
@@ -134,15 +140,25 @@ export class WizardTestEnv {
134
140
  return new Promise<boolean>((resolve, reject) => {
135
141
  let outputBuffer = '';
136
142
  const timeoutId = setTimeout(() => {
143
+ this.kill();
137
144
  if (optional) {
138
145
  // The output is not found but it's optional so we can resolve the promise with false
139
146
  resolve(false);
140
147
  } else {
141
- reject(new Error(`Timeout waiting for output: ${output}`));
148
+ reject(
149
+ new Error(
150
+ `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,
151
+ ),
152
+ );
142
153
  }
143
154
  }, timeout);
144
155
 
145
- this.taskHandle.stdout.on('data', (data) => {
156
+ this.taskHandle.on('error', (err: Error) => {
157
+ clearTimeout(timeoutId);
158
+ reject(err);
159
+ });
160
+
161
+ this.taskHandle.stdout?.on('data', (data) => {
146
162
  outputBuffer += data;
147
163
  if (outputBuffer.includes(output)) {
148
164
  clearTimeout(timeoutId);
@@ -154,9 +170,9 @@ export class WizardTestEnv {
154
170
  }
155
171
 
156
172
  kill() {
157
- this.taskHandle.stdin.destroy();
158
- this.taskHandle.stderr.destroy();
159
- this.taskHandle.stdout.destroy();
173
+ this.taskHandle.stdin?.destroy();
174
+ this.taskHandle.stderr?.destroy();
175
+ this.taskHandle.stdout?.destroy();
160
176
  this.taskHandle.kill('SIGINT');
161
177
  this.taskHandle.unref();
162
178
  }
@@ -230,16 +246,18 @@ export function startWizardInstance(
230
246
  projectDir: string,
231
247
  debug = false,
232
248
  ): WizardTestEnv {
233
- const binPath = path.join(__dirname, '../../dist/bin.js');
249
+ const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN
250
+ ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]
251
+ : ['dist', 'bin.js'];
252
+ const binPath = path.join(__dirname, '..', '..', ...binName);
234
253
 
235
254
  revertLocalChanges(projectDir);
236
255
  cleanupGit(projectDir);
237
256
  initGit(projectDir);
238
257
 
239
258
  return new WizardTestEnv(
240
- 'node',
259
+ binPath,
241
260
  [
242
- binPath,
243
261
  '--debug',
244
262
  '-i',
245
263
  integration,
@@ -4,7 +4,7 @@ import { nl } from './Logging';
4
4
 
5
5
  export class BottomBar {
6
6
  public static bar: typeof ui.BottomBar;
7
- public static interval: NodeJS.Timer;
7
+ public static interval: NodeJS.Timeout;
8
8
 
9
9
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
10
10
  public static show(msg: string): void {
package/lib/Helper/Env.ts CHANGED
@@ -1,4 +1,4 @@
1
- const readEnv = require('read-env').default;
1
+ import readEnv from 'read-env';
2
2
 
3
3
  // TODO: move to src/utils (+tests)
4
4
  export function readEnvironment(): Record<string, unknown> {
@@ -1,22 +1,25 @@
1
- import * as _ from 'lodash';
2
1
  import { satisfies, subset, valid, validRange } from 'semver';
3
2
 
4
3
  import { green, red } from './Logging';
5
4
 
6
5
  export function checkPackageVersion(
7
- appPackage: unknown,
6
+ appPackage: {
7
+ dependencies?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ },
8
10
  packageName: string,
9
11
  acceptableVersions: string,
10
12
  canBeLatest: boolean,
11
13
  ): boolean {
12
- const depsVersion = _.get(appPackage, ['dependencies', packageName]);
13
- const devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);
14
+ const depsVersion = appPackage?.dependencies?.[packageName] ?? '';
15
+ const devDepsVersion = appPackage?.devDependencies?.[packageName] ?? '';
14
16
 
15
17
  if (!depsVersion && !devDepsVersion) {
16
18
  red(`✗ ${packageName} isn't in your dependencies.`);
17
19
  red(' Please install it with yarn/npm.');
18
20
  return false;
19
- } else if (
21
+ }
22
+ if (
20
23
  !fulfillsVersionRange(depsVersion, acceptableVersions, canBeLatest) &&
21
24
  !fulfillsVersionRange(devDepsVersion, acceptableVersions, canBeLatest)
22
25
  ) {
@@ -24,12 +27,11 @@ export function checkPackageVersion(
24
27
  `✗ Your \`package.json\` specifies a version of \`${packageName}\` outside of the compatible version range ${acceptableVersions}.\n`,
25
28
  );
26
29
  return false;
27
- } else {
28
- green(
29
- `✓ A compatible version of \`${packageName}\` is specified in \`package.json\`.`,
30
- );
31
- return true;
32
30
  }
31
+ green(
32
+ `✓ A compatible version of \`${packageName}\` is specified in \`package.json\`.`,
33
+ );
34
+ return true;
33
35
  }
34
36
 
35
37
  function fulfillsVersionRange(
@@ -1,7 +1,6 @@
1
- import * as fs from 'fs';
1
+ import * as fs from 'node:fs';
2
2
  import type { Answers } from 'inquirer';
3
- import * as _ from 'lodash';
4
- import * as path from 'path';
3
+ import * as path from 'node:path';
5
4
 
6
5
  import type { Args } from '../Constants';
7
6
  import { addToGitignore } from './Git';
@@ -30,9 +29,9 @@ export class SentryCli {
30
29
  public convertAnswersToProperties(answers: Answers): SentryCliProps {
31
30
  const props: SentryCliProps = {};
32
31
  props['defaults/url'] = this._argv.url;
33
- props['defaults/org'] = _.get(answers, 'config.organization.slug', null);
34
- props['defaults/project'] = _.get(answers, 'config.project.slug', null);
35
- props['auth/token'] = _.get(answers, 'config.auth.token', null);
32
+ props['defaults/org'] = answers.config?.organization?.slug ?? null;
33
+ props['defaults/project'] = answers.config?.project?.slug ?? null;
34
+ props['auth/token'] = answers.config?.auth?.token ?? null;
36
35
  try {
37
36
  const cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {
38
37
  paths: [process.cwd()],
@@ -41,7 +40,7 @@ export class SentryCli {
41
40
  .relative(process.cwd(), cliPath)
42
41
  .replace(/\\/g, '\\\\');
43
42
  } catch (e) {
44
- // we do nothing and leave everyting as it is
43
+ // we do nothing and leave everything as it is
45
44
  }
46
45
  return props;
47
46
  }
@@ -49,17 +48,13 @@ export class SentryCli {
49
48
  /** Create the contents of a `sentry.properties` file */
50
49
  public dumpProperties(props: SentryCliProps): string {
51
50
  const rv = [];
52
- for (let key in props) {
53
- // eslint-disable-next-line no-prototype-builtins
54
- if (props.hasOwnProperty(key)) {
55
- const value = props[key];
56
- key = key.replace(/\//g, '.');
57
- if (value === undefined || value === null) {
58
- // comment that property out since it has no value
59
- rv.push(`#${key}=`);
60
- } else {
61
- rv.push(`${key}=${value}`);
62
- }
51
+ for (const [key, value] of Object.entries(props)) {
52
+ const normalizedKey = key.replace(/\//g, '.');
53
+ if (value === undefined || value === null) {
54
+ // comment that property out since it has no value
55
+ rv.push(`#${normalizedKey}=`);
56
+ } else {
57
+ rv.push(`${normalizedKey}=${value}`);
63
58
  }
64
59
  }
65
60
  // eslint-disable-next-line prefer-template
@@ -68,13 +63,10 @@ export class SentryCli {
68
63
 
69
64
  public dumpConfig(config: SentryCliConfig): string {
70
65
  const dumpedSections: string[] = [];
71
- for (const sectionName in config) {
72
- // eslint-disable-next-line no-prototype-builtins
73
- if (config.hasOwnProperty(sectionName)) {
74
- const props = this.dumpProperties(config[sectionName]);
75
- const section = `[${sectionName}]\n${props}`;
76
- dumpedSections.push(section);
77
- }
66
+ for (const [sectionName, val] of Object.entries(config)) {
67
+ const props = this.dumpProperties(val);
68
+ const section = `[${sectionName}]\n${props}`;
69
+ dumpedSections.push(section);
78
70
  }
79
71
  return dumpedSections.join('\n');
80
72
  }
@@ -127,8 +119,7 @@ export class SentryCli {
127
119
 
128
120
  await addToGitignore(
129
121
  SENTRYCLIRC_FILENAME,
130
- `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, ` +
131
- 'please add it to not commit your auth key.',
122
+ `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, please add it to not commit your auth key.`,
132
123
  );
133
124
 
134
125
  try {
@@ -1,5 +1,4 @@
1
1
  import type { Answers } from 'inquirer';
2
- import * as _ from 'lodash';
3
2
 
4
3
  import type { Args } from '../Constants';
5
4
  import type { IStep } from '../Steps/BaseStep';
@@ -24,7 +23,7 @@ function sanitizeAndValidateArgs(argv: Args): void {
24
23
  }
25
24
 
26
25
  export function getCurrentIntegration(answers: Answers): BaseIntegration {
27
- return _.get(answers, 'integration') as BaseIntegration;
26
+ return answers.integration as BaseIntegration;
28
27
  }
29
28
 
30
29
  export async function startWizard<M extends IStep>(
package/lib/Setup.ts CHANGED
@@ -1,4 +1,3 @@
1
- import * as _ from 'lodash';
2
1
  import { enableDebugLogs } from '../src/utils/debug';
3
2
 
4
3
  import { readEnvironment } from './Helper/Env';
@@ -21,21 +20,21 @@ export async function run(argv: any): Promise<any> {
21
20
  if (args.uninstall === undefined) {
22
21
  args.uninstall = false;
23
22
  }
24
- let steps = [
23
+ const steps = [
25
24
  Step.Initial,
26
25
  Step.Welcome,
27
26
  Step.ChooseIntegration,
28
27
  Step.ShouldConfigure,
29
28
  ];
30
29
  if (args.uninstall === false) {
31
- steps = _.concat(
32
- steps,
30
+ steps.push(
33
31
  Step.OpenSentry,
34
32
  Step.WaitForSentry,
35
33
  Step.SentryProjectSelector,
36
34
  Step.PromptForParameters,
37
35
  );
38
36
  }
39
- steps = _.concat(steps, Step.ConfigureProject, Step.Result);
37
+ steps.push(Step.ConfigureProject, Step.Result);
38
+
40
39
  return startWizard(args, ...steps);
41
40
  }
@@ -1,25 +1,55 @@
1
1
  import type { Answers } from 'inquirer';
2
2
  import { prompt } from 'inquirer';
3
3
 
4
+ import { readFileSync } from 'node:fs';
5
+ import { hasPackageInstalled } from '../../src/utils/package-json';
4
6
  import {
5
7
  Args,
6
8
  DEFAULT_URL,
7
9
  getIntegrationChoices,
8
10
  Integration,
9
11
  } from '../Constants';
12
+ import { dim, red } from '../Helper/Logging';
10
13
  import { BaseStep } from './BaseStep';
11
14
  import { Cordova } from './Integrations/Cordova';
12
15
  import { Electron } from './Integrations/Electron';
13
- import { hasPackageInstalled } from '../../src/utils/package-json';
14
- import { dim } from '../Helper/Logging';
15
16
 
16
- let projectPackage: any = {};
17
+ function getProjectPackage(): Record<string, unknown> {
18
+ let projectPackage: Record<string, unknown> = {};
19
+
20
+ const projectPackagePathCandidates = [
21
+ // If we run directly in setup-wizard
22
+ '../../package.json',
23
+
24
+ // If we run from the CLI
25
+ `${process.cwd()}/package.json`,
26
+ ];
27
+
28
+ for (const pathCandidate of projectPackagePathCandidates) {
29
+ let data: string;
30
+ try {
31
+ data = readFileSync(pathCandidate, 'utf-8');
32
+ } catch (error) {
33
+ // If the file does not exist, continue to the next candidate
34
+ continue;
35
+ }
17
36
 
18
- try {
19
- // If we run directly in setup-wizard
20
- projectPackage = require('../../package.json');
21
- } catch {
22
- projectPackage = require(`${process.cwd()}/package.json`);
37
+ try {
38
+ projectPackage = JSON.parse(data) as Record<string, unknown>;
39
+ break;
40
+ } catch (error) {
41
+ // If the file exists but is not valid JSON, log an error and continue.
42
+ // Note: we don't want to crash the wizard if the package.json is invalid,
43
+ // because it is only use by the integration detection logic.
44
+ // Furthmore other package managers, i.e. bun, allow JSON-with-comments which might
45
+ // throw errors with JSON.parse, and will require a different JSON parser in the future.
46
+ red(
47
+ `Failed to parse JSON from ${pathCandidate}, is your file a valid package.json?`,
48
+ );
49
+ }
50
+ }
51
+
52
+ return projectPackage;
23
53
  }
24
54
 
25
55
  type IntegrationPromptAnswer = {
@@ -44,6 +74,8 @@ export class ChooseIntegration extends BaseStep {
44
74
  }
45
75
 
46
76
  public tryDetectingIntegration(): Integration | undefined {
77
+ const projectPackage = getProjectPackage();
78
+
47
79
  if (hasPackageInstalled('react-native', projectPackage)) {
48
80
  return Integration.reactNative;
49
81
  }
@@ -1,44 +1,35 @@
1
1
  import type { Answers } from 'inquirer';
2
- import * as _ from 'lodash';
3
- import * as path from 'path';
2
+ import { join, dirname } from 'node:path';
4
3
 
5
4
  import { dim } from '../Helper/Logging';
6
5
  import { BaseStep } from './BaseStep';
6
+ import { readFileSync } from 'node:fs';
7
7
 
8
- let wizardPackage: any = {};
9
- let sentryCliPackage: any = {};
8
+ type PackageJSON = { version?: string };
9
+ let wizardPackage: PackageJSON = {};
10
10
 
11
11
  try {
12
- wizardPackage = require(path.join(
13
- path.dirname(require.resolve('@sentry/wizard')),
14
- '..',
15
- 'package.json',
16
- ));
12
+ wizardPackage = process.env.npm_package_version
13
+ ? { version: process.env.npm_package_version }
14
+ : (JSON.parse(
15
+ readFileSync(
16
+ join(
17
+ dirname(require.resolve('@sentry/wizard')),
18
+ '..',
19
+ 'package.json',
20
+ ),
21
+ 'utf-8',
22
+ ),
23
+ ) as PackageJSON);
17
24
  } catch {
18
25
  // We don't need to have this
19
26
  }
20
27
 
21
- try {
22
- sentryCliPackage = require(path.join(
23
- path.dirname(require.resolve('@sentry/cli')),
24
- '..',
25
- 'package.json',
26
- ));
27
- } catch {
28
- // We don't need to have tahis
29
- }
30
-
31
28
  export class Initial extends BaseStep {
32
29
  // eslint-disable-next-line @typescript-eslint/require-await
33
30
  public async emit(_answers: Answers): Promise<Answers> {
34
31
  dim('Running Sentry Wizard...');
35
- dim(
36
- `version: ${_.get(
37
- wizardPackage,
38
- 'version',
39
- 'DEV',
40
- )} | sentry-cli version: ${_.get(sentryCliPackage, 'version', 'DEV')}`,
41
- );
32
+ dim(`version: ${wizardPackage.version ?? 'DEV'}`);
42
33
  return {};
43
34
  }
44
35
  }
@@ -1,5 +1,4 @@
1
1
  import type { Answers } from 'inquirer';
2
- import * as _ from 'lodash';
3
2
 
4
3
  import type { Args } from '../../Constants';
5
4
  import { BaseStep } from '../BaseStep';
@@ -34,13 +33,8 @@ export abstract class BaseIntegration extends BaseStep {
34
33
  }
35
34
 
36
35
  public async shouldEmit(_answers: Answers): Promise<boolean> {
37
- return (
38
- _.keys(
39
- _.pickBy(
40
- await this.shouldConfigure(_answers),
41
- (active: boolean) => active,
42
- ),
43
- ).length > 0
36
+ return Object.values(await this.shouldConfigure(_answers)).some(
37
+ (active: boolean) => active,
44
38
  );
45
39
  }
46
40
 
@@ -1,6 +1,6 @@
1
- import * as fs from 'fs';
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
2
3
  import type { Answers } from 'inquirer';
3
- import * as path from 'path';
4
4
 
5
5
  import type { Args } from '../../Constants';
6
6
  import { exists, matchesContent, patchMatchingFile } from '../../Helper/File';
@@ -8,7 +8,8 @@ import { green } from '../../Helper/Logging';
8
8
  import { SentryCli } from '../../Helper/SentryCli';
9
9
  import { BaseIntegration } from './BaseIntegration';
10
10
 
11
- const xcode = require('xcode');
11
+ import xcode from 'xcode';
12
+ import type { PBXShellScriptBuildPhase } from 'xcode';
12
13
 
13
14
  export class Cordova extends BaseIntegration {
14
15
  protected _sentryCli: SentryCli;
@@ -142,18 +143,11 @@ export class Cordova extends BaseIntegration {
142
143
  }
143
144
 
144
145
  const buildScripts = [];
145
- for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||
146
- {}) {
147
- if (
148
- // eslint-disable-next-line no-prototype-builtins
149
- proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(
150
- key,
151
- )
152
- ) {
153
- const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];
154
- if (val.isa) {
155
- buildScripts.push(val);
156
- }
146
+ for (const val of Object.values(
147
+ proj.hash.project.objects.PBXShellScriptBuildPhase || {},
148
+ )) {
149
+ if ((val as PBXShellScriptBuildPhase).isa) {
150
+ buildScripts.push(val);
157
151
  }
158
152
  }
159
153