@sentry/wizard 3.42.1 → 4.0.1

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 (585) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/bin.js +44 -35
  3. package/dist/bin.js.map +1 -1
  4. package/dist/e2e-tests/jest.config.js +1 -1
  5. package/dist/e2e-tests/jest.config.js.map +1 -1
  6. package/dist/e2e-tests/tests/flutter.test.js +62 -147
  7. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/nextjs.test.js +77 -175
  9. package/dist/e2e-tests/tests/nextjs.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/nuxt-3.test.js +61 -162
  11. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nuxt-4.test.js +62 -163
  13. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/remix.test.js +147 -189
  15. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/sveltekit.test.js +133 -187
  17. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  18. package/dist/e2e-tests/utils/index.d.ts +1 -1
  19. package/dist/e2e-tests/utils/index.js +113 -195
  20. package/dist/e2e-tests/utils/index.js.map +1 -1
  21. package/dist/lib/Constants.js +5 -5
  22. package/dist/lib/Constants.js.map +1 -1
  23. package/dist/lib/Helper/BottomBar.d.ts +1 -1
  24. package/dist/lib/Helper/BottomBar.js +14 -15
  25. package/dist/lib/Helper/BottomBar.js.map +1 -1
  26. package/dist/lib/Helper/Env.js +5 -2
  27. package/dist/lib/Helper/Env.js.map +1 -1
  28. package/dist/lib/Helper/File.js +14 -27
  29. package/dist/lib/Helper/File.js.map +1 -1
  30. package/dist/lib/Helper/Git.js +24 -59
  31. package/dist/lib/Helper/Git.js.map +1 -1
  32. package/dist/lib/Helper/Logging.js +2 -2
  33. package/dist/lib/Helper/Logging.js.map +1 -1
  34. package/dist/lib/Helper/MergeConfig.js +4 -4
  35. package/dist/lib/Helper/MergeConfig.js.map +1 -1
  36. package/dist/lib/Helper/Package.d.ts +4 -1
  37. package/dist/lib/Helper/Package.js +12 -38
  38. package/dist/lib/Helper/Package.js.map +1 -1
  39. package/dist/lib/Helper/SentryCli.js +77 -149
  40. package/dist/lib/Helper/SentryCli.js.map +1 -1
  41. package/dist/lib/Helper/Wizard.js +29 -124
  42. package/dist/lib/Helper/Wizard.js.map +1 -1
  43. package/dist/lib/Helper/__tests__/File.js +4 -4
  44. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  45. package/dist/lib/Helper/__tests__/MergeConfig.js +24 -24
  46. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  47. package/dist/lib/Helper/__tests__/SentryCli.js +33 -23
  48. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  49. package/dist/lib/Setup.js +23 -85
  50. package/dist/lib/Setup.js.map +1 -1
  51. package/dist/lib/Steps/BaseStep.js +8 -8
  52. package/dist/lib/Steps/BaseStep.js.map +1 -1
  53. package/dist/lib/Steps/ChooseIntegration.js +80 -125
  54. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  55. package/dist/lib/Steps/ConfigureProject.js +6 -66
  56. package/dist/lib/Steps/ConfigureProject.js.map +1 -1
  57. package/dist/lib/Steps/Initial.js +16 -104
  58. package/dist/lib/Steps/Initial.js.map +1 -1
  59. package/dist/lib/Steps/Integrations/BaseIntegration.js +24 -118
  60. package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
  61. package/dist/lib/Steps/Integrations/Cordova.js +95 -183
  62. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  63. package/dist/lib/Steps/Integrations/Electron.js +87 -145
  64. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  65. package/dist/lib/Steps/Integrations/MobileProject.js +40 -148
  66. package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
  67. package/dist/lib/Steps/OpenSentry.js +63 -126
  68. package/dist/lib/Steps/OpenSentry.js.map +1 -1
  69. package/dist/lib/Steps/PromptForParameters.js +110 -206
  70. package/dist/lib/Steps/PromptForParameters.js.map +1 -1
  71. package/dist/lib/Steps/Result.js +19 -79
  72. package/dist/lib/Steps/Result.js.map +1 -1
  73. package/dist/lib/Steps/SentryProjectSelector.js +57 -148
  74. package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
  75. package/dist/lib/Steps/ShouldConfigure.js +6 -66
  76. package/dist/lib/Steps/ShouldConfigure.js.map +1 -1
  77. package/dist/lib/Steps/WaitForSentry.js +43 -120
  78. package/dist/lib/Steps/WaitForSentry.js.map +1 -1
  79. package/dist/lib/Steps/Welcome.js +17 -76
  80. package/dist/lib/Steps/Welcome.js.map +1 -1
  81. package/dist/lib/__tests__/Env.js +3 -3
  82. package/dist/lib/__tests__/Env.js.map +1 -1
  83. package/dist/src/android/android-wizard.js +100 -176
  84. package/dist/src/android/android-wizard.js.map +1 -1
  85. package/dist/src/android/code-tools.js +24 -33
  86. package/dist/src/android/code-tools.js.map +1 -1
  87. package/dist/src/android/gradle.js +106 -165
  88. package/dist/src/android/gradle.js.map +1 -1
  89. package/dist/src/android/manifest.js +26 -27
  90. package/dist/src/android/manifest.js.map +1 -1
  91. package/dist/src/android/templates.js +76 -23
  92. package/dist/src/android/templates.js.map +1 -1
  93. package/dist/src/apple/apple-wizard.js +129 -225
  94. package/dist/src/apple/apple-wizard.js.map +1 -1
  95. package/dist/src/apple/cocoapod.js +47 -109
  96. package/dist/src/apple/cocoapod.js.map +1 -1
  97. package/dist/src/apple/code-tools.js +32 -35
  98. package/dist/src/apple/code-tools.js.map +1 -1
  99. package/dist/src/apple/fastlane.js +51 -97
  100. package/dist/src/apple/fastlane.js.map +1 -1
  101. package/dist/src/apple/templates.js +41 -5
  102. package/dist/src/apple/templates.js.map +1 -1
  103. package/dist/src/apple/xcode-manager.d.ts +2 -2
  104. package/dist/src/apple/xcode-manager.js +93 -108
  105. package/dist/src/apple/xcode-manager.js.map +1 -1
  106. package/dist/src/flutter/code-tools.js +79 -127
  107. package/dist/src/flutter/code-tools.js.map +1 -1
  108. package/dist/src/flutter/flutter-wizard.js +75 -136
  109. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  110. package/dist/src/flutter/templates.js +48 -12
  111. package/dist/src/flutter/templates.js.map +1 -1
  112. package/dist/src/nextjs/nextjs-wizard.js +527 -805
  113. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  114. package/dist/src/nextjs/templates.js +380 -40
  115. package/dist/src/nextjs/templates.js.map +1 -1
  116. package/dist/src/nextjs/utils.js +5 -5
  117. package/dist/src/nextjs/utils.js.map +1 -1
  118. package/dist/src/nuxt/nuxt-wizard.js +91 -188
  119. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  120. package/dist/src/nuxt/sdk-example.js +68 -137
  121. package/dist/src/nuxt/sdk-example.js.map +1 -1
  122. package/dist/src/nuxt/sdk-setup.d.ts +4 -4
  123. package/dist/src/nuxt/sdk-setup.js +180 -336
  124. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  125. package/dist/src/nuxt/templates.js +195 -18
  126. package/dist/src/nuxt/templates.js.map +1 -1
  127. package/dist/src/nuxt/utils.js +29 -76
  128. package/dist/src/nuxt/utils.js.map +1 -1
  129. package/dist/src/react-native/expo-env-file.js +41 -94
  130. package/dist/src/react-native/expo-env-file.js.map +1 -1
  131. package/dist/src/react-native/expo-metro.d.ts +1 -1
  132. package/dist/src/react-native/expo-metro.js +75 -130
  133. package/dist/src/react-native/expo-metro.js.map +1 -1
  134. package/dist/src/react-native/expo.js +61 -114
  135. package/dist/src/react-native/expo.js.map +1 -1
  136. package/dist/src/react-native/git.js +23 -56
  137. package/dist/src/react-native/git.js.map +1 -1
  138. package/dist/src/react-native/glob.js +3 -3
  139. package/dist/src/react-native/glob.js.map +1 -1
  140. package/dist/src/react-native/gradle.js +4 -4
  141. package/dist/src/react-native/gradle.js.map +1 -1
  142. package/dist/src/react-native/javascript.js +51 -95
  143. package/dist/src/react-native/javascript.js.map +1 -1
  144. package/dist/src/react-native/metro.js +176 -296
  145. package/dist/src/react-native/metro.js.map +1 -1
  146. package/dist/src/react-native/react-native-wizard.js +267 -418
  147. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  148. package/dist/src/react-native/uninstall.js +37 -80
  149. package/dist/src/react-native/uninstall.js.map +1 -1
  150. package/dist/src/react-native/xcode.js +57 -55
  151. package/dist/src/react-native/xcode.js.map +1 -1
  152. package/dist/src/remix/codemods/express-server.js +27 -82
  153. package/dist/src/remix/codemods/express-server.js.map +1 -1
  154. package/dist/src/remix/codemods/handle-error.js +28 -31
  155. package/dist/src/remix/codemods/handle-error.js.map +1 -1
  156. package/dist/src/remix/codemods/root-common.js +11 -11
  157. package/dist/src/remix/codemods/root-common.js.map +1 -1
  158. package/dist/src/remix/codemods/root-v1.js +17 -67
  159. package/dist/src/remix/codemods/root-v1.js.map +1 -1
  160. package/dist/src/remix/codemods/root-v2.js +89 -140
  161. package/dist/src/remix/codemods/root-v2.js.map +1 -1
  162. package/dist/src/remix/remix-wizard.js +181 -343
  163. package/dist/src/remix/remix-wizard.js.map +1 -1
  164. package/dist/src/remix/sdk-example.js +84 -66
  165. package/dist/src/remix/sdk-example.js.map +1 -1
  166. package/dist/src/remix/sdk-setup.js +161 -293
  167. package/dist/src/remix/sdk-setup.js.map +1 -1
  168. package/dist/src/remix/templates.js +10 -2
  169. package/dist/src/remix/templates.js.map +1 -1
  170. package/dist/src/remix/utils.js +13 -14
  171. package/dist/src/remix/utils.js.map +1 -1
  172. package/dist/src/run.js +106 -178
  173. package/dist/src/run.js.map +1 -1
  174. package/dist/src/sourcemaps/sourcemaps-wizard.js +248 -372
  175. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  176. package/dist/src/sourcemaps/tools/angular.js +32 -66
  177. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  178. package/dist/src/sourcemaps/tools/create-react-app.js +14 -59
  179. package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
  180. package/dist/src/sourcemaps/tools/esbuild.js +34 -77
  181. package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
  182. package/dist/src/sourcemaps/tools/nextjs.d.ts +2 -2
  183. package/dist/src/sourcemaps/tools/nextjs.js +75 -102
  184. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
  185. package/dist/src/sourcemaps/tools/remix.js +53 -93
  186. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  187. package/dist/src/sourcemaps/tools/rollup.js +35 -76
  188. package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
  189. package/dist/src/sourcemaps/tools/sentry-cli.js +157 -289
  190. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  191. package/dist/src/sourcemaps/tools/tsc.js +68 -134
  192. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  193. package/dist/src/sourcemaps/tools/vite.js +111 -196
  194. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  195. package/dist/src/sourcemaps/tools/webpack.d.ts +1 -1
  196. package/dist/src/sourcemaps/tools/webpack.js +158 -260
  197. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  198. package/dist/src/sourcemaps/utils/detect-tool.js +9 -54
  199. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  200. package/dist/src/sourcemaps/utils/other-wizards.js +77 -144
  201. package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
  202. package/dist/src/sourcemaps/utils/sdk-version.js +112 -191
  203. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  204. package/dist/src/sveltekit/sdk-example.js +20 -70
  205. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  206. package/dist/src/sveltekit/sdk-setup.js +250 -411
  207. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  208. package/dist/src/sveltekit/sveltekit-wizard.js +107 -191
  209. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  210. package/dist/src/sveltekit/templates.js +147 -13
  211. package/dist/src/sveltekit/templates.js.map +1 -1
  212. package/dist/src/sveltekit/utils.js +3 -3
  213. package/dist/src/sveltekit/utils.js.map +1 -1
  214. package/dist/src/telemetry.d.ts +2 -2
  215. package/dist/src/telemetry.js +58 -108
  216. package/dist/src/telemetry.js.map +1 -1
  217. package/dist/src/utils/ast-utils.js +39 -54
  218. package/dist/src/utils/ast-utils.js.map +1 -1
  219. package/dist/src/utils/bash.js +28 -75
  220. package/dist/src/utils/bash.js.map +1 -1
  221. package/dist/src/utils/clack-utils.d.ts +3 -7
  222. package/dist/src/utils/clack-utils.js +688 -1083
  223. package/dist/src/utils/clack-utils.js.map +1 -1
  224. package/dist/src/utils/debug.js +6 -10
  225. package/dist/src/utils/debug.js.map +1 -1
  226. package/dist/src/utils/package-json.js +5 -6
  227. package/dist/src/utils/package-json.js.map +1 -1
  228. package/dist/src/utils/package-manager.js +65 -139
  229. package/dist/src/utils/package-manager.js.map +1 -1
  230. package/dist/src/utils/release-registry.js +12 -59
  231. package/dist/src/utils/release-registry.js.map +1 -1
  232. package/dist/src/utils/semver.js +3 -4
  233. package/dist/src/utils/semver.js.map +1 -1
  234. package/dist/src/utils/sentrycli-utils.js +4 -4
  235. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  236. package/dist/src/utils/url.js +5 -6
  237. package/dist/src/utils/url.js.map +1 -1
  238. package/dist/test/android/code-tools.test.js +18 -18
  239. package/dist/test/android/code-tools.test.js.map +1 -1
  240. package/dist/test/apple/cocoapod.test.js +154 -299
  241. package/dist/test/apple/cocoapod.test.js.map +1 -1
  242. package/dist/test/apple/code-tools.test.js +375 -263
  243. package/dist/test/apple/code-tools.test.js.map +1 -1
  244. package/dist/test/apple/fastfile.test.js +319 -271
  245. package/dist/test/apple/fastfile.test.js.map +1 -1
  246. package/dist/test/apple/templates.test.js +114 -30
  247. package/dist/test/apple/templates.test.js.map +1 -1
  248. package/dist/test/apple/xcode-manager.test.js +230 -234
  249. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  250. package/dist/test/flutter/code-tools.test.js +119 -48
  251. package/dist/test/flutter/code-tools.test.js.map +1 -1
  252. package/dist/test/flutter/templates.test.js +63 -20
  253. package/dist/test/flutter/templates.test.js.map +1 -1
  254. package/dist/test/nextjs/templates.test.js +332 -43
  255. package/dist/test/nextjs/templates.test.js.map +1 -1
  256. package/dist/test/nuxt/templates.test.js +161 -33
  257. package/dist/test/nuxt/templates.test.js.map +1 -1
  258. package/dist/test/react-native/expo-metro.test.js +61 -15
  259. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  260. package/dist/test/react-native/expo.test.js +37 -17
  261. package/dist/test/react-native/expo.test.js.map +1 -1
  262. package/dist/test/react-native/gradle.test.js +260 -28
  263. package/dist/test/react-native/gradle.test.js.map +1 -1
  264. package/dist/test/react-native/javascript.test.js +85 -19
  265. package/dist/test/react-native/javascript.test.js.map +1 -1
  266. package/dist/test/react-native/metro.test.js +261 -187
  267. package/dist/test/react-native/metro.test.js.map +1 -1
  268. package/dist/test/react-native/xcode.test.js +243 -62
  269. package/dist/test/react-native/xcode.test.js.map +1 -1
  270. package/dist/test/remix/client-entry.test.js +81 -21
  271. package/dist/test/remix/client-entry.test.js.map +1 -1
  272. package/dist/test/remix/server-instrumentation.test.js +21 -8
  273. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  274. package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -72
  275. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  276. package/dist/test/sourcemaps/tools/tsc.test.js +142 -68
  277. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  278. package/dist/test/sourcemaps/tools/vite.test.js +106 -75
  279. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  280. package/dist/test/sourcemaps/tools/webpack.test.js +226 -102
  281. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  282. package/dist/test/sveltekit/templates.test.js +117 -18
  283. package/dist/test/sveltekit/templates.test.js.map +1 -1
  284. package/dist/test/utils/ast-utils.test.js +99 -58
  285. package/dist/test/utils/ast-utils.test.js.map +1 -1
  286. package/dist/test/utils/clack-utils.test.js +142 -247
  287. package/dist/test/utils/clack-utils.test.js.map +1 -1
  288. package/package.json +16 -9
  289. package/bin.ts +0 -138
  290. package/codecov.yml +0 -15
  291. package/dist/package.json +0 -128
  292. package/e2e-tests/.env.example +0 -11
  293. package/e2e-tests/README.md +0 -63
  294. package/e2e-tests/jest.config.ts +0 -22
  295. package/e2e-tests/package.json +0 -14
  296. package/e2e-tests/run.sh +0 -15
  297. package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/project.pbxproj +0 -52
  298. package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
  299. package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/project.pbxproj +0 -62
  300. package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
  301. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/project.pbxproj +0 -470
  302. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
  303. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/ContentView.swift +0 -7
  304. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/Project1App.swift +0 -10
  305. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/ContentView.swift +0 -7
  306. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/Project2App.swift +0 -10
  307. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/project.pbxproj +0 -382
  308. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/xcshareddata/xcschemes/Project.xcscheme +0 -78
  309. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/ContentView.swift +0 -7
  310. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/MainApp.swift +0 -10
  311. package/e2e-tests/test-applications/flutter-test-app/.metadata +0 -45
  312. package/e2e-tests/test-applications/flutter-test-app/README.md +0 -16
  313. package/e2e-tests/test-applications/flutter-test-app/analysis_options.yaml +0 -28
  314. package/e2e-tests/test-applications/flutter-test-app/android/app/build.gradle +0 -44
  315. package/e2e-tests/test-applications/flutter-test-app/android/app/src/debug/AndroidManifest.xml +0 -7
  316. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/AndroidManifest.xml +0 -45
  317. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/kotlin/com/example/flutter_magic/MainActivity.kt +0 -5
  318. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable/launch_background.xml +0 -12
  319. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable-v21/launch_background.xml +0 -12
  320. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  321. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  322. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  323. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  324. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  325. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values/styles.xml +0 -18
  326. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values-night/styles.xml +0 -18
  327. package/e2e-tests/test-applications/flutter-test-app/android/app/src/profile/AndroidManifest.xml +0 -7
  328. package/e2e-tests/test-applications/flutter-test-app/android/build.gradle +0 -18
  329. package/e2e-tests/test-applications/flutter-test-app/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  330. package/e2e-tests/test-applications/flutter-test-app/android/gradle.properties +0 -3
  331. package/e2e-tests/test-applications/flutter-test-app/android/settings.gradle +0 -25
  332. package/e2e-tests/test-applications/flutter-test-app/lib/main.dart +0 -125
  333. package/e2e-tests/test-applications/flutter-test-app/linux/CMakeLists.txt +0 -145
  334. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/CMakeLists.txt +0 -88
  335. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.cc +0 -11
  336. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.h +0 -15
  337. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugins.cmake +0 -23
  338. package/e2e-tests/test-applications/flutter-test-app/linux/main.cc +0 -6
  339. package/e2e-tests/test-applications/flutter-test-app/linux/my_application.cc +0 -124
  340. package/e2e-tests/test-applications/flutter-test-app/linux/my_application.h +0 -18
  341. package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Debug.xcconfig +0 -2
  342. package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Release.xcconfig +0 -2
  343. package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/GeneratedPluginRegistrant.swift +0 -10
  344. package/e2e-tests/test-applications/flutter-test-app/macos/Podfile +0 -43
  345. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/AppDelegate.swift +0 -9
  346. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -68
  347. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  348. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  349. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  350. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  351. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  352. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  353. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  354. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Base.lproj/MainMenu.xib +0 -343
  355. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/AppInfo.xcconfig +0 -14
  356. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Debug.xcconfig +0 -2
  357. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Release.xcconfig +0 -2
  358. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Warnings.xcconfig +0 -13
  359. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/DebugProfile.entitlements +0 -12
  360. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Info.plist +0 -32
  361. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/MainFlutterWindow.swift +0 -15
  362. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Release.entitlements +0 -8
  363. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.pbxproj +0 -705
  364. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  365. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +0 -98
  366. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/contents.xcworkspacedata +0 -7
  367. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  368. package/e2e-tests/test-applications/flutter-test-app/macos/RunnerTests/RunnerTests.swift +0 -12
  369. package/e2e-tests/test-applications/flutter-test-app/pubspec.lock +0 -213
  370. package/e2e-tests/test-applications/flutter-test-app/pubspec.yaml +0 -89
  371. package/e2e-tests/test-applications/flutter-test-app/test/widget_test.dart +0 -30
  372. package/e2e-tests/test-applications/flutter-test-app/web/favicon.png +0 -0
  373. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-192.png +0 -0
  374. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-512.png +0 -0
  375. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-192.png +0 -0
  376. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-512.png +0 -0
  377. package/e2e-tests/test-applications/flutter-test-app/web/index.html +0 -38
  378. package/e2e-tests/test-applications/flutter-test-app/web/manifest.json +0 -35
  379. package/e2e-tests/test-applications/flutter-test-app/windows/CMakeLists.txt +0 -108
  380. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/CMakeLists.txt +0 -109
  381. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.cc +0 -11
  382. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.h +0 -15
  383. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugins.cmake +0 -23
  384. package/e2e-tests/test-applications/flutter-test-app/windows/runner/CMakeLists.txt +0 -40
  385. package/e2e-tests/test-applications/flutter-test-app/windows/runner/Runner.rc +0 -121
  386. package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.cpp +0 -71
  387. package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.h +0 -33
  388. package/e2e-tests/test-applications/flutter-test-app/windows/runner/main.cpp +0 -43
  389. package/e2e-tests/test-applications/flutter-test-app/windows/runner/resource.h +0 -16
  390. package/e2e-tests/test-applications/flutter-test-app/windows/runner/resources/app_icon.ico +0 -0
  391. package/e2e-tests/test-applications/flutter-test-app/windows/runner/runner.exe.manifest +0 -14
  392. package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.cpp +0 -65
  393. package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.h +0 -19
  394. package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.cpp +0 -288
  395. package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.h +0 -102
  396. package/e2e-tests/test-applications/nextjs-test-app/next.config.mjs +0 -4
  397. package/e2e-tests/test-applications/nextjs-test-app/package.json +0 -22
  398. package/e2e-tests/test-applications/nextjs-test-app/src/app/layout.tsx +0 -20
  399. package/e2e-tests/test-applications/nextjs-test-app/src/app/page.tsx +0 -90
  400. package/e2e-tests/test-applications/nuxt-3-test-app/README.md +0 -75
  401. package/e2e-tests/test-applications/nuxt-3-test-app/nuxt.config.ts +0 -5
  402. package/e2e-tests/test-applications/nuxt-3-test-app/package.json +0 -18
  403. package/e2e-tests/test-applications/nuxt-3-test-app/public/favicon.ico +0 -0
  404. package/e2e-tests/test-applications/nuxt-3-test-app/public/robots.txt +0 -1
  405. package/e2e-tests/test-applications/nuxt-4-test-app/README.md +0 -75
  406. package/e2e-tests/test-applications/nuxt-4-test-app/nuxt.config.ts +0 -6
  407. package/e2e-tests/test-applications/nuxt-4-test-app/package.json +0 -18
  408. package/e2e-tests/test-applications/nuxt-4-test-app/public/favicon.ico +0 -0
  409. package/e2e-tests/test-applications/nuxt-4-test-app/public/robots.txt +0 -1
  410. package/e2e-tests/test-applications/remix-test-app/app/entry.client.tsx +0 -18
  411. package/e2e-tests/test-applications/remix-test-app/app/entry.server.tsx +0 -140
  412. package/e2e-tests/test-applications/remix-test-app/app/root.tsx +0 -30
  413. package/e2e-tests/test-applications/remix-test-app/app/routes/_index.tsx +0 -48
  414. package/e2e-tests/test-applications/remix-test-app/app/tailwind.css +0 -3
  415. package/e2e-tests/test-applications/remix-test-app/package.json +0 -37
  416. package/e2e-tests/test-applications/remix-test-app/postcss.config.js +0 -6
  417. package/e2e-tests/test-applications/remix-test-app/tailwind.config.ts +0 -9
  418. package/e2e-tests/test-applications/remix-test-app/vite.config.ts +0 -16
  419. package/e2e-tests/test-applications/sveltekit-test-app/package.json +0 -21
  420. package/e2e-tests/test-applications/sveltekit-test-app/src/app.d.ts +0 -13
  421. package/e2e-tests/test-applications/sveltekit-test-app/src/app.html +0 -11
  422. package/e2e-tests/test-applications/sveltekit-test-app/src/lib/index.ts +0 -1
  423. package/e2e-tests/test-applications/sveltekit-test-app/src/routes/+page.svelte +0 -2
  424. package/e2e-tests/test-applications/sveltekit-test-app/svelte.config.js +0 -18
  425. package/e2e-tests/test-applications/sveltekit-test-app/vite.config.ts +0 -6
  426. package/e2e-tests/tests/flutter.test.ts +0 -127
  427. package/e2e-tests/tests/nextjs.test.ts +0 -161
  428. package/e2e-tests/tests/nuxt-3.test.ts +0 -189
  429. package/e2e-tests/tests/nuxt-4.test.ts +0 -188
  430. package/e2e-tests/tests/remix.test.ts +0 -277
  431. package/e2e-tests/tests/sveltekit.test.ts +0 -284
  432. package/e2e-tests/utils/index.ts +0 -438
  433. package/index.ts +0 -2
  434. package/lib/Constants.ts +0 -118
  435. package/lib/Helper/BottomBar.ts +0 -28
  436. package/lib/Helper/Env.ts +0 -7
  437. package/lib/Helper/File.ts +0 -65
  438. package/lib/Helper/Git.ts +0 -39
  439. package/lib/Helper/Logging.ts +0 -44
  440. package/lib/Helper/MergeConfig.ts +0 -19
  441. package/lib/Helper/Package.ts +0 -78
  442. package/lib/Helper/SentryCli.ts +0 -148
  443. package/lib/Helper/Wizard.ts +0 -59
  444. package/lib/Helper/__tests__/File.ts +0 -15
  445. package/lib/Helper/__tests__/MergeConfig.ts +0 -98
  446. package/lib/Helper/__tests__/SentryCli.ts +0 -86
  447. package/lib/Helper/test-fixtures/next.config.1-merged.js +0 -18
  448. package/lib/Helper/test-fixtures/next.config.1.js +0 -6
  449. package/lib/Helper/test-fixtures/next.config.2.js +0 -8
  450. package/lib/Helper/test-fixtures/next.config.3-merged.js +0 -21
  451. package/lib/Helper/test-fixtures/next.config.3.js +0 -9
  452. package/lib/Helper/test-fixtures/next.config.4-merged.js +0 -21
  453. package/lib/Helper/test-fixtures/next.config.4.js +0 -9
  454. package/lib/Setup.ts +0 -41
  455. package/lib/Steps/BaseStep.ts +0 -25
  456. package/lib/Steps/ChooseIntegration.ts +0 -112
  457. package/lib/Steps/ConfigureProject.ts +0 -10
  458. package/lib/Steps/Initial.ts +0 -44
  459. package/lib/Steps/Integrations/BaseIntegration.ts +0 -48
  460. package/lib/Steps/Integrations/Cordova.ts +0 -289
  461. package/lib/Steps/Integrations/Electron.ts +0 -161
  462. package/lib/Steps/Integrations/MobileProject.ts +0 -69
  463. package/lib/Steps/OpenSentry.ts +0 -75
  464. package/lib/Steps/PromptForParameters.ts +0 -207
  465. package/lib/Steps/Result.ts +0 -22
  466. package/lib/Steps/SentryProjectSelector.ts +0 -82
  467. package/lib/Steps/ShouldConfigure.ts +0 -10
  468. package/lib/Steps/WaitForSentry.ts +0 -50
  469. package/lib/Steps/Welcome.ts +0 -21
  470. package/lib/Steps/index.ts +0 -10
  471. package/lib/__tests__/Env.ts +0 -29
  472. package/scripts/NextJs/configs/_error.js +0 -39
  473. package/scripts/NextJs/configs/next.config.js +0 -36
  474. package/scripts/NextJs/configs/next.config.template.js +0 -12
  475. package/scripts/NextJs/configs/sentry.client.config.js +0 -17
  476. package/scripts/NextJs/configs/sentry.edge.config.js +0 -17
  477. package/scripts/NextJs/configs/sentry.server.config.js +0 -17
  478. package/scripts/NextJs/sentry_sample_error.js +0 -47
  479. package/scripts/craft-pre-release.sh +0 -10
  480. package/src/android/android-wizard.ts +0 -192
  481. package/src/android/code-tools.ts +0 -170
  482. package/src/android/gradle.ts +0 -250
  483. package/src/android/manifest.ts +0 -180
  484. package/src/android/templates.ts +0 -86
  485. package/src/apple/apple-wizard.ts +0 -269
  486. package/src/apple/cocoapod.ts +0 -73
  487. package/src/apple/code-tools.ts +0 -147
  488. package/src/apple/fastlane.ts +0 -170
  489. package/src/apple/templates.ts +0 -65
  490. package/src/apple/xcode-manager.ts +0 -404
  491. package/src/flutter/code-tools.ts +0 -284
  492. package/src/flutter/flutter-wizard.ts +0 -164
  493. package/src/flutter/templates.ts +0 -90
  494. package/src/nextjs/nextjs-wizard.ts +0 -1007
  495. package/src/nextjs/templates.ts +0 -526
  496. package/src/nextjs/utils.ts +0 -21
  497. package/src/nuxt/nuxt-wizard.ts +0 -188
  498. package/src/nuxt/sdk-example.ts +0 -135
  499. package/src/nuxt/sdk-setup.ts +0 -349
  500. package/src/nuxt/templates.ts +0 -303
  501. package/src/nuxt/types.ts +0 -8
  502. package/src/nuxt/utils.ts +0 -42
  503. package/src/react-native/expo-env-file.ts +0 -55
  504. package/src/react-native/expo-metro.ts +0 -212
  505. package/src/react-native/expo.ts +0 -175
  506. package/src/react-native/git.ts +0 -25
  507. package/src/react-native/glob.ts +0 -13
  508. package/src/react-native/gradle.ts +0 -26
  509. package/src/react-native/javascript.ts +0 -103
  510. package/src/react-native/metro.ts +0 -599
  511. package/src/react-native/options.ts +0 -5
  512. package/src/react-native/react-native-wizard.ts +0 -513
  513. package/src/react-native/uninstall.ts +0 -110
  514. package/src/react-native/xcode.ts +0 -302
  515. package/src/remix/codemods/express-server.ts +0 -44
  516. package/src/remix/codemods/handle-error.ts +0 -118
  517. package/src/remix/codemods/root-common.ts +0 -63
  518. package/src/remix/codemods/root-v1.ts +0 -41
  519. package/src/remix/codemods/root-v2.ts +0 -153
  520. package/src/remix/remix-wizard.ts +0 -261
  521. package/src/remix/sdk-example.ts +0 -120
  522. package/src/remix/sdk-setup.ts +0 -546
  523. package/src/remix/templates.ts +0 -11
  524. package/src/remix/utils.ts +0 -96
  525. package/src/run.ts +0 -204
  526. package/src/sourcemaps/sourcemaps-wizard.ts +0 -364
  527. package/src/sourcemaps/tools/angular.ts +0 -42
  528. package/src/sourcemaps/tools/create-react-app.ts +0 -19
  529. package/src/sourcemaps/tools/esbuild.ts +0 -65
  530. package/src/sourcemaps/tools/nextjs.ts +0 -114
  531. package/src/sourcemaps/tools/remix.ts +0 -90
  532. package/src/sourcemaps/tools/rollup.ts +0 -67
  533. package/src/sourcemaps/tools/sentry-cli.ts +0 -287
  534. package/src/sourcemaps/tools/tsc.ts +0 -144
  535. package/src/sourcemaps/tools/types.ts +0 -11
  536. package/src/sourcemaps/tools/vite.ts +0 -300
  537. package/src/sourcemaps/tools/webpack.ts +0 -383
  538. package/src/sourcemaps/utils/detect-tool.ts +0 -46
  539. package/src/sourcemaps/utils/other-wizards.ts +0 -167
  540. package/src/sourcemaps/utils/sdk-version.ts +0 -266
  541. package/src/sveltekit/sdk-example.ts +0 -56
  542. package/src/sveltekit/sdk-setup.ts +0 -667
  543. package/src/sveltekit/sveltekit-wizard.ts +0 -192
  544. package/src/sveltekit/templates.ts +0 -185
  545. package/src/sveltekit/utils.ts +0 -50
  546. package/src/telemetry.ts +0 -124
  547. package/src/utils/ast-utils.ts +0 -270
  548. package/src/utils/bash.ts +0 -57
  549. package/src/utils/clack-utils.ts +0 -1533
  550. package/src/utils/debug.ts +0 -20
  551. package/src/utils/package-json.ts +0 -51
  552. package/src/utils/package-manager.ts +0 -172
  553. package/src/utils/release-registry.ts +0 -19
  554. package/src/utils/semver.ts +0 -33
  555. package/src/utils/sentrycli-utils.ts +0 -24
  556. package/src/utils/string.ts +0 -7
  557. package/src/utils/types.ts +0 -77
  558. package/src/utils/url.ts +0 -27
  559. package/src/utils/vendor/is-unicorn-supported.ts +0 -29
  560. package/test/android/code-tools.test.ts +0 -49
  561. package/test/apple/cocoapod.test.ts +0 -306
  562. package/test/apple/code-tools.test.ts +0 -1042
  563. package/test/apple/fastfile.test.ts +0 -550
  564. package/test/apple/templates.test.ts +0 -191
  565. package/test/apple/xcode-manager.test.ts +0 -1066
  566. package/test/flutter/code-tools.test.ts +0 -212
  567. package/test/flutter/templates.test.ts +0 -100
  568. package/test/nextjs/templates.test.ts +0 -429
  569. package/test/nuxt/templates.test.ts +0 -255
  570. package/test/react-native/expo-metro.test.ts +0 -81
  571. package/test/react-native/expo.test.ts +0 -86
  572. package/test/react-native/gradle.test.ts +0 -310
  573. package/test/react-native/javascript.test.ts +0 -134
  574. package/test/react-native/metro.test.ts +0 -396
  575. package/test/react-native/xcode.test.ts +0 -401
  576. package/test/remix/client-entry.test.ts +0 -122
  577. package/test/remix/server-instrumentation.test.ts +0 -36
  578. package/test/sourcemaps/tools/sentry-cli.test.ts +0 -57
  579. package/test/sourcemaps/tools/tsc.test.ts +0 -181
  580. package/test/sourcemaps/tools/vite.test.ts +0 -149
  581. package/test/sourcemaps/tools/webpack.test.ts +0 -303
  582. package/test/sveltekit/templates.test.ts +0 -152
  583. package/test/utils/ast-utils.test.ts +0 -264
  584. package/test/utils/clack-utils.test.ts +0 -234
  585. package/types/xcode.d.ts +0 -526
@@ -22,69 +22,33 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
62
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
27
  };
64
28
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.askShouldAddPackageOverride = exports.askShouldInstallPackage = exports.featureSelectionPrompt = exports.askShouldCreateExampleComponent = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.updatePackageDotJson = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = exports.opn = void 0;
29
+ exports.askShouldAddPackageOverride = exports.askShouldInstallPackage = exports.featureSelectionPrompt = exports.askShouldCreateExampleComponent = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.updatePackageDotJson = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
30
+ const childProcess = __importStar(require("node:child_process"));
31
+ const fs = __importStar(require("node:fs"));
32
+ const os = __importStar(require("node:os"));
33
+ const node_path_1 = require("node:path");
34
+ const node_timers_1 = require("node:timers");
35
+ const node_url_1 = require("node:url");
66
36
  // @ts-ignore - clack is ESM and TS complains about that. It works though
67
- var clack = __importStar(require("@clack/prompts"));
68
- var axios_1 = __importDefault(require("axios"));
69
- var chalk_1 = __importDefault(require("chalk"));
70
- var childProcess = __importStar(require("child_process"));
71
- var fs = __importStar(require("fs"));
72
- var path = __importStar(require("path"));
73
- var os = __importStar(require("os"));
74
- var timers_1 = require("timers");
75
- var url_1 = require("url");
76
- var Sentry = __importStar(require("@sentry/node"));
77
- var package_json_1 = require("./package-json");
78
- var telemetry_1 = require("../telemetry");
79
- var package_manager_1 = require("./package-manager");
80
- var debug_1 = require("./debug");
81
- var semver_1 = require("./semver");
82
- exports.opn = require('opn');
37
+ const clack = __importStar(require("@clack/prompts"));
38
+ const Sentry = __importStar(require("@sentry/node"));
39
+ const axios_1 = __importDefault(require("axios"));
40
+ const chalk_1 = __importDefault(require("chalk"));
41
+ const opn_1 = __importDefault(require("opn"));
42
+ const telemetry_1 = require("../telemetry");
43
+ const debug_1 = require("./debug");
44
+ const package_json_1 = require("./package-json");
45
+ const package_manager_1 = require("./package-manager");
46
+ const semver_1 = require("./semver");
83
47
  exports.SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';
84
48
  exports.SENTRY_CLI_RC_FILE = '.sentryclirc';
85
49
  exports.SENTRY_PROPERTIES_FILE = 'sentry.properties';
86
- var SAAS_URL = 'https://sentry.io/';
87
- var DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';
50
+ const SAAS_URL = 'https://sentry.io/';
51
+ const DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';
88
52
  exports.rcCliSetupConfig = {
89
53
  filename: exports.SENTRY_CLI_RC_FILE,
90
54
  name: 'source maps',
@@ -93,7 +57,7 @@ exports.rcCliSetupConfig = {
93
57
  return !!(contents.includes('[auth]') && contents.match(/token=./g));
94
58
  },
95
59
  tokenContent: function (authToken) {
96
- return "[auth]\ntoken=".concat(authToken);
60
+ return `[auth]\ntoken=${authToken}`;
97
61
  },
98
62
  likelyAlreadyHasOrgAndProject: function (contents) {
99
63
  return !!(contents.includes('[defaults]') &&
@@ -101,156 +65,122 @@ exports.rcCliSetupConfig = {
101
65
  contents.match(/project=./g));
102
66
  },
103
67
  orgAndProjContent: function (org, project) {
104
- return "[defaults]\norg=".concat(org, "\nproject=").concat(project);
68
+ return `[defaults]\norg=${org}\nproject=${project}`;
105
69
  },
106
70
  };
107
71
  exports.propertiesCliSetupConfig = {
108
72
  filename: exports.SENTRY_PROPERTIES_FILE,
109
73
  gitignore: true,
110
74
  name: 'debug files',
111
- likelyAlreadyHasAuthToken: function (contents) {
75
+ likelyAlreadyHasAuthToken(contents) {
112
76
  return !!contents.match(/auth\.token=./g);
113
77
  },
114
- tokenContent: function (authToken) {
115
- return "auth.token=".concat(authToken);
78
+ tokenContent(authToken) {
79
+ return `auth.token=${authToken}`;
116
80
  },
117
- likelyAlreadyHasOrgAndProject: function (contents) {
81
+ likelyAlreadyHasOrgAndProject(contents) {
118
82
  return !!(contents.match(/defaults\.org=./g) &&
119
83
  contents.match(/defaults\.project=./g));
120
84
  },
121
- orgAndProjContent: function (org, project) {
122
- return "defaults.org=".concat(org, "\ndefaults.project=").concat(project);
85
+ orgAndProjContent(org, project) {
86
+ return `defaults.org=${org}\ndefaults.project=${project}`;
123
87
  },
124
- likelyAlreadyHasUrl: function (contents) {
88
+ likelyAlreadyHasUrl(contents) {
125
89
  return !!contents.match(/defaults\.url=./g);
126
90
  },
127
- urlContent: function (url) {
128
- return "defaults.url=".concat(url);
91
+ urlContent(url) {
92
+ return `defaults.url=${url}`;
129
93
  },
130
94
  };
131
- function abort(message, status) {
132
- return __awaiter(this, void 0, void 0, function () {
133
- var sentryHub, sentryTransaction, sentrySession;
134
- return __generator(this, function (_a) {
135
- switch (_a.label) {
136
- case 0:
137
- clack.outro(message !== null && message !== void 0 ? message : 'Wizard setup cancelled.');
138
- sentryHub = Sentry.getCurrentHub();
139
- sentryTransaction = sentryHub.getScope().getTransaction();
140
- sentryTransaction === null || sentryTransaction === void 0 ? void 0 : sentryTransaction.setStatus('aborted');
141
- sentryTransaction === null || sentryTransaction === void 0 ? void 0 : sentryTransaction.finish();
142
- sentrySession = sentryHub.getScope().getSession();
143
- if (sentrySession) {
144
- sentrySession.status = status === 0 ? 'abnormal' : 'crashed';
145
- sentryHub.captureSession(true);
146
- }
147
- return [4 /*yield*/, Sentry.flush(3000)];
148
- case 1:
149
- _a.sent();
150
- return [2 /*return*/, process.exit(status !== null && status !== void 0 ? status : 1)];
151
- }
152
- });
153
- });
95
+ async function abort(message, status) {
96
+ clack.outro(message ?? 'Wizard setup cancelled.');
97
+ const sentryHub = Sentry.getCurrentHub();
98
+ const sentryTransaction = sentryHub.getScope().getTransaction();
99
+ sentryTransaction?.setStatus('aborted');
100
+ sentryTransaction?.finish();
101
+ const sentrySession = sentryHub.getScope().getSession();
102
+ if (sentrySession) {
103
+ sentrySession.status = status === 0 ? 'abnormal' : 'crashed';
104
+ sentryHub.captureSession(true);
105
+ }
106
+ await Sentry.flush(3000);
107
+ return process.exit(status ?? 1);
154
108
  }
155
109
  exports.abort = abort;
156
- function abortIfCancelled(input) {
157
- return __awaiter(this, void 0, void 0, function () {
158
- var _a, _b, sentryHub, sentryTransaction;
159
- return __generator(this, function (_c) {
160
- switch (_c.label) {
161
- case 0:
162
- _b = (_a = clack).isCancel;
163
- return [4 /*yield*/, input];
164
- case 1:
165
- if (!_b.apply(_a, [_c.sent()])) return [3 /*break*/, 3];
166
- clack.cancel('Wizard setup cancelled.');
167
- sentryHub = Sentry.getCurrentHub();
168
- sentryTransaction = sentryHub.getScope().getTransaction();
169
- sentryTransaction === null || sentryTransaction === void 0 ? void 0 : sentryTransaction.setStatus('cancelled');
170
- sentryTransaction === null || sentryTransaction === void 0 ? void 0 : sentryTransaction.finish();
171
- sentryHub.captureSession(true);
172
- return [4 /*yield*/, Sentry.flush(3000)];
173
- case 2:
174
- _c.sent();
175
- process.exit(0);
176
- return [3 /*break*/, 4];
177
- case 3: return [2 /*return*/, input];
178
- case 4: return [2 /*return*/];
179
- }
180
- });
181
- });
110
+ async function abortIfCancelled(input) {
111
+ if (clack.isCancel(await input)) {
112
+ clack.cancel('Wizard setup cancelled.');
113
+ const sentryHub = Sentry.getCurrentHub();
114
+ const sentryTransaction = sentryHub.getScope().getTransaction();
115
+ sentryTransaction?.setStatus('cancelled');
116
+ sentryTransaction?.finish();
117
+ sentryHub.captureSession(true);
118
+ await Sentry.flush(3000);
119
+ process.exit(0);
120
+ }
121
+ else {
122
+ return input;
123
+ }
182
124
  }
183
125
  exports.abortIfCancelled = abortIfCancelled;
184
126
  function printWelcome(options) {
185
- var wizardPackage = {};
186
- try {
187
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
188
- wizardPackage = require(path.join(path.dirname(require.resolve('@sentry/wizard')), '..', 'package.json'));
189
- }
190
- catch (_a) {
191
- // We don't need to have this
127
+ let wizardVersion = process.env.npm_package_version;
128
+ if (!wizardVersion) {
129
+ try {
130
+ wizardVersion = JSON.parse(fs.readFileSync((0, node_path_1.join)((0, node_path_1.dirname)(require.resolve('@sentry/wizard')), '..', 'package.json'), 'utf-8')).version;
131
+ }
132
+ catch {
133
+ // We don't need to have this
134
+ }
192
135
  }
193
136
  // eslint-disable-next-line no-console
194
137
  console.log('');
195
- clack.intro(chalk_1.default.inverse(" ".concat(options.wizardName, " ")));
196
- var welcomeText = options.message ||
197
- "The ".concat(options.wizardName, " will help you set up Sentry for your application.\nThank you for using Sentry :)");
138
+ clack.intro(chalk_1.default.inverse(` ${options.wizardName} `));
139
+ let welcomeText = options.message ||
140
+ `The ${options.wizardName} will help you set up Sentry for your application.\nThank you for using Sentry :)`;
198
141
  if (options.promoCode) {
199
- welcomeText = "".concat(welcomeText, "\n\nUsing promo-code: ").concat(options.promoCode);
142
+ welcomeText = `${welcomeText}\n\nUsing promo-code: ${options.promoCode}`;
200
143
  }
201
- if (wizardPackage.version) {
202
- welcomeText = "".concat(welcomeText, "\n\nVersion: ").concat(wizardPackage.version);
144
+ if (wizardVersion) {
145
+ welcomeText = `${welcomeText}\n\nVersion: ${wizardVersion}`;
203
146
  }
204
147
  if (options.telemetryEnabled) {
205
- welcomeText = "".concat(welcomeText, "\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ").concat(chalk_1.default.cyanBright('sentry-wizard --disable-telemetry'), ".");
148
+ welcomeText = `${welcomeText}
149
+
150
+ This wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.
151
+ You can turn this off at any time by running ${chalk_1.default.cyanBright('sentry-wizard --disable-telemetry')}.`;
206
152
  }
207
153
  clack.note(welcomeText);
208
154
  }
209
155
  exports.printWelcome = printWelcome;
210
- function confirmContinueIfNoOrDirtyGitRepo() {
211
- return __awaiter(this, void 0, void 0, function () {
212
- var _this = this;
213
- return __generator(this, function (_a) {
214
- return [2 /*return*/, (0, telemetry_1.traceStep)('check-git-status', function () { return __awaiter(_this, void 0, void 0, function () {
215
- var continueWithoutGit, uncommittedOrUntrackedFiles, continueWithDirtyRepo;
216
- return __generator(this, function (_a) {
217
- switch (_a.label) {
218
- case 0:
219
- if (!!isInGitRepo()) return [3 /*break*/, 4];
220
- return [4 /*yield*/, abortIfCancelled(clack.confirm({
221
- message: 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',
222
- }))];
223
- case 1:
224
- continueWithoutGit = _a.sent();
225
- Sentry.setTag('continue-without-git', continueWithoutGit);
226
- if (!!continueWithoutGit) return [3 /*break*/, 3];
227
- return [4 /*yield*/, abort(undefined, 0)];
228
- case 2:
229
- _a.sent();
230
- _a.label = 3;
231
- case 3:
232
- // return early to avoid checking for uncommitted files
233
- return [2 /*return*/];
234
- case 4:
235
- uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();
236
- if (!uncommittedOrUntrackedFiles.length) return [3 /*break*/, 7];
237
- clack.log.warn("You have uncommitted or untracked files in your repo:\n\n".concat(uncommittedOrUntrackedFiles.join('\n'), "\n\nThe wizard will create and update files."));
238
- return [4 /*yield*/, abortIfCancelled(clack.confirm({
239
- message: 'Do you want to continue anyway?',
240
- }))];
241
- case 5:
242
- continueWithDirtyRepo = _a.sent();
243
- Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);
244
- if (!!continueWithDirtyRepo) return [3 /*break*/, 7];
245
- return [4 /*yield*/, abort(undefined, 0)];
246
- case 6:
247
- _a.sent();
248
- _a.label = 7;
249
- case 7: return [2 /*return*/];
250
- }
251
- });
252
- }); })];
253
- });
156
+ async function confirmContinueIfNoOrDirtyGitRepo() {
157
+ return (0, telemetry_1.traceStep)('check-git-status', async () => {
158
+ if (!isInGitRepo()) {
159
+ const continueWithoutGit = await abortIfCancelled(clack.confirm({
160
+ message: 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',
161
+ }));
162
+ Sentry.setTag('continue-without-git', continueWithoutGit);
163
+ if (!continueWithoutGit) {
164
+ await abort(undefined, 0);
165
+ }
166
+ // return early to avoid checking for uncommitted files
167
+ return;
168
+ }
169
+ const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();
170
+ if (uncommittedOrUntrackedFiles.length) {
171
+ clack.log.warn(`You have uncommitted or untracked files in your repo:
172
+
173
+ ${uncommittedOrUntrackedFiles.join('\n')}
174
+
175
+ The wizard will create and update files.`);
176
+ const continueWithDirtyRepo = await abortIfCancelled(clack.confirm({
177
+ message: 'Do you want to continue anyway?',
178
+ }));
179
+ Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);
180
+ if (!continueWithDirtyRepo) {
181
+ await abort(undefined, 0);
182
+ }
183
+ }
254
184
  });
255
185
  }
256
186
  exports.confirmContinueIfNoOrDirtyGitRepo = confirmContinueIfNoOrDirtyGitRepo;
@@ -261,105 +191,75 @@ function isInGitRepo() {
261
191
  });
262
192
  return true;
263
193
  }
264
- catch (_a) {
194
+ catch {
265
195
  return false;
266
196
  }
267
197
  }
268
198
  exports.isInGitRepo = isInGitRepo;
269
199
  function getUncommittedOrUntrackedFiles() {
270
200
  try {
271
- var gitStatus = childProcess
201
+ const gitStatus = childProcess
272
202
  .execSync('git status --porcelain=v1', {
273
203
  // we only care about stdout
274
204
  stdio: ['ignore', 'pipe', 'ignore'],
275
205
  })
276
206
  .toString();
277
- var files = gitStatus
207
+ const files = gitStatus
278
208
  .split(os.EOL)
279
- .map(function (line) { return line.trim(); })
209
+ .map((line) => line.trim())
280
210
  .filter(Boolean)
281
- .map(function (f) { return "- ".concat(f.split(/\s+/)[1]); });
211
+ .map((f) => `- ${f.split(/\s+/)[1]}`);
282
212
  return files;
283
213
  }
284
- catch (_a) {
214
+ catch {
285
215
  return [];
286
216
  }
287
217
  }
288
218
  exports.getUncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles;
289
- function askToInstallSentryCLI() {
290
- return __awaiter(this, void 0, void 0, function () {
291
- return __generator(this, function (_a) {
292
- switch (_a.label) {
293
- case 0: return [4 /*yield*/, abortIfCancelled(clack.confirm({
294
- message: "You don't have Sentry CLI installed. Do you want to install it?",
295
- }))];
296
- case 1: return [2 /*return*/, _a.sent()];
297
- }
298
- });
299
- });
219
+ async function askToInstallSentryCLI() {
220
+ return await abortIfCancelled(clack.confirm({
221
+ message: "You don't have Sentry CLI installed. Do you want to install it?",
222
+ }));
300
223
  }
301
224
  exports.askToInstallSentryCLI = askToInstallSentryCLI;
302
- function askForItemSelection(items, message) {
303
- return __awaiter(this, void 0, void 0, function () {
304
- var selection;
305
- return __generator(this, function (_a) {
306
- switch (_a.label) {
307
- case 0: return [4 /*yield*/, abortIfCancelled(clack.select({
308
- maxItems: 12,
309
- message: message,
310
- options: items.map(function (item, index) {
311
- return {
312
- value: { value: item, index: index },
313
- label: item,
314
- };
315
- }),
316
- }))];
317
- case 1:
318
- selection = _a.sent();
319
- return [2 /*return*/, selection];
320
- }
321
- });
322
- });
225
+ async function askForItemSelection(items, message) {
226
+ const selection = await abortIfCancelled(clack.select({
227
+ maxItems: 12,
228
+ message: message,
229
+ options: items.map((item, index) => {
230
+ return {
231
+ value: { value: item, index: index },
232
+ label: item,
233
+ };
234
+ }),
235
+ }));
236
+ return selection;
323
237
  }
324
238
  exports.askForItemSelection = askForItemSelection;
325
- function confirmContinueIfPackageVersionNotSupported(_a) {
326
- var packageId = _a.packageId, packageName = _a.packageName, packageVersion = _a.packageVersion, acceptableVersions = _a.acceptableVersions, note = _a.note;
327
- return __awaiter(this, void 0, void 0, function () {
328
- var _this = this;
329
- return __generator(this, function (_b) {
330
- return [2 /*return*/, (0, telemetry_1.traceStep)("check-package-version", function () { return __awaiter(_this, void 0, void 0, function () {
331
- var isSupportedVersion, continueWithUnsupportedVersion;
332
- return __generator(this, function (_a) {
333
- switch (_a.label) {
334
- case 0:
335
- Sentry.setTag("".concat(packageName.toLowerCase(), "-version"), packageVersion);
336
- isSupportedVersion = (0, semver_1.fulfillsVersionRange)({
337
- acceptableVersions: acceptableVersions,
338
- version: packageVersion,
339
- canBeLatest: true,
340
- });
341
- if (isSupportedVersion) {
342
- Sentry.setTag("".concat(packageName.toLowerCase(), "-supported"), true);
343
- return [2 /*return*/];
344
- }
345
- clack.log.warn("You have an unsupported version of ".concat(packageName, " installed:\n\n ").concat(packageId, "@").concat(packageVersion));
346
- clack.note(note !== null && note !== void 0 ? note : "Please upgrade to ".concat(acceptableVersions, " if you wish to use the Sentry Wizard."));
347
- return [4 /*yield*/, abortIfCancelled(clack.confirm({
348
- message: 'Do you want to continue anyway?',
349
- }))];
350
- case 1:
351
- continueWithUnsupportedVersion = _a.sent();
352
- Sentry.setTag("".concat(packageName.toLowerCase(), "-continue-with-unsupported-version"), continueWithUnsupportedVersion);
353
- if (!!continueWithUnsupportedVersion) return [3 /*break*/, 3];
354
- return [4 /*yield*/, abort(undefined, 0)];
355
- case 2:
356
- _a.sent();
357
- _a.label = 3;
358
- case 3: return [2 /*return*/];
359
- }
360
- });
361
- }); })];
239
+ async function confirmContinueIfPackageVersionNotSupported({ packageId, packageName, packageVersion, acceptableVersions, note, }) {
240
+ return (0, telemetry_1.traceStep)(`check-package-version`, async () => {
241
+ Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);
242
+ const isSupportedVersion = (0, semver_1.fulfillsVersionRange)({
243
+ acceptableVersions,
244
+ version: packageVersion,
245
+ canBeLatest: true,
362
246
  });
247
+ if (isSupportedVersion) {
248
+ Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);
249
+ return;
250
+ }
251
+ clack.log.warn(`You have an unsupported version of ${packageName} installed:
252
+
253
+ ${packageId}@${packageVersion}`);
254
+ clack.note(note ??
255
+ `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`);
256
+ const continueWithUnsupportedVersion = await abortIfCancelled(clack.confirm({
257
+ message: 'Do you want to continue anyway?',
258
+ }));
259
+ Sentry.setTag(`${packageName.toLowerCase()}-continue-with-unsupported-version`, continueWithUnsupportedVersion);
260
+ if (!continueWithUnsupportedVersion) {
261
+ await abort(undefined, 0);
262
+ }
363
263
  });
364
264
  }
365
265
  exports.confirmContinueIfPackageVersionNotSupported = confirmContinueIfPackageVersionNotSupported;
@@ -369,122 +269,70 @@ exports.confirmContinueIfPackageVersionNotSupported = confirmContinueIfPackageVe
369
269
  * IMPORTANT: This function modifies the `package.json`! Be sure to re-read
370
270
  * it if you make additional modifications to it after calling this function!
371
271
  */
372
- function installPackage(_a) {
373
- var packageName = _a.packageName, alreadyInstalled = _a.alreadyInstalled, _b = _a.askBeforeUpdating, askBeforeUpdating = _b === void 0 ? true : _b, packageNameDisplayLabel = _a.packageNameDisplayLabel, packageManager = _a.packageManager, _c = _a.forceInstall, forceInstall = _c === void 0 ? false : _c;
374
- return __awaiter(this, void 0, void 0, function () {
375
- var _this = this;
376
- return __generator(this, function (_d) {
377
- return [2 /*return*/, (0, telemetry_1.traceStep)('install-package', function () { return __awaiter(_this, void 0, void 0, function () {
378
- var shouldUpdatePackage, sdkInstallSpinner, pkgManager, _a, e_1;
379
- return __generator(this, function (_b) {
380
- switch (_b.label) {
381
- case 0:
382
- if (!(alreadyInstalled && askBeforeUpdating)) return [3 /*break*/, 2];
383
- return [4 /*yield*/, abortIfCancelled(clack.confirm({
384
- message: "The ".concat(chalk_1.default.bold.cyan(packageNameDisplayLabel !== null && packageNameDisplayLabel !== void 0 ? packageNameDisplayLabel : packageName), " package is already installed. Do you want to update it to the latest version?"),
385
- }))];
386
- case 1:
387
- shouldUpdatePackage = _b.sent();
388
- if (!shouldUpdatePackage) {
389
- return [2 /*return*/, {}];
390
- }
391
- _b.label = 2;
392
- case 2:
393
- sdkInstallSpinner = clack.spinner();
394
- _a = packageManager;
395
- if (_a) return [3 /*break*/, 4];
396
- return [4 /*yield*/, getPackageManager()];
397
- case 3:
398
- _a = (_b.sent());
399
- _b.label = 4;
400
- case 4:
401
- pkgManager = _a;
402
- sdkInstallSpinner.start("".concat(alreadyInstalled ? 'Updating' : 'Installing', " ").concat(chalk_1.default.bold.cyan(packageNameDisplayLabel !== null && packageNameDisplayLabel !== void 0 ? packageNameDisplayLabel : packageName), " with ").concat(chalk_1.default.bold(pkgManager.label), "."));
403
- _b.label = 5;
404
- case 5:
405
- _b.trys.push([5, 7, , 9]);
406
- return [4 /*yield*/, new Promise(function (resolve, reject) {
407
- childProcess.exec("".concat(pkgManager.installCommand, " ").concat(packageName, " ").concat(pkgManager.flags, " ").concat(forceInstall ? pkgManager.forceInstallFlag : ''), function (err, stdout, stderr) {
408
- if (err) {
409
- // Write a log file so we can better troubleshoot issues
410
- fs.writeFileSync(path.join(process.cwd(), "sentry-wizard-installation-error-".concat(Date.now(), ".log")), JSON.stringify({
411
- stdout: stdout,
412
- stderr: stderr,
413
- }), { encoding: 'utf8' });
414
- reject(err);
415
- }
416
- else {
417
- resolve();
418
- }
419
- });
420
- })];
421
- case 6:
422
- _b.sent();
423
- return [3 /*break*/, 9];
424
- case 7:
425
- e_1 = _b.sent();
426
- sdkInstallSpinner.stop('Installation failed.');
427
- clack.log.error("".concat(chalk_1.default.red('Encountered the following error during installation:'), "\n\n").concat(e_1, "\n\n").concat(chalk_1.default.dim("The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\nhttps://github.com/getsentry/sentry-wizard/issues")));
428
- return [4 /*yield*/, abort()];
429
- case 8:
430
- _b.sent();
431
- return [3 /*break*/, 9];
432
- case 9:
433
- sdkInstallSpinner.stop("".concat(alreadyInstalled ? 'Updated' : 'Installed', " ").concat(chalk_1.default.bold.cyan(packageNameDisplayLabel !== null && packageNameDisplayLabel !== void 0 ? packageNameDisplayLabel : packageName), " with ").concat(chalk_1.default.bold(pkgManager.label), "."));
434
- return [2 /*return*/, { packageManager: pkgManager }];
435
- }
436
- });
437
- }); })];
438
- });
272
+ async function installPackage({ packageName, alreadyInstalled, askBeforeUpdating = true, packageNameDisplayLabel, packageManager, forceInstall = false, }) {
273
+ return (0, telemetry_1.traceStep)('install-package', async () => {
274
+ if (alreadyInstalled && askBeforeUpdating) {
275
+ const shouldUpdatePackage = await abortIfCancelled(clack.confirm({
276
+ message: `The ${chalk_1.default.bold.cyan(packageNameDisplayLabel ?? packageName)} package is already installed. Do you want to update it to the latest version?`,
277
+ }));
278
+ if (!shouldUpdatePackage) {
279
+ return {};
280
+ }
281
+ }
282
+ const sdkInstallSpinner = clack.spinner();
283
+ const pkgManager = packageManager || (await getPackageManager());
284
+ sdkInstallSpinner.start(`${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk_1.default.bold.cyan(packageNameDisplayLabel ?? packageName)} with ${chalk_1.default.bold(pkgManager.label)}.`);
285
+ try {
286
+ await new Promise((resolve, reject) => {
287
+ childProcess.exec(`${pkgManager.installCommand} ${packageName} ${pkgManager.flags} ${forceInstall ? pkgManager.forceInstallFlag : ''}`, (err, stdout, stderr) => {
288
+ if (err) {
289
+ // Write a log file so we can better troubleshoot issues
290
+ fs.writeFileSync((0, node_path_1.join)(process.cwd(), `sentry-wizard-installation-error-${Date.now()}.log`), JSON.stringify({
291
+ stdout,
292
+ stderr,
293
+ }), { encoding: 'utf8' });
294
+ reject(err);
295
+ }
296
+ else {
297
+ resolve();
298
+ }
299
+ });
300
+ });
301
+ }
302
+ catch (e) {
303
+ sdkInstallSpinner.stop('Installation failed.');
304
+ clack.log.error(`${chalk_1.default.red('Encountered the following error during installation:')}\n\n${e}\n\n${chalk_1.default.dim("The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\nhttps://github.com/getsentry/sentry-wizard/issues")}`);
305
+ await abort();
306
+ }
307
+ sdkInstallSpinner.stop(`${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk_1.default.bold.cyan(packageNameDisplayLabel ?? packageName)} with ${chalk_1.default.bold(pkgManager.label)}.`);
308
+ return { packageManager: pkgManager };
439
309
  });
440
310
  }
441
311
  exports.installPackage = installPackage;
442
- function addSentryCliConfig(_a, setupConfig) {
443
- var authToken = _a.authToken, org = _a.org, project = _a.project, url = _a.url;
444
- if (setupConfig === void 0) { setupConfig = exports.rcCliSetupConfig; }
445
- return __awaiter(this, void 0, void 0, function () {
446
- var _this = this;
447
- return __generator(this, function (_b) {
448
- return [2 /*return*/, (0, telemetry_1.traceStep)('add-sentry-cli-config', function () { return __awaiter(_this, void 0, void 0, function () {
449
- var configPath, configExists, configContents, _a;
450
- return __generator(this, function (_b) {
451
- switch (_b.label) {
452
- case 0:
453
- configPath = path.join(process.cwd(), setupConfig.filename);
454
- configExists = fs.existsSync(configPath);
455
- configContents = (configExists && fs.readFileSync(configPath, 'utf8')) || '';
456
- configContents = addAuthTokenToSentryConfig(configContents, authToken, setupConfig);
457
- configContents = addOrgAndProjectToSentryConfig(configContents, org, project, setupConfig);
458
- configContents = addUrlToSentryConfig(configContents, url, setupConfig);
459
- _b.label = 1;
460
- case 1:
461
- _b.trys.push([1, 3, , 4]);
462
- return [4 /*yield*/, fs.promises.writeFile(configPath, configContents, {
463
- encoding: 'utf8',
464
- flag: 'w',
465
- })];
466
- case 2:
467
- _b.sent();
468
- clack.log.success("".concat(configExists ? 'Saved' : 'Created', " ").concat(chalk_1.default.cyan(setupConfig.filename), "."));
469
- return [3 /*break*/, 4];
470
- case 3:
471
- _a = _b.sent();
472
- clack.log.warning("Failed to add auth token to ".concat(chalk_1.default.cyan(setupConfig.filename), ". Uploading ").concat(setupConfig.name, " during build will likely not work locally."));
473
- return [3 /*break*/, 4];
474
- case 4:
475
- if (!setupConfig.gitignore) return [3 /*break*/, 6];
476
- return [4 /*yield*/, addCliConfigFileToGitIgnore(setupConfig.filename)];
477
- case 5:
478
- _b.sent();
479
- return [3 /*break*/, 7];
480
- case 6:
481
- clack.log.warn(chalk_1.default.yellow('DO NOT commit auth token to your repository!'));
482
- _b.label = 7;
483
- case 7: return [2 /*return*/];
484
- }
485
- });
486
- }); })];
487
- });
312
+ async function addSentryCliConfig({ authToken, org, project, url }, setupConfig = exports.rcCliSetupConfig) {
313
+ return (0, telemetry_1.traceStep)('add-sentry-cli-config', async () => {
314
+ const configPath = (0, node_path_1.join)(process.cwd(), setupConfig.filename);
315
+ const configExists = fs.existsSync(configPath);
316
+ let configContents = (configExists && fs.readFileSync(configPath, 'utf8')) || '';
317
+ configContents = addAuthTokenToSentryConfig(configContents, authToken, setupConfig);
318
+ configContents = addOrgAndProjectToSentryConfig(configContents, org, project, setupConfig);
319
+ configContents = addUrlToSentryConfig(configContents, url, setupConfig);
320
+ try {
321
+ await fs.promises.writeFile(configPath, configContents, {
322
+ encoding: 'utf8',
323
+ flag: 'w',
324
+ });
325
+ clack.log.success(`${configExists ? 'Saved' : 'Created'} ${chalk_1.default.cyan(setupConfig.filename)}.`);
326
+ }
327
+ catch {
328
+ clack.log.warning(`Failed to add auth token to ${chalk_1.default.cyan(setupConfig.filename)}. Uploading ${setupConfig.name} during build will likely not work locally.`);
329
+ }
330
+ if (setupConfig.gitignore) {
331
+ await addCliConfigFileToGitIgnore(setupConfig.filename);
332
+ }
333
+ else {
334
+ clack.log.warn(chalk_1.default.yellow('DO NOT commit auth token to your repository!'));
335
+ }
488
336
  });
489
337
  }
490
338
  exports.addSentryCliConfig = addSentryCliConfig;
@@ -493,11 +341,11 @@ function addAuthTokenToSentryConfig(configContents, authToken, setupConfig) {
493
341
  return configContents;
494
342
  }
495
343
  if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {
496
- clack.log.warn("".concat(chalk_1.default.cyan(setupConfig.filename), " already has auth token. Will not add one."));
344
+ clack.log.warn(`${chalk_1.default.cyan(setupConfig.filename)} already has auth token. Will not add one.`);
497
345
  return configContents;
498
346
  }
499
- var newContents = "".concat(configContents, "\n").concat(setupConfig.tokenContent(authToken), "\n");
500
- clack.log.success("Added auth token to ".concat(chalk_1.default.cyan(setupConfig.filename), " for you to test uploading ").concat(setupConfig.name, " locally."));
347
+ const newContents = `${configContents}\n${setupConfig.tokenContent(authToken)}\n`;
348
+ clack.log.success(`Added auth token to ${chalk_1.default.cyan(setupConfig.filename)} for you to test uploading ${setupConfig.name} locally.`);
501
349
  return newContents;
502
350
  }
503
351
  function addOrgAndProjectToSentryConfig(configContents, org, project, setupConfig) {
@@ -505,11 +353,11 @@ function addOrgAndProjectToSentryConfig(configContents, org, project, setupConfi
505
353
  return configContents;
506
354
  }
507
355
  if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {
508
- clack.log.warn("".concat(chalk_1.default.cyan(setupConfig.filename), " already has org and project. Will not add them."));
356
+ clack.log.warn(`${chalk_1.default.cyan(setupConfig.filename)} already has org and project. Will not add them.`);
509
357
  return configContents;
510
358
  }
511
- var newContents = "".concat(configContents, "\n").concat(setupConfig.orgAndProjContent(org, project), "\n");
512
- clack.log.success("Added default org and project to ".concat(chalk_1.default.cyan(setupConfig.filename), " for you to test uploading ").concat(setupConfig.name, " locally."));
359
+ const newContents = `${configContents}\n${setupConfig.orgAndProjContent(org, project)}\n`;
360
+ clack.log.success(`Added default org and project to ${chalk_1.default.cyan(setupConfig.filename)} for you to test uploading ${setupConfig.name} locally.`);
513
361
  return newContents;
514
362
  }
515
363
  function addUrlToSentryConfig(configContents, url, setupConfig) {
@@ -517,166 +365,120 @@ function addUrlToSentryConfig(configContents, url, setupConfig) {
517
365
  return configContents;
518
366
  }
519
367
  if (setupConfig.likelyAlreadyHasUrl(configContents)) {
520
- clack.log.warn("".concat(chalk_1.default.cyan(setupConfig.filename), " already has url. Will not add one."));
368
+ clack.log.warn(`${chalk_1.default.cyan(setupConfig.filename)} already has url. Will not add one.`);
521
369
  return configContents;
522
370
  }
523
- var newContents = "".concat(configContents, "\n").concat(setupConfig.urlContent(url), "\n");
524
- clack.log.success("Added default url to ".concat(chalk_1.default.cyan(setupConfig.filename), " for you to test uploading ").concat(setupConfig.name, " locally."));
371
+ const newContents = `${configContents}\n${setupConfig.urlContent(url)}\n`;
372
+ clack.log.success(`Added default url to ${chalk_1.default.cyan(setupConfig.filename)} for you to test uploading ${setupConfig.name} locally.`);
525
373
  return newContents;
526
374
  }
527
- function addDotEnvSentryBuildPluginFile(authToken) {
528
- return __awaiter(this, void 0, void 0, function () {
529
- var envVarContent, dotEnvFilePath, dotEnvFileExists, dotEnvFileContent, hasAuthToken, _a, _b;
530
- return __generator(this, function (_c) {
531
- switch (_c.label) {
532
- case 0:
533
- envVarContent = "# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own `.env` files and remove this file.\nSENTRY_AUTH_TOKEN=".concat(authToken, "\n");
534
- dotEnvFilePath = path.join(process.cwd(), exports.SENTRY_DOT_ENV_FILE);
535
- dotEnvFileExists = fs.existsSync(dotEnvFilePath);
536
- if (!dotEnvFileExists) return [3 /*break*/, 5];
537
- dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');
538
- hasAuthToken = !!dotEnvFileContent.match(/^\s*SENTRY_AUTH_TOKEN\s*=/g);
539
- if (!hasAuthToken) return [3 /*break*/, 1];
540
- clack.log.warn("".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), " already has auth token. Will not add one."));
541
- return [3 /*break*/, 4];
542
- case 1:
543
- _c.trys.push([1, 3, , 4]);
544
- return [4 /*yield*/, fs.promises.writeFile(dotEnvFilePath, "".concat(dotEnvFileContent, "\n").concat(envVarContent), {
545
- encoding: 'utf8',
546
- flag: 'w',
547
- })];
548
- case 2:
549
- _c.sent();
550
- clack.log.success("Added auth token to ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)));
551
- return [3 /*break*/, 4];
552
- case 3:
553
- _a = _c.sent();
554
- clack.log.warning("Failed to add auth token to ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), ". Uploading source maps during build will likely not work locally."));
555
- return [3 /*break*/, 4];
556
- case 4: return [3 /*break*/, 8];
557
- case 5:
558
- _c.trys.push([5, 7, , 8]);
559
- return [4 /*yield*/, fs.promises.writeFile(dotEnvFilePath, envVarContent, {
560
- encoding: 'utf8',
561
- flag: 'w',
562
- })];
563
- case 6:
564
- _c.sent();
565
- clack.log.success("Created ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), " with auth token for you to test source map uploading locally."));
566
- return [3 /*break*/, 8];
567
- case 7:
568
- _b = _c.sent();
569
- clack.log.warning("Failed to create ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), " with auth token. Uploading source maps during build will likely not work locally."));
570
- return [3 /*break*/, 8];
571
- case 8: return [4 /*yield*/, addCliConfigFileToGitIgnore(exports.SENTRY_DOT_ENV_FILE)];
572
- case 9:
573
- _c.sent();
574
- return [2 /*return*/];
375
+ async function addDotEnvSentryBuildPluginFile(authToken) {
376
+ const envVarContent = `# DO NOT commit this file to your repository!
377
+ # The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.
378
+ # It's used for authentication when uploading source maps.
379
+ # You can also set this env variable in your own \`.env\` files and remove this file.
380
+ SENTRY_AUTH_TOKEN=${authToken}
381
+ `;
382
+ const dotEnvFilePath = (0, node_path_1.join)(process.cwd(), exports.SENTRY_DOT_ENV_FILE);
383
+ const dotEnvFileExists = fs.existsSync(dotEnvFilePath);
384
+ if (dotEnvFileExists) {
385
+ const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');
386
+ const hasAuthToken = !!dotEnvFileContent.match(/^\s*SENTRY_AUTH_TOKEN\s*=/g);
387
+ if (hasAuthToken) {
388
+ clack.log.warn(`${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)} already has auth token. Will not add one.`);
389
+ }
390
+ else {
391
+ try {
392
+ await fs.promises.writeFile(dotEnvFilePath, `${dotEnvFileContent}\n${envVarContent}`, {
393
+ encoding: 'utf8',
394
+ flag: 'w',
395
+ });
396
+ clack.log.success(`Added auth token to ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)}`);
575
397
  }
576
- });
577
- });
398
+ catch {
399
+ clack.log.warning(`Failed to add auth token to ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)}. Uploading source maps during build will likely not work locally.`);
400
+ }
401
+ }
402
+ }
403
+ else {
404
+ try {
405
+ await fs.promises.writeFile(dotEnvFilePath, envVarContent, {
406
+ encoding: 'utf8',
407
+ flag: 'w',
408
+ });
409
+ clack.log.success(`Created ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)} with auth token for you to test source map uploading locally.`);
410
+ }
411
+ catch {
412
+ clack.log.warning(`Failed to create ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)} with auth token. Uploading source maps during build will likely not work locally.`);
413
+ }
414
+ }
415
+ await addCliConfigFileToGitIgnore(exports.SENTRY_DOT_ENV_FILE);
578
416
  }
579
417
  exports.addDotEnvSentryBuildPluginFile = addDotEnvSentryBuildPluginFile;
580
- function addCliConfigFileToGitIgnore(filename) {
581
- return __awaiter(this, void 0, void 0, function () {
582
- var gitignorePath, gitignoreContent, _a;
583
- return __generator(this, function (_b) {
584
- switch (_b.label) {
585
- case 0:
586
- gitignorePath = path.join(process.cwd(), '.gitignore');
587
- _b.label = 1;
588
- case 1:
589
- _b.trys.push([1, 4, , 5]);
590
- return [4 /*yield*/, fs.promises.readFile(gitignorePath, 'utf8')];
591
- case 2:
592
- gitignoreContent = _b.sent();
593
- if (gitignoreContent.split(/\r?\n/).includes(filename)) {
594
- clack.log.info("".concat(chalk_1.default.bold('.gitignore'), " already has ").concat(chalk_1.default.bold(filename), ". Will not add it again."));
595
- return [2 /*return*/];
596
- }
597
- return [4 /*yield*/, fs.promises.appendFile(gitignorePath, "\n# Sentry Config File\n".concat(filename, "\n"), { encoding: 'utf8' })];
598
- case 3:
599
- _b.sent();
600
- clack.log.success("Added ".concat(chalk_1.default.cyan(filename), " to ").concat(chalk_1.default.cyan('.gitignore'), "."));
601
- return [3 /*break*/, 5];
602
- case 4:
603
- _a = _b.sent();
604
- clack.log.error("Failed adding ".concat(chalk_1.default.cyan(filename), " to ").concat(chalk_1.default.cyan('.gitignore'), ". Please add it manually!"));
605
- return [3 /*break*/, 5];
606
- case 5: return [2 /*return*/];
607
- }
608
- });
609
- });
418
+ async function addCliConfigFileToGitIgnore(filename) {
419
+ const gitignorePath = (0, node_path_1.join)(process.cwd(), '.gitignore');
420
+ try {
421
+ const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');
422
+ if (gitignoreContent.split(/\r?\n/).includes(filename)) {
423
+ clack.log.info(`${chalk_1.default.bold('.gitignore')} already has ${chalk_1.default.bold(filename)}. Will not add it again.`);
424
+ return;
425
+ }
426
+ await fs.promises.appendFile(gitignorePath, `\n# Sentry Config File\n${filename}\n`, { encoding: 'utf8' });
427
+ clack.log.success(`Added ${chalk_1.default.cyan(filename)} to ${chalk_1.default.cyan('.gitignore')}.`);
428
+ }
429
+ catch {
430
+ clack.log.error(`Failed adding ${chalk_1.default.cyan(filename)} to ${chalk_1.default.cyan('.gitignore')}. Please add it manually!`);
431
+ }
610
432
  }
611
- function runPrettierIfInstalled() {
612
- return __awaiter(this, void 0, void 0, function () {
613
- var _this = this;
614
- return __generator(this, function (_a) {
615
- return [2 /*return*/, (0, telemetry_1.traceStep)('run-prettier', function () { return __awaiter(_this, void 0, void 0, function () {
616
- var changedOrUntrackedFiles, packageJson, prettierInstalled, shouldRunPrettier, prettierSpinner, e_2;
617
- return __generator(this, function (_a) {
618
- switch (_a.label) {
619
- case 0:
620
- if (!isInGitRepo()) {
621
- // We only run formatting on changed files. If we're not in a git repo, we can't find
622
- // changed files. So let's early-return without showing any formatting-related messages.
623
- return [2 /*return*/];
624
- }
625
- changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()
626
- .map(function (filename) {
627
- return filename.startsWith('- ') ? filename.slice(2) : filename;
628
- })
629
- .join(' ');
630
- if (!changedOrUntrackedFiles.length) {
631
- // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.
632
- return [2 /*return*/];
633
- }
634
- return [4 /*yield*/, getPackageDotJson()];
635
- case 1:
636
- packageJson = _a.sent();
637
- prettierInstalled = (0, package_json_1.hasPackageInstalled)('prettier', packageJson);
638
- Sentry.setTag('prettier-installed', prettierInstalled);
639
- if (!prettierInstalled) {
640
- return [2 /*return*/];
641
- }
642
- return [4 /*yield*/, abortIfCancelled(clack.confirm({
643
- message: 'Looks like you have Prettier in your project. Do you want to run it on your files?',
644
- }))];
645
- case 2:
646
- shouldRunPrettier = _a.sent();
647
- if (!shouldRunPrettier) {
648
- return [2 /*return*/];
649
- }
650
- prettierSpinner = clack.spinner();
651
- prettierSpinner.start('Running Prettier on your files.');
652
- _a.label = 3;
653
- case 3:
654
- _a.trys.push([3, 5, , 6]);
655
- return [4 /*yield*/, new Promise(function (resolve, reject) {
656
- childProcess.exec("npx prettier --ignore-unknown --write ".concat(changedOrUntrackedFiles), function (err) {
657
- if (err) {
658
- reject(err);
659
- }
660
- else {
661
- resolve();
662
- }
663
- });
664
- })];
665
- case 4:
666
- _a.sent();
667
- return [3 /*break*/, 6];
668
- case 5:
669
- e_2 = _a.sent();
670
- prettierSpinner.stop('Prettier failed to run.');
671
- clack.log.warn('Prettier failed to run. There may be formatting issues in your updated files.');
672
- return [2 /*return*/];
673
- case 6:
674
- prettierSpinner.stop('Prettier has formatted your files.');
675
- return [2 /*return*/];
676
- }
677
- });
678
- }); })];
679
- });
433
+ async function runPrettierIfInstalled() {
434
+ return (0, telemetry_1.traceStep)('run-prettier', async () => {
435
+ if (!isInGitRepo()) {
436
+ // We only run formatting on changed files. If we're not in a git repo, we can't find
437
+ // changed files. So let's early-return without showing any formatting-related messages.
438
+ return;
439
+ }
440
+ const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()
441
+ .map((filename) => {
442
+ return filename.startsWith('- ') ? filename.slice(2) : filename;
443
+ })
444
+ .join(' ');
445
+ if (!changedOrUntrackedFiles.length) {
446
+ // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.
447
+ return;
448
+ }
449
+ const packageJson = await getPackageDotJson();
450
+ const prettierInstalled = (0, package_json_1.hasPackageInstalled)('prettier', packageJson);
451
+ Sentry.setTag('prettier-installed', prettierInstalled);
452
+ if (!prettierInstalled) {
453
+ return;
454
+ }
455
+ // prompt the user if they want to run prettier
456
+ const shouldRunPrettier = await abortIfCancelled(clack.confirm({
457
+ message: 'Looks like you have Prettier in your project. Do you want to run it on your files?',
458
+ }));
459
+ if (!shouldRunPrettier) {
460
+ return;
461
+ }
462
+ const prettierSpinner = clack.spinner();
463
+ prettierSpinner.start('Running Prettier on your files.');
464
+ try {
465
+ await new Promise((resolve, reject) => {
466
+ childProcess.exec(`npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`, (err) => {
467
+ if (err) {
468
+ reject(err);
469
+ }
470
+ else {
471
+ resolve();
472
+ }
473
+ });
474
+ });
475
+ }
476
+ catch (e) {
477
+ prettierSpinner.stop('Prettier failed to run.');
478
+ clack.log.warn('Prettier failed to run. There may be formatting issues in your updated files.');
479
+ return;
480
+ }
481
+ prettierSpinner.stop('Prettier has formatted your files.');
680
482
  });
681
483
  }
682
484
  exports.runPrettierIfInstalled = runPrettierIfInstalled;
@@ -690,131 +492,78 @@ exports.runPrettierIfInstalled = runPrettierIfInstalled;
690
492
  * @param packageId the npm name of the package
691
493
  * @param packageName a human readable name of the package
692
494
  */
693
- function ensurePackageIsInstalled(packageJson, packageId, packageName) {
694
- return __awaiter(this, void 0, void 0, function () {
695
- var _this = this;
696
- return __generator(this, function (_a) {
697
- return [2 /*return*/, (0, telemetry_1.traceStep)('ensure-package-installed', function () { return __awaiter(_this, void 0, void 0, function () {
698
- var installed, continueWithoutPackage;
699
- return __generator(this, function (_a) {
700
- switch (_a.label) {
701
- case 0:
702
- installed = (0, package_json_1.hasPackageInstalled)(packageId, packageJson);
703
- Sentry.setTag("".concat(packageName.toLowerCase(), "-installed"), installed);
704
- if (!!installed) return [3 /*break*/, 3];
705
- Sentry.setTag("".concat(packageName.toLowerCase(), "-installed"), false);
706
- return [4 /*yield*/, abortIfCancelled(clack.confirm({
707
- message: "".concat(packageName, " does not seem to be installed. Do you still want to continue?"),
708
- initialValue: false,
709
- }))];
710
- case 1:
711
- continueWithoutPackage = _a.sent();
712
- if (!!continueWithoutPackage) return [3 /*break*/, 3];
713
- return [4 /*yield*/, abort(undefined, 0)];
714
- case 2:
715
- _a.sent();
716
- _a.label = 3;
717
- case 3: return [2 /*return*/];
718
- }
719
- });
720
- }); })];
721
- });
495
+ async function ensurePackageIsInstalled(packageJson, packageId, packageName) {
496
+ return (0, telemetry_1.traceStep)('ensure-package-installed', async () => {
497
+ const installed = (0, package_json_1.hasPackageInstalled)(packageId, packageJson);
498
+ Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);
499
+ if (!installed) {
500
+ Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);
501
+ const continueWithoutPackage = await abortIfCancelled(clack.confirm({
502
+ message: `${packageName} does not seem to be installed. Do you still want to continue?`,
503
+ initialValue: false,
504
+ }));
505
+ if (!continueWithoutPackage) {
506
+ await abort(undefined, 0);
507
+ }
508
+ }
722
509
  });
723
510
  }
724
511
  exports.ensurePackageIsInstalled = ensurePackageIsInstalled;
725
- function getPackageDotJson() {
726
- return __awaiter(this, void 0, void 0, function () {
727
- var packageJsonFileContents, packageJson, _a;
728
- return __generator(this, function (_b) {
729
- switch (_b.label) {
730
- case 0: return [4 /*yield*/, fs.promises
731
- .readFile(path.join(process.cwd(), 'package.json'), 'utf8')
732
- .catch(function () {
733
- clack.log.error('Could not find package.json. Make sure to run the wizard in the root of your app!');
734
- return abort();
735
- })];
736
- case 1:
737
- packageJsonFileContents = _b.sent();
738
- packageJson = undefined;
739
- _b.label = 2;
740
- case 2:
741
- _b.trys.push([2, 3, , 5]);
742
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
743
- packageJson = JSON.parse(packageJsonFileContents);
744
- return [3 /*break*/, 5];
745
- case 3:
746
- _a = _b.sent();
747
- clack.log.error("Unable to parse your ".concat(chalk_1.default.cyan('package.json'), ". Make sure it has a valid format!"));
748
- return [4 /*yield*/, abort()];
749
- case 4:
750
- _b.sent();
751
- return [3 /*break*/, 5];
752
- case 5: return [2 /*return*/, packageJson || {}];
753
- }
754
- });
512
+ async function getPackageDotJson() {
513
+ const packageJsonFileContents = await fs.promises
514
+ .readFile((0, node_path_1.join)(process.cwd(), 'package.json'), 'utf8')
515
+ .catch(() => {
516
+ clack.log.error('Could not find package.json. Make sure to run the wizard in the root of your app!');
517
+ return abort();
755
518
  });
519
+ let packageJson = undefined;
520
+ try {
521
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
522
+ packageJson = JSON.parse(packageJsonFileContents);
523
+ }
524
+ catch {
525
+ clack.log.error(`Unable to parse your ${chalk_1.default.cyan('package.json')}. Make sure it has a valid format!`);
526
+ await abort();
527
+ }
528
+ return packageJson || {};
756
529
  }
757
530
  exports.getPackageDotJson = getPackageDotJson;
758
- function updatePackageDotJson(packageDotJson) {
759
- return __awaiter(this, void 0, void 0, function () {
760
- var _a;
761
- return __generator(this, function (_b) {
762
- switch (_b.label) {
763
- case 0:
764
- _b.trys.push([0, 2, , 4]);
765
- return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), 'package.json'),
766
- // TODO: maybe figure out the original indentation
767
- JSON.stringify(packageDotJson, null, 2), {
768
- encoding: 'utf8',
769
- flag: 'w',
770
- })];
771
- case 1:
772
- _b.sent();
773
- return [3 /*break*/, 4];
774
- case 2:
775
- _a = _b.sent();
776
- clack.log.error("Unable to update your ".concat(chalk_1.default.cyan('package.json'), "."));
777
- return [4 /*yield*/, abort()];
778
- case 3:
779
- _b.sent();
780
- return [3 /*break*/, 4];
781
- case 4: return [2 /*return*/];
782
- }
531
+ async function updatePackageDotJson(packageDotJson) {
532
+ try {
533
+ await fs.promises.writeFile((0, node_path_1.join)(process.cwd(), 'package.json'),
534
+ // TODO: maybe figure out the original indentation
535
+ JSON.stringify(packageDotJson, null, 2), {
536
+ encoding: 'utf8',
537
+ flag: 'w',
783
538
  });
784
- });
539
+ }
540
+ catch {
541
+ clack.log.error(`Unable to update your ${chalk_1.default.cyan('package.json')}.`);
542
+ await abort();
543
+ }
785
544
  }
786
545
  exports.updatePackageDotJson = updatePackageDotJson;
787
- function getPackageManager() {
788
- return __awaiter(this, void 0, void 0, function () {
789
- var detectedPackageManager, selectedPackageManager;
790
- return __generator(this, function (_a) {
791
- switch (_a.label) {
792
- case 0:
793
- detectedPackageManager = (0, package_manager_1.detectPackageManger)();
794
- if (detectedPackageManager) {
795
- return [2 /*return*/, detectedPackageManager];
796
- }
797
- return [4 /*yield*/, abortIfCancelled(clack.select({
798
- message: 'Please select your package manager.',
799
- options: package_manager_1.packageManagers.map(function (packageManager) { return ({
800
- value: packageManager,
801
- label: packageManager.label,
802
- }); }),
803
- }))];
804
- case 1:
805
- selectedPackageManager = _a.sent();
806
- Sentry.setTag('package-manager', selectedPackageManager.name);
807
- return [2 /*return*/, selectedPackageManager];
808
- }
809
- });
810
- });
546
+ async function getPackageManager() {
547
+ const detectedPackageManager = (0, package_manager_1.detectPackageManger)();
548
+ if (detectedPackageManager) {
549
+ return detectedPackageManager;
550
+ }
551
+ const selectedPackageManager = await abortIfCancelled(clack.select({
552
+ message: 'Please select your package manager.',
553
+ options: package_manager_1.packageManagers.map((packageManager) => ({
554
+ value: packageManager,
555
+ label: packageManager.label,
556
+ })),
557
+ }));
558
+ Sentry.setTag('package-manager', selectedPackageManager.name);
559
+ return selectedPackageManager;
811
560
  }
812
561
  exports.getPackageManager = getPackageManager;
813
562
  function isUsingTypeScript() {
814
563
  try {
815
- return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));
564
+ return fs.existsSync((0, node_path_1.join)(process.cwd(), 'tsconfig.json'));
816
565
  }
817
- catch (_a) {
566
+ catch {
818
567
  return false;
819
568
  }
820
569
  }
@@ -830,64 +579,49 @@ exports.isUsingTypeScript = isUsingTypeScript;
830
579
  * @param platform the platform of the wizard
831
580
  * @returns project data (org, project, token, url)
832
581
  */
833
- function getOrAskForProjectData(options, platform) {
834
- var _a;
835
- return __awaiter(this, void 0, void 0, function () {
836
- var _b, sentryUrl, selfHosted, _c, projects, apiKeys, selectedProject, token;
837
- return __generator(this, function (_d) {
838
- switch (_d.label) {
839
- case 0:
840
- if (options.preSelectedProject) {
841
- return [2 /*return*/, {
842
- selfHosted: options.preSelectedProject.selfHosted,
843
- sentryUrl: (_a = options.url) !== null && _a !== void 0 ? _a : SAAS_URL,
844
- authToken: options.preSelectedProject.authToken,
845
- selectedProject: options.preSelectedProject.project,
846
- }];
847
- }
848
- return [4 /*yield*/, (0, telemetry_1.traceStep)('ask-self-hosted', function () { return askForSelfHosted(options.url, options.saas); })];
849
- case 1:
850
- _b = _d.sent(), sentryUrl = _b.url, selfHosted = _b.selfHosted;
851
- return [4 /*yield*/, (0, telemetry_1.traceStep)('login', function () {
852
- return askForWizardLogin({
853
- promoCode: options.promoCode,
854
- url: sentryUrl,
855
- platform: platform,
856
- orgSlug: options.orgSlug,
857
- projectSlug: options.projectSlug,
858
- });
859
- })];
860
- case 2:
861
- _c = _d.sent(), projects = _c.projects, apiKeys = _c.apiKeys;
862
- if (!(!projects || !projects.length)) return [3 /*break*/, 4];
863
- clack.log.error('No projects found. Please create a project in Sentry and try again.');
864
- Sentry.setTag('no-projects-found', true);
865
- return [4 /*yield*/, abort()];
866
- case 3:
867
- _d.sent();
868
- // This rejection won't return due to the abort call but TS doesn't know that
869
- return [2 /*return*/, Promise.reject()];
870
- case 4: return [4 /*yield*/, (0, telemetry_1.traceStep)('select-project', function () {
871
- return askForProjectSelection(projects, options.orgSlug, options.projectSlug);
872
- })];
873
- case 5:
874
- selectedProject = _d.sent();
875
- token = (apiKeys !== null && apiKeys !== void 0 ? apiKeys : {}).token;
876
- if (!token) {
877
- clack.log.error("Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n".concat(chalk_1.default.cyan('https://github.com/getsentry/sentry-wizard/issues')));
878
- clack.log.info("In the meantime, we'll add a dummy auth token (".concat(chalk_1.default.cyan("\"".concat(DUMMY_AUTH_TOKEN, "\"")), ") for you to replace later.\nCreate your auth token here:\n").concat(chalk_1.default.cyan(selfHosted
879
- ? "".concat(sentryUrl, "organizations/").concat(selectedProject.organization.slug, "/settings/auth-tokens")
880
- : "https://".concat(selectedProject.organization.slug, ".sentry.io/settings/auth-tokens"))));
881
- }
882
- return [2 /*return*/, {
883
- sentryUrl: sentryUrl,
884
- selfHosted: selfHosted,
885
- authToken: (apiKeys === null || apiKeys === void 0 ? void 0 : apiKeys.token) || DUMMY_AUTH_TOKEN,
886
- selectedProject: selectedProject,
887
- }];
888
- }
889
- });
890
- });
582
+ async function getOrAskForProjectData(options, platform) {
583
+ if (options.preSelectedProject) {
584
+ return {
585
+ selfHosted: options.preSelectedProject.selfHosted,
586
+ sentryUrl: options.url ?? SAAS_URL,
587
+ authToken: options.preSelectedProject.authToken,
588
+ selectedProject: options.preSelectedProject.project,
589
+ };
590
+ }
591
+ const { url: sentryUrl, selfHosted } = await (0, telemetry_1.traceStep)('ask-self-hosted', () => askForSelfHosted(options.url, options.saas));
592
+ const { projects, apiKeys } = await (0, telemetry_1.traceStep)('login', () => askForWizardLogin({
593
+ promoCode: options.promoCode,
594
+ url: sentryUrl,
595
+ platform: platform,
596
+ orgSlug: options.orgSlug,
597
+ projectSlug: options.projectSlug,
598
+ }));
599
+ if (!projects || !projects.length) {
600
+ clack.log.error('No projects found. Please create a project in Sentry and try again.');
601
+ Sentry.setTag('no-projects-found', true);
602
+ await abort();
603
+ // This rejection won't return due to the abort call but TS doesn't know that
604
+ return Promise.reject();
605
+ }
606
+ const selectedProject = await (0, telemetry_1.traceStep)('select-project', () => askForProjectSelection(projects, options.orgSlug, options.projectSlug));
607
+ const { token } = apiKeys ?? {};
608
+ if (!token) {
609
+ clack.log.error(`Didn't receive an auth token. This shouldn't happen :(
610
+
611
+ Please let us know if you think this is a bug in the wizard:
612
+ ${chalk_1.default.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);
613
+ clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk_1.default.cyan(`"${DUMMY_AUTH_TOKEN}"`)}) for you to replace later.
614
+ Create your auth token here:
615
+ ${chalk_1.default.cyan(selfHosted
616
+ ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`
617
+ : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`)}`);
618
+ }
619
+ return {
620
+ sentryUrl,
621
+ selfHosted,
622
+ authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,
623
+ selectedProject,
624
+ };
891
625
  }
892
626
  exports.getOrAskForProjectData = getOrAskForProjectData;
893
627
  /**
@@ -899,225 +633,173 @@ exports.getOrAskForProjectData = getOrAskForProjectData;
899
633
  *
900
634
  * @param urlFromArgs the url passed via the --url arg
901
635
  */
902
- function askForSelfHosted(urlFromArgs, saas) {
903
- return __awaiter(this, void 0, void 0, function () {
904
- var choice, validUrl, tmpUrlFromArgs, url, _a, isSelfHostedUrl;
905
- return __generator(this, function (_b) {
906
- switch (_b.label) {
907
- case 0:
908
- if (saas) {
909
- Sentry.setTag('url', SAAS_URL);
910
- Sentry.setTag('self-hosted', false);
911
- return [2 /*return*/, { url: SAAS_URL, selfHosted: false }];
912
- }
913
- if (!!urlFromArgs) return [3 /*break*/, 2];
914
- return [4 /*yield*/, abortIfCancelled(clack.select({
915
- message: 'Are you using Sentry SaaS or self-hosted Sentry?',
916
- options: [
917
- { value: 'saas', label: 'Sentry SaaS (sentry.io)' },
918
- {
919
- value: 'self-hosted',
920
- label: 'Self-hosted/on-premise/single-tenant',
921
- },
922
- ],
923
- }))];
924
- case 1:
925
- choice = _b.sent();
926
- if (choice === 'saas') {
927
- Sentry.setTag('url', SAAS_URL);
928
- Sentry.setTag('self-hosted', false);
929
- return [2 /*return*/, { url: SAAS_URL, selfHosted: false }];
930
- }
931
- _b.label = 2;
932
- case 2:
933
- tmpUrlFromArgs = urlFromArgs;
934
- _b.label = 3;
935
- case 3:
936
- if (!(validUrl === undefined)) return [3 /*break*/, 6];
937
- _a = tmpUrlFromArgs;
938
- if (_a) return [3 /*break*/, 5];
939
- return [4 /*yield*/, abortIfCancelled(clack.text({
940
- message: "Please enter the URL of your ".concat(urlFromArgs ? '' : 'self-hosted ', "Sentry instance."),
941
- placeholder: 'https://sentry.io/',
942
- }))];
943
- case 4:
944
- _a = (_b.sent());
945
- _b.label = 5;
946
- case 5:
947
- url = _a;
948
- tmpUrlFromArgs = undefined;
949
- try {
950
- validUrl = new url_1.URL(url).toString();
951
- // We assume everywhere else that the URL ends in a slash
952
- if (!validUrl.endsWith('/')) {
953
- validUrl += '/';
954
- }
955
- }
956
- catch (_c) {
957
- clack.log.error("Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ".concat(url, ")"));
958
- }
959
- return [3 /*break*/, 3];
960
- case 6:
961
- isSelfHostedUrl = new url_1.URL(validUrl).host !== new url_1.URL(SAAS_URL).host;
962
- Sentry.setTag('url', validUrl);
963
- Sentry.setTag('self-hosted', isSelfHostedUrl);
964
- return [2 /*return*/, { url: validUrl, selfHosted: true }];
636
+ async function askForSelfHosted(urlFromArgs, saas) {
637
+ if (saas) {
638
+ Sentry.setTag('url', SAAS_URL);
639
+ Sentry.setTag('self-hosted', false);
640
+ return { url: SAAS_URL, selfHosted: false };
641
+ }
642
+ if (!urlFromArgs) {
643
+ const choice = await abortIfCancelled(clack.select({
644
+ message: 'Are you using Sentry SaaS or self-hosted Sentry?',
645
+ options: [
646
+ { value: 'saas', label: 'Sentry SaaS (sentry.io)' },
647
+ {
648
+ value: 'self-hosted',
649
+ label: 'Self-hosted/on-premise/single-tenant',
650
+ },
651
+ ],
652
+ }));
653
+ if (choice === 'saas') {
654
+ Sentry.setTag('url', SAAS_URL);
655
+ Sentry.setTag('self-hosted', false);
656
+ return { url: SAAS_URL, selfHosted: false };
657
+ }
658
+ }
659
+ let validUrl;
660
+ let tmpUrlFromArgs = urlFromArgs;
661
+ while (validUrl === undefined) {
662
+ const url = tmpUrlFromArgs ||
663
+ (await abortIfCancelled(clack.text({
664
+ message: `Please enter the URL of your ${urlFromArgs ? '' : 'self-hosted '}Sentry instance.`,
665
+ placeholder: 'https://sentry.io/',
666
+ })));
667
+ tmpUrlFromArgs = undefined;
668
+ try {
669
+ validUrl = new node_url_1.URL(url).toString();
670
+ // We assume everywhere else that the URL ends in a slash
671
+ if (!validUrl.endsWith('/')) {
672
+ validUrl += '/';
965
673
  }
966
- });
674
+ }
675
+ catch {
676
+ clack.log.error(`Please enter a valid URL. (It should look something like "https://sentry.mydomain.com/", got ${url})`);
677
+ }
678
+ }
679
+ const isSelfHostedUrl = new node_url_1.URL(validUrl).host !== new node_url_1.URL(SAAS_URL).host;
680
+ Sentry.setTag('url', validUrl);
681
+ Sentry.setTag('self-hosted', isSelfHostedUrl);
682
+ return { url: validUrl, selfHosted: true };
683
+ }
684
+ async function askForWizardLogin(options) {
685
+ Sentry.setTag('has-promo-code', !!options.promoCode);
686
+ let hasSentryAccount = await clack.confirm({
687
+ message: 'Do you already have a Sentry account?',
967
688
  });
968
- }
969
- function askForWizardLogin(options) {
970
- return __awaiter(this, void 0, void 0, function () {
971
- var hasSentryAccount, wizardHash, e_3, loginUrl, urlToOpen, loginSpinner, data;
972
- return __generator(this, function (_a) {
973
- switch (_a.label) {
974
- case 0:
975
- Sentry.setTag('has-promo-code', !!options.promoCode);
976
- return [4 /*yield*/, clack.confirm({
977
- message: 'Do you already have a Sentry account?',
978
- })];
979
- case 1:
980
- hasSentryAccount = _a.sent();
981
- return [4 /*yield*/, abortIfCancelled(hasSentryAccount)];
982
- case 2:
983
- hasSentryAccount = _a.sent();
984
- Sentry.setTag('already-has-sentry-account', hasSentryAccount);
985
- _a.label = 3;
986
- case 3:
987
- _a.trys.push([3, 5, , 10]);
988
- return [4 /*yield*/, axios_1.default.get("".concat(options.url, "api/0/wizard/"))];
989
- case 4:
990
- wizardHash = (_a.sent()).data.hash;
991
- return [3 /*break*/, 10];
992
- case 5:
993
- e_3 = _a.sent();
994
- if (!(options.url !== SAAS_URL)) return [3 /*break*/, 7];
995
- clack.log.error('Loading Wizard failed. Did you provide the right URL?');
996
- clack.log.info(JSON.stringify(e_3, null, 2));
997
- return [4 /*yield*/, abort(chalk_1.default.red('Please check your configuration and try again.\n\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues'))];
998
- case 6:
999
- _a.sent();
1000
- return [3 /*break*/, 9];
1001
- case 7:
1002
- clack.log.error('Loading Wizard failed.');
1003
- clack.log.info(JSON.stringify(e_3, null, 2));
1004
- return [4 /*yield*/, abort(chalk_1.default.red('Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues'))];
1005
- case 8:
1006
- _a.sent();
1007
- _a.label = 9;
1008
- case 9: return [3 /*break*/, 10];
1009
- case 10:
1010
- loginUrl = new url_1.URL("".concat(options.url, "account/settings/wizard/").concat(wizardHash, "/"));
1011
- if (options.orgSlug) {
1012
- loginUrl.searchParams.set('org_slug', options.orgSlug);
1013
- }
1014
- if (options.projectSlug) {
1015
- loginUrl.searchParams.set('project_slug', options.projectSlug);
1016
- }
1017
- if (!hasSentryAccount) {
1018
- loginUrl.searchParams.set('signup', '1');
1019
- }
1020
- if (options.platform) {
1021
- loginUrl.searchParams.set('project_platform', options.platform);
1022
- }
1023
- if (options.promoCode) {
1024
- loginUrl.searchParams.set('code', options.promoCode);
1025
- }
1026
- urlToOpen = loginUrl.toString();
1027
- clack.log.info("".concat(chalk_1.default.bold("If the browser window didn't open automatically, please open the following link to ".concat(hasSentryAccount ? 'log' : 'sign', " into Sentry:")), "\n\n").concat(chalk_1.default.cyan(urlToOpen)));
1028
- (0, exports.opn)(urlToOpen, { wait: false }).catch(function () {
1029
- // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
1030
- });
1031
- loginSpinner = clack.spinner();
1032
- loginSpinner.start('Waiting for you to log in using the link above');
1033
- return [4 /*yield*/, new Promise(function (resolve) {
1034
- var pollingInterval = (0, timers_1.setInterval)(function () {
1035
- axios_1.default
1036
- .get("".concat(options.url, "api/0/wizard/").concat(wizardHash, "/"), {
1037
- headers: {
1038
- 'Accept-Encoding': 'deflate',
1039
- },
1040
- })
1041
- .then(function (result) {
1042
- resolve(result.data);
1043
- clearTimeout(timeout);
1044
- clearInterval(pollingInterval);
1045
- void axios_1.default.delete("".concat(options.url, "api/0/wizard/").concat(wizardHash, "/"));
1046
- })
1047
- .catch(function () {
1048
- // noop - just try again
1049
- });
1050
- }, 500);
1051
- var timeout = setTimeout(function () {
1052
- clearInterval(pollingInterval);
1053
- loginSpinner.stop('Login timed out. No worries - it happens to the best of us.');
1054
- Sentry.setTag('opened-wizard-link', false);
1055
- void abort('Please restart the Wizard and log in to complete the setup.');
1056
- }, 180000);
1057
- })];
1058
- case 11:
1059
- data = _a.sent();
1060
- loginSpinner.stop('Login complete.');
1061
- Sentry.setTag('opened-wizard-link', true);
1062
- return [2 /*return*/, data];
1063
- }
1064
- });
689
+ hasSentryAccount = await abortIfCancelled(hasSentryAccount);
690
+ Sentry.setTag('already-has-sentry-account', hasSentryAccount);
691
+ let wizardHash;
692
+ try {
693
+ wizardHash = (await axios_1.default.get(`${options.url}api/0/wizard/`)).data.hash;
694
+ }
695
+ catch (e) {
696
+ if (options.url !== SAAS_URL) {
697
+ clack.log.error('Loading Wizard failed. Did you provide the right URL?');
698
+ clack.log.info(JSON.stringify(e, null, 2));
699
+ await abort(chalk_1.default.red('Please check your configuration and try again.\n\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues'));
700
+ }
701
+ else {
702
+ clack.log.error('Loading Wizard failed.');
703
+ clack.log.info(JSON.stringify(e, null, 2));
704
+ await abort(chalk_1.default.red('Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues'));
705
+ }
706
+ }
707
+ const loginUrl = new node_url_1.URL(`${options.url}account/settings/wizard/${wizardHash}/`);
708
+ if (options.orgSlug) {
709
+ loginUrl.searchParams.set('org_slug', options.orgSlug);
710
+ }
711
+ if (options.projectSlug) {
712
+ loginUrl.searchParams.set('project_slug', options.projectSlug);
713
+ }
714
+ if (!hasSentryAccount) {
715
+ loginUrl.searchParams.set('signup', '1');
716
+ }
717
+ if (options.platform) {
718
+ loginUrl.searchParams.set('project_platform', options.platform);
719
+ }
720
+ if (options.promoCode) {
721
+ loginUrl.searchParams.set('code', options.promoCode);
722
+ }
723
+ const urlToOpen = loginUrl.toString();
724
+ clack.log.info(`${chalk_1.default.bold(`If the browser window didn't open automatically, please open the following link to ${hasSentryAccount ? 'log' : 'sign'} into Sentry:`)}\n\n${chalk_1.default.cyan(urlToOpen)}`);
725
+ // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
726
+ const noop = () => { }; // eslint-disable-line @typescript-eslint/no-empty-function
727
+ (0, opn_1.default)(urlToOpen, { wait: false }).then((cp) => cp.on('error', noop), noop);
728
+ const loginSpinner = clack.spinner();
729
+ loginSpinner.start('Waiting for you to log in using the link above');
730
+ const data = await new Promise((resolve) => {
731
+ const pollingInterval = (0, node_timers_1.setInterval)(() => {
732
+ axios_1.default
733
+ .get(`${options.url}api/0/wizard/${wizardHash}/`, {
734
+ headers: {
735
+ 'Accept-Encoding': 'deflate',
736
+ },
737
+ })
738
+ .then((result) => {
739
+ resolve(result.data);
740
+ clearTimeout(timeout);
741
+ clearInterval(pollingInterval);
742
+ void axios_1.default.delete(`${options.url}api/0/wizard/${wizardHash}/`);
743
+ })
744
+ .catch(() => {
745
+ // noop - just try again
746
+ });
747
+ }, 500);
748
+ const timeout = setTimeout(() => {
749
+ clearInterval(pollingInterval);
750
+ loginSpinner.stop('Login timed out. No worries - it happens to the best of us.');
751
+ Sentry.setTag('opened-wizard-link', false);
752
+ void abort('Please restart the Wizard and log in to complete the setup.');
753
+ }, 180000);
1065
754
  });
1066
- }
1067
- function askForProjectSelection(projects, orgSlug, projectSlug) {
1068
- return __awaiter(this, void 0, void 0, function () {
1069
- var label, filteredProjects, selection_1, sortedProjects, selection;
1070
- return __generator(this, function (_a) {
1071
- switch (_a.label) {
1072
- case 0:
1073
- label = function (project) {
1074
- return "".concat(project.organization.slug, "/").concat(project.slug);
1075
- };
1076
- filteredProjects = filterProjectsBySlugs(projects, orgSlug, projectSlug);
1077
- if (filteredProjects.length === 1) {
1078
- selection_1 = filteredProjects[0];
1079
- Sentry.setTag('project', selection_1.slug);
1080
- Sentry.setUser({ id: selection_1.organization.slug });
1081
- clack.log.step("Selected project ".concat(label(selection_1)));
1082
- return [2 /*return*/, selection_1];
1083
- }
1084
- if (filteredProjects.length === 0) {
1085
- clack.log.warn('Could not find a project with the provided slugs.');
1086
- }
1087
- sortedProjects = filteredProjects.length ? filteredProjects : projects;
1088
- sortedProjects.sort(function (a, b) {
1089
- return label(a).localeCompare(label(b));
1090
- });
1091
- return [4 /*yield*/, abortIfCancelled(clack.select({
1092
- maxItems: 12,
1093
- message: 'Select your Sentry project.',
1094
- options: sortedProjects.map(function (project) {
1095
- return {
1096
- value: project,
1097
- label: label(project),
1098
- };
1099
- }),
1100
- }))];
1101
- case 1:
1102
- selection = _a.sent();
1103
- Sentry.setTag('project', selection.slug);
1104
- Sentry.setUser({ id: selection.organization.slug });
1105
- return [2 /*return*/, selection];
1106
- }
1107
- });
755
+ loginSpinner.stop('Login complete.');
756
+ Sentry.setTag('opened-wizard-link', true);
757
+ return data;
758
+ }
759
+ async function askForProjectSelection(projects, orgSlug, projectSlug) {
760
+ const label = (project) => {
761
+ return `${project.organization.slug}/${project.slug}`;
762
+ };
763
+ const filteredProjects = filterProjectsBySlugs(projects, orgSlug, projectSlug);
764
+ if (filteredProjects.length === 1) {
765
+ const selection = filteredProjects[0];
766
+ Sentry.setTag('project', selection.slug);
767
+ Sentry.setUser({ id: selection.organization.slug });
768
+ clack.log.step(`Selected project ${label(selection)}`);
769
+ return selection;
770
+ }
771
+ if (filteredProjects.length === 0) {
772
+ clack.log.warn('Could not find a project with the provided slugs.');
773
+ }
774
+ const sortedProjects = filteredProjects.length ? filteredProjects : projects;
775
+ sortedProjects.sort((a, b) => {
776
+ return label(a).localeCompare(label(b));
1108
777
  });
778
+ const selection = await abortIfCancelled(clack.select({
779
+ maxItems: 12,
780
+ message: 'Select your Sentry project.',
781
+ options: sortedProjects.map((project) => {
782
+ return {
783
+ value: project,
784
+ label: label(project),
785
+ };
786
+ }),
787
+ }));
788
+ Sentry.setTag('project', selection.slug);
789
+ Sentry.setUser({ id: selection.organization.slug });
790
+ return selection;
1109
791
  }
1110
792
  function filterProjectsBySlugs(projects, orgSlug, projectSlug) {
1111
793
  if (!orgSlug && !projectSlug) {
1112
794
  return projects;
1113
795
  }
1114
796
  if (orgSlug && !projectSlug) {
1115
- return projects.filter(function (p) { return p.organization.slug === orgSlug; });
797
+ return projects.filter((p) => p.organization.slug === orgSlug);
1116
798
  }
1117
799
  if (!orgSlug && projectSlug) {
1118
- return projects.filter(function (p) { return p.slug === projectSlug; });
800
+ return projects.filter((p) => p.slug === projectSlug);
1119
801
  }
1120
- return projects.filter(function (p) { return p.organization.slug === orgSlug && p.slug === projectSlug; });
802
+ return projects.filter((p) => p.organization.slug === orgSlug && p.slug === projectSlug);
1121
803
  }
1122
804
  /**
1123
805
  * Asks users if they have a config file for @param tool (e.g. Vite).
@@ -1131,39 +813,29 @@ function filterProjectsBySlugs(projects, orgSlug, projectSlug) {
1131
813
  *
1132
814
  * @returns a user path to the config file or undefined if the user doesn't have a config file
1133
815
  */
1134
- function askForToolConfigPath(toolName, configFileName) {
1135
- return __awaiter(this, void 0, void 0, function () {
1136
- var hasConfig;
1137
- return __generator(this, function (_a) {
1138
- switch (_a.label) {
1139
- case 0: return [4 /*yield*/, abortIfCancelled(clack.confirm({
1140
- message: "Do you have a ".concat(toolName, " config file (e.g. ").concat(chalk_1.default.cyan(configFileName), ")?"),
1141
- initialValue: true,
1142
- }))];
1143
- case 1:
1144
- hasConfig = _a.sent();
1145
- if (!hasConfig) {
1146
- return [2 /*return*/, undefined];
1147
- }
1148
- return [4 /*yield*/, abortIfCancelled(clack.text({
1149
- message: "Please enter the path to your ".concat(toolName, " config file:"),
1150
- placeholder: path.join('.', configFileName),
1151
- validate: function (value) {
1152
- if (!value) {
1153
- return 'Please enter a path.';
1154
- }
1155
- try {
1156
- fs.accessSync(value);
1157
- }
1158
- catch (_a) {
1159
- return 'Could not access the file at this path.';
1160
- }
1161
- },
1162
- }))];
1163
- case 2: return [2 /*return*/, _a.sent()];
816
+ async function askForToolConfigPath(toolName, configFileName) {
817
+ const hasConfig = await abortIfCancelled(clack.confirm({
818
+ message: `Do you have a ${toolName} config file (e.g. ${chalk_1.default.cyan(configFileName)})?`,
819
+ initialValue: true,
820
+ }));
821
+ if (!hasConfig) {
822
+ return undefined;
823
+ }
824
+ return await abortIfCancelled(clack.text({
825
+ message: `Please enter the path to your ${toolName} config file:`,
826
+ placeholder: (0, node_path_1.join)('.', configFileName),
827
+ validate: (value) => {
828
+ if (!value) {
829
+ return 'Please enter a path.';
1164
830
  }
1165
- });
1166
- });
831
+ try {
832
+ fs.accessSync(value);
833
+ }
834
+ catch {
835
+ return 'Could not access the file at this path.';
836
+ }
837
+ },
838
+ }));
1167
839
  }
1168
840
  exports.askForToolConfigPath = askForToolConfigPath;
1169
841
  /**
@@ -1191,28 +863,18 @@ exports.askForToolConfigPath = askForToolConfigPath;
1191
863
  * TODO: refactor copy paste instructions across different wizards to use this function.
1192
864
  * this might require adding a custom message parameter to the function
1193
865
  */
1194
- function showCopyPasteInstructions(filename, codeSnippet, hint) {
1195
- return __awaiter(this, void 0, void 0, function () {
1196
- return __generator(this, function (_a) {
1197
- switch (_a.label) {
1198
- case 0:
1199
- clack.log.step("Add the following code to your ".concat(chalk_1.default.cyan(path.basename(filename)), " file:").concat(hint ? chalk_1.default.dim(" (".concat(chalk_1.default.dim(hint), ")")) : ''));
1200
- // Padding the code snippet to be printed with a \n at the beginning and end
1201
- // This makes it easier to distinguish the snippet from the rest of the output
1202
- // Intentionally logging directly to console here so that the code can be copied/pasted directly
1203
- // eslint-disable-next-line no-console
1204
- console.log("\n".concat(codeSnippet, "\n"));
1205
- return [4 /*yield*/, abortIfCancelled(clack.select({
1206
- message: 'Did you apply the snippet above?',
1207
- options: [{ label: 'Yes, continue!', value: true }],
1208
- initialValue: true,
1209
- }))];
1210
- case 1:
1211
- _a.sent();
1212
- return [2 /*return*/];
1213
- }
1214
- });
1215
- });
866
+ async function showCopyPasteInstructions(filename, codeSnippet, hint) {
867
+ clack.log.step(`Add the following code to your ${chalk_1.default.cyan((0, node_path_1.basename)(filename))} file:${hint ? chalk_1.default.dim(` (${chalk_1.default.dim(hint)})`) : ''}`);
868
+ // Padding the code snippet to be printed with a \n at the beginning and end
869
+ // This makes it easier to distinguish the snippet from the rest of the output
870
+ // Intentionally logging directly to console here so that the code can be copied/pasted directly
871
+ // eslint-disable-next-line no-console
872
+ console.log(`\n${codeSnippet}\n`);
873
+ await abortIfCancelled(clack.select({
874
+ message: 'Did you apply the snippet above?',
875
+ options: [{ label: 'Yes, continue!', value: true }],
876
+ initialValue: true,
877
+ }));
1216
878
  }
1217
879
  exports.showCopyPasteInstructions = showCopyPasteInstructions;
1218
880
  /**
@@ -1234,9 +896,9 @@ exports.showCopyPasteInstructions = showCopyPasteInstructions;
1234
896
  * @returns a string containing the final, formatted code snippet.
1235
897
  */
1236
898
  function makeCodeSnippet(colors, callback) {
1237
- var unchanged = function (txt) { return (colors ? chalk_1.default.grey(txt) : txt); };
1238
- var plus = function (txt) { return (colors ? chalk_1.default.greenBright(txt) : txt); };
1239
- var minus = function (txt) { return (colors ? chalk_1.default.redBright(txt) : txt); };
899
+ const unchanged = (txt) => (colors ? chalk_1.default.grey(txt) : txt);
900
+ const plus = (txt) => (colors ? chalk_1.default.greenBright(txt) : txt);
901
+ const minus = (txt) => (colors ? chalk_1.default.redBright(txt) : txt);
1240
902
  return callback(unchanged, plus, minus);
1241
903
  }
1242
904
  exports.makeCodeSnippet = makeCodeSnippet;
@@ -1257,149 +919,92 @@ exports.makeCodeSnippet = makeCodeSnippet;
1257
919
  *
1258
920
  * @returns true on success, false otherwise
1259
921
  */
1260
- function createNewConfigFile(filepath, codeSnippet, moreInformation) {
1261
- return __awaiter(this, void 0, void 0, function () {
1262
- var prettyFilename, e_4;
1263
- return __generator(this, function (_a) {
1264
- switch (_a.label) {
1265
- case 0:
1266
- if (!path.isAbsolute(filepath)) {
1267
- (0, debug_1.debug)("createNewConfigFile: filepath is not absolute: ".concat(filepath));
1268
- return [2 /*return*/, false];
1269
- }
1270
- prettyFilename = chalk_1.default.cyan(path.relative(process.cwd(), filepath));
1271
- _a.label = 1;
1272
- case 1:
1273
- _a.trys.push([1, 3, , 4]);
1274
- return [4 /*yield*/, fs.promises.writeFile(filepath, codeSnippet)];
1275
- case 2:
1276
- _a.sent();
1277
- clack.log.success("Added new ".concat(prettyFilename, " file."));
1278
- if (moreInformation) {
1279
- clack.log.info(chalk_1.default.gray(moreInformation));
1280
- }
1281
- return [2 /*return*/, true];
1282
- case 3:
1283
- e_4 = _a.sent();
1284
- (0, debug_1.debug)(e_4);
1285
- clack.log.warn("Could not create a new ".concat(prettyFilename, " file. Please create one manually and follow the instructions below."));
1286
- return [3 /*break*/, 4];
1287
- case 4: return [2 /*return*/, false];
1288
- }
1289
- });
1290
- });
922
+ async function createNewConfigFile(filepath, codeSnippet, moreInformation) {
923
+ if (!(0, node_path_1.isAbsolute)(filepath)) {
924
+ (0, debug_1.debug)(`createNewConfigFile: filepath is not absolute: ${filepath}`);
925
+ return false;
926
+ }
927
+ const prettyFilename = chalk_1.default.cyan((0, node_path_1.relative)(process.cwd(), filepath));
928
+ try {
929
+ await fs.promises.writeFile(filepath, codeSnippet);
930
+ clack.log.success(`Added new ${prettyFilename} file.`);
931
+ if (moreInformation) {
932
+ clack.log.info(chalk_1.default.gray(moreInformation));
933
+ }
934
+ return true;
935
+ }
936
+ catch (e) {
937
+ (0, debug_1.debug)(e);
938
+ clack.log.warn(`Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`);
939
+ }
940
+ return false;
1291
941
  }
1292
942
  exports.createNewConfigFile = createNewConfigFile;
1293
- function askShouldCreateExamplePage(customRoute) {
1294
- return __awaiter(this, void 0, void 0, function () {
1295
- var route;
1296
- return __generator(this, function (_a) {
1297
- route = chalk_1.default.cyan(customRoute !== null && customRoute !== void 0 ? customRoute : '/sentry-example-page');
1298
- return [2 /*return*/, (0, telemetry_1.traceStep)('ask-create-example-page', function () {
1299
- return abortIfCancelled(clack.select({
1300
- message: "Do you want to create an example page (\"".concat(route, "\") to test your Sentry setup?"),
1301
- options: [
1302
- {
1303
- value: true,
1304
- label: 'Yes',
1305
- hint: 'Recommended - Check your git status before committing!',
1306
- },
1307
- { value: false, label: 'No' },
1308
- ],
1309
- }));
1310
- })];
1311
- });
1312
- });
943
+ async function askShouldCreateExamplePage(customRoute) {
944
+ const route = chalk_1.default.cyan(customRoute ?? '/sentry-example-page');
945
+ return (0, telemetry_1.traceStep)('ask-create-example-page', () => abortIfCancelled(clack.select({
946
+ message: `Do you want to create an example page ("${route}") to test your Sentry setup?`,
947
+ options: [
948
+ {
949
+ value: true,
950
+ label: 'Yes',
951
+ hint: 'Recommended - Check your git status before committing!',
952
+ },
953
+ { value: false, label: 'No' },
954
+ ],
955
+ })));
1313
956
  }
1314
957
  exports.askShouldCreateExamplePage = askShouldCreateExamplePage;
1315
- function askShouldCreateExampleComponent() {
1316
- return __awaiter(this, void 0, void 0, function () {
1317
- return __generator(this, function (_a) {
1318
- return [2 /*return*/, (0, telemetry_1.traceStep)('ask-create-example-component', function () {
1319
- return abortIfCancelled(clack.select({
1320
- message: "Do you want to create an example component to test your Sentry setup?",
1321
- options: [
1322
- {
1323
- value: true,
1324
- label: 'Yes',
1325
- hint: 'Recommended - Check your git status before committing!',
1326
- },
1327
- { value: false, label: 'No' },
1328
- ],
1329
- }));
1330
- })];
1331
- });
1332
- });
958
+ async function askShouldCreateExampleComponent() {
959
+ return (0, telemetry_1.traceStep)('ask-create-example-component', () => abortIfCancelled(clack.select({
960
+ message: `Do you want to create an example component to test your Sentry setup?`,
961
+ options: [
962
+ {
963
+ value: true,
964
+ label: 'Yes',
965
+ hint: 'Recommended - Check your git status before committing!',
966
+ },
967
+ { value: false, label: 'No' },
968
+ ],
969
+ })));
1333
970
  }
1334
971
  exports.askShouldCreateExampleComponent = askShouldCreateExampleComponent;
1335
- function featureSelectionPrompt(features) {
1336
- return __awaiter(this, void 0, void 0, function () {
1337
- var _this = this;
1338
- return __generator(this, function (_a) {
1339
- return [2 /*return*/, (0, telemetry_1.traceStep)('feature-selection', function () { return __awaiter(_this, void 0, void 0, function () {
1340
- var selectedFeatures, _i, features_1, feature, selected;
1341
- return __generator(this, function (_a) {
1342
- switch (_a.label) {
1343
- case 0:
1344
- selectedFeatures = {};
1345
- _i = 0, features_1 = features;
1346
- _a.label = 1;
1347
- case 1:
1348
- if (!(_i < features_1.length)) return [3 /*break*/, 4];
1349
- feature = features_1[_i];
1350
- return [4 /*yield*/, abortIfCancelled(clack.select({
1351
- message: feature.prompt,
1352
- initialValue: true,
1353
- options: [
1354
- {
1355
- value: true,
1356
- label: 'Yes',
1357
- hint: feature.enabledHint,
1358
- },
1359
- {
1360
- value: false,
1361
- label: 'No',
1362
- hint: feature.disabledHint,
1363
- },
1364
- ],
1365
- }))];
1366
- case 2:
1367
- selected = _a.sent();
1368
- selectedFeatures[feature.id] = selected;
1369
- _a.label = 3;
1370
- case 3:
1371
- _i++;
1372
- return [3 /*break*/, 1];
1373
- case 4: return [2 /*return*/, selectedFeatures];
1374
- }
1375
- });
1376
- }); })];
1377
- });
972
+ async function featureSelectionPrompt(features) {
973
+ return (0, telemetry_1.traceStep)('feature-selection', async () => {
974
+ const selectedFeatures = {};
975
+ for (const feature of features) {
976
+ const selected = await abortIfCancelled(clack.select({
977
+ message: feature.prompt,
978
+ initialValue: true,
979
+ options: [
980
+ {
981
+ value: true,
982
+ label: 'Yes',
983
+ hint: feature.enabledHint,
984
+ },
985
+ {
986
+ value: false,
987
+ label: 'No',
988
+ hint: feature.disabledHint,
989
+ },
990
+ ],
991
+ }));
992
+ selectedFeatures[feature.id] = selected;
993
+ }
994
+ return selectedFeatures;
1378
995
  });
1379
996
  }
1380
997
  exports.featureSelectionPrompt = featureSelectionPrompt;
1381
- function askShouldInstallPackage(pkgName) {
1382
- return __awaiter(this, void 0, void 0, function () {
1383
- return __generator(this, function (_a) {
1384
- return [2 /*return*/, (0, telemetry_1.traceStep)("ask-install-package", function () {
1385
- return abortIfCancelled(clack.confirm({
1386
- message: "Do you want to install ".concat(chalk_1.default.cyan(pkgName), "?"),
1387
- }));
1388
- })];
1389
- });
1390
- });
998
+ async function askShouldInstallPackage(pkgName) {
999
+ return (0, telemetry_1.traceStep)(`ask-install-package`, () => abortIfCancelled(clack.confirm({
1000
+ message: `Do you want to install ${chalk_1.default.cyan(pkgName)}?`,
1001
+ })));
1391
1002
  }
1392
1003
  exports.askShouldInstallPackage = askShouldInstallPackage;
1393
- function askShouldAddPackageOverride(pkgName, pkgVersion) {
1394
- return __awaiter(this, void 0, void 0, function () {
1395
- return __generator(this, function (_a) {
1396
- return [2 /*return*/, (0, telemetry_1.traceStep)("ask-add-package-override", function () {
1397
- return abortIfCancelled(clack.confirm({
1398
- message: "Do you want to add an override for ".concat(chalk_1.default.cyan(pkgName), " version ").concat(chalk_1.default.cyan(pkgVersion), "?"),
1399
- }));
1400
- })];
1401
- });
1402
- });
1004
+ async function askShouldAddPackageOverride(pkgName, pkgVersion) {
1005
+ return (0, telemetry_1.traceStep)(`ask-add-package-override`, () => abortIfCancelled(clack.confirm({
1006
+ message: `Do you want to add an override for ${chalk_1.default.cyan(pkgName)} version ${chalk_1.default.cyan(pkgVersion)}?`,
1007
+ })));
1403
1008
  }
1404
1009
  exports.askShouldAddPackageOverride = askShouldAddPackageOverride;
1405
1010
  //# sourceMappingURL=clack-utils.js.map