@sentry/wizard 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/README.md +23 -19
  3. package/dist/bin.js +22 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/e2e-tests/tests/flutter.test.js +16 -16
  6. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  7. package/dist/e2e-tests/tests/help-message.test.js +56 -0
  8. package/dist/e2e-tests/tests/help-message.test.js.map +1 -0
  9. package/dist/e2e-tests/tests/nextjs-14.test.js +17 -16
  10. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  11. package/dist/e2e-tests/tests/nextjs-15.test.js +16 -16
  12. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  13. package/dist/e2e-tests/tests/nuxt-3.test.js +13 -12
  14. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  15. package/dist/e2e-tests/tests/nuxt-4.test.js +13 -12
  16. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  17. package/dist/e2e-tests/tests/remix.test.js +20 -20
  18. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  19. package/dist/e2e-tests/tests/sveltekit.test.js +20 -20
  20. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  21. package/dist/e2e-tests/utils/index.d.ts +1 -1
  22. package/dist/e2e-tests/utils/index.js +35 -13
  23. package/dist/e2e-tests/utils/index.js.map +1 -1
  24. package/dist/lib/Constants.d.ts +7 -1
  25. package/dist/lib/Constants.js.map +1 -1
  26. package/dist/lib/Helper/File.d.ts +1 -1
  27. package/dist/lib/Helper/File.js +1 -3
  28. package/dist/lib/Helper/File.js.map +1 -1
  29. package/dist/lib/Helper/Logging.d.ts +4 -1
  30. package/dist/lib/Helper/Logging.js +3 -0
  31. package/dist/lib/Helper/Logging.js.map +1 -1
  32. package/dist/lib/Helper/Package.d.ts +5 -3
  33. package/dist/lib/Helper/Package.js +2 -2
  34. package/dist/lib/Helper/Package.js.map +1 -1
  35. package/dist/lib/Helper/SentryCli.d.ts +20 -7
  36. package/dist/lib/Helper/SentryCli.js +21 -13
  37. package/dist/lib/Helper/SentryCli.js.map +1 -1
  38. package/dist/lib/Helper/Wizard.js +9 -5
  39. package/dist/lib/Helper/Wizard.js.map +1 -1
  40. package/dist/lib/Helper/__tests__/File.js +9 -9
  41. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  42. package/dist/lib/Helper/__tests__/MergeConfig.js +17 -17
  43. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  44. package/dist/lib/Helper/__tests__/SentryCli.js +39 -21
  45. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  46. package/dist/lib/Setup.d.ts +4 -1
  47. package/dist/lib/Setup.js +12 -2
  48. package/dist/lib/Setup.js.map +1 -1
  49. package/dist/lib/Steps/BaseStep.d.ts +1 -1
  50. package/dist/lib/Steps/BaseStep.js.map +1 -1
  51. package/dist/lib/Steps/Integrations/BaseIntegration.js +1 -2
  52. package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
  53. package/dist/lib/Steps/Integrations/Cordova.js +14 -10
  54. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  55. package/dist/lib/Steps/Integrations/Electron.d.ts +4 -1
  56. package/dist/lib/Steps/Integrations/Electron.js +1 -1
  57. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  58. package/dist/lib/Steps/Integrations/MobileProject.d.ts +3 -1
  59. package/dist/lib/Steps/Integrations/MobileProject.js +1 -1
  60. package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
  61. package/dist/lib/Steps/PromptForParameters.d.ts +4 -1
  62. package/dist/lib/Steps/PromptForParameters.js.map +1 -1
  63. package/dist/lib/Steps/SentryProjectSelector.d.ts +42 -1
  64. package/dist/lib/Steps/SentryProjectSelector.js +1 -1
  65. package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
  66. package/dist/lib/Steps/WaitForSentry.d.ts +3 -1
  67. package/dist/lib/Steps/WaitForSentry.js +4 -4
  68. package/dist/lib/Steps/WaitForSentry.js.map +1 -1
  69. package/dist/lib/Steps/Welcome.js +5 -0
  70. package/dist/lib/Steps/Welcome.js.map +1 -1
  71. package/dist/lib/Types.d.ts +14 -0
  72. package/dist/lib/Types.js +3 -0
  73. package/dist/lib/Types.js.map +1 -0
  74. package/dist/lib/__tests__/Env.js +10 -16
  75. package/dist/lib/__tests__/Env.js.map +1 -1
  76. package/dist/src/android/android-wizard.js +15 -12
  77. package/dist/src/android/android-wizard.js.map +1 -1
  78. package/dist/src/android/code-tools.js +1 -1
  79. package/dist/src/android/code-tools.js.map +1 -1
  80. package/dist/src/android/gradle.js +4 -4
  81. package/dist/src/android/gradle.js.map +1 -1
  82. package/dist/src/android/manifest.js +1 -1
  83. package/dist/src/android/manifest.js.map +1 -1
  84. package/dist/src/apple/apple-wizard.d.ts +2 -2
  85. package/dist/src/apple/apple-wizard.js +54 -175
  86. package/dist/src/apple/apple-wizard.js.map +1 -1
  87. package/dist/src/apple/check-installed-cli.d.ts +1 -0
  88. package/dist/src/apple/check-installed-cli.js +60 -0
  89. package/dist/src/apple/check-installed-cli.js.map +1 -0
  90. package/dist/src/apple/cocoapod.js +1 -1
  91. package/dist/src/apple/cocoapod.js.map +1 -1
  92. package/dist/src/apple/code-tools.js +1 -1
  93. package/dist/src/apple/code-tools.js.map +1 -1
  94. package/dist/src/apple/configure-fastlane.d.ts +5 -0
  95. package/dist/src/apple/configure-fastlane.js +66 -0
  96. package/dist/src/apple/configure-fastlane.js.map +1 -0
  97. package/dist/src/apple/configure-package-manager.d.ts +5 -0
  98. package/dist/src/apple/configure-package-manager.js +68 -0
  99. package/dist/src/apple/configure-package-manager.js.map +1 -0
  100. package/dist/src/apple/configure-sentry-cli.d.ts +4 -0
  101. package/dist/src/apple/configure-sentry-cli.js +47 -0
  102. package/dist/src/apple/configure-sentry-cli.js.map +1 -0
  103. package/dist/src/apple/configure-xcode-project.d.ts +8 -0
  104. package/dist/src/apple/configure-xcode-project.js +11 -0
  105. package/dist/src/apple/configure-xcode-project.js.map +1 -0
  106. package/dist/src/apple/fastlane.d.ts +1 -1
  107. package/dist/src/apple/fastlane.js +5 -5
  108. package/dist/src/apple/fastlane.js.map +1 -1
  109. package/dist/src/apple/inject-code-snippet.d.ts +6 -0
  110. package/dist/src/apple/inject-code-snippet.js +54 -0
  111. package/dist/src/apple/inject-code-snippet.js.map +1 -0
  112. package/dist/src/apple/lookup-xcode-project.d.ts +7 -0
  113. package/dist/src/apple/lookup-xcode-project.js +98 -0
  114. package/dist/src/apple/lookup-xcode-project.js.map +1 -0
  115. package/dist/src/apple/options.d.ts +4 -0
  116. package/dist/src/apple/options.js +3 -0
  117. package/dist/src/apple/options.js.map +1 -0
  118. package/dist/src/apple/search-xcode-project-at-path.d.ts +1 -0
  119. package/dist/src/apple/search-xcode-project-at-path.js +70 -0
  120. package/dist/src/apple/search-xcode-project-at-path.js.map +1 -0
  121. package/dist/src/apple/templates.js +11 -7
  122. package/dist/src/apple/templates.js.map +1 -1
  123. package/dist/src/apple/xcode-manager.js +4 -7
  124. package/dist/src/apple/xcode-manager.js.map +1 -1
  125. package/dist/src/flutter/code-tools.js +3 -3
  126. package/dist/src/flutter/code-tools.js.map +1 -1
  127. package/dist/src/flutter/flutter-wizard.js +21 -15
  128. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  129. package/dist/src/flutter/templates.js +4 -4
  130. package/dist/src/flutter/templates.js.map +1 -1
  131. package/dist/src/nextjs/nextjs-wizard.js +118 -43
  132. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  133. package/dist/src/nextjs/templates.d.ts +10 -1
  134. package/dist/src/nextjs/templates.js +192 -62
  135. package/dist/src/nextjs/templates.js.map +1 -1
  136. package/dist/src/nuxt/nuxt-wizard.js +21 -16
  137. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  138. package/dist/src/nuxt/sdk-example.js +3 -3
  139. package/dist/src/nuxt/sdk-example.js.map +1 -1
  140. package/dist/src/nuxt/sdk-setup.js +9 -9
  141. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  142. package/dist/src/nuxt/templates.js +173 -58
  143. package/dist/src/nuxt/templates.js.map +1 -1
  144. package/dist/src/nuxt/utils.js +6 -3
  145. package/dist/src/nuxt/utils.js.map +1 -1
  146. package/dist/src/react-native/expo-env-file.js +1 -1
  147. package/dist/src/react-native/expo-env-file.js.map +1 -1
  148. package/dist/src/react-native/expo-metro.js +4 -4
  149. package/dist/src/react-native/expo-metro.js.map +1 -1
  150. package/dist/src/react-native/expo.js +4 -4
  151. package/dist/src/react-native/expo.js.map +1 -1
  152. package/dist/src/react-native/javascript.d.ts +6 -4
  153. package/dist/src/react-native/javascript.js +31 -15
  154. package/dist/src/react-native/javascript.js.map +1 -1
  155. package/dist/src/react-native/metro.js +8 -8
  156. package/dist/src/react-native/metro.js.map +1 -1
  157. package/dist/src/react-native/react-native-wizard.d.ts +5 -1
  158. package/dist/src/react-native/react-native-wizard.js +66 -36
  159. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  160. package/dist/src/react-native/uninstall.js +8 -5
  161. package/dist/src/react-native/uninstall.js.map +1 -1
  162. package/dist/src/react-native/xcode.d.ts +9 -4
  163. package/dist/src/react-native/xcode.js +65 -22
  164. package/dist/src/react-native/xcode.js.map +1 -1
  165. package/dist/src/remix/codemods/handle-error.js +4 -1
  166. package/dist/src/remix/codemods/handle-error.js.map +1 -1
  167. package/dist/src/remix/remix-wizard.js +23 -18
  168. package/dist/src/remix/remix-wizard.js.map +1 -1
  169. package/dist/src/remix/sdk-example.js +163 -64
  170. package/dist/src/remix/sdk-example.js.map +1 -1
  171. package/dist/src/remix/sdk-setup.js +11 -7
  172. package/dist/src/remix/sdk-setup.js.map +1 -1
  173. package/dist/src/run.d.ts +3 -1
  174. package/dist/src/run.js +29 -9
  175. package/dist/src/run.js.map +1 -1
  176. package/dist/src/sourcemaps/sourcemaps-wizard.js +30 -28
  177. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  178. package/dist/src/sourcemaps/tools/angular.js +3 -3
  179. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  180. package/dist/src/sourcemaps/tools/create-react-app.js +3 -3
  181. package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
  182. package/dist/src/sourcemaps/tools/esbuild.js +6 -6
  183. package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
  184. package/dist/src/sourcemaps/tools/nextjs.js +5 -5
  185. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
  186. package/dist/src/sourcemaps/tools/remix.js +4 -4
  187. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  188. package/dist/src/sourcemaps/tools/rollup.js +6 -6
  189. package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
  190. package/dist/src/sourcemaps/tools/sentry-cli.js +15 -15
  191. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  192. package/dist/src/sourcemaps/tools/tsc.js +6 -6
  193. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  194. package/dist/src/sourcemaps/tools/vite.js +12 -12
  195. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  196. package/dist/src/sourcemaps/tools/webpack.js +10 -10
  197. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  198. package/dist/src/sourcemaps/utils/detect-tool.js +2 -2
  199. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  200. package/dist/src/sourcemaps/utils/other-wizards.js +5 -5
  201. package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
  202. package/dist/src/sourcemaps/utils/sdk-version.js +7 -7
  203. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  204. package/dist/src/sveltekit/sdk-example.js +1 -1
  205. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  206. package/dist/src/sveltekit/sdk-setup.js +15 -14
  207. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  208. package/dist/src/sveltekit/sveltekit-wizard.js +25 -20
  209. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  210. package/dist/src/sveltekit/templates.js +126 -37
  211. package/dist/src/sveltekit/templates.js.map +1 -1
  212. package/dist/src/telemetry.js +11 -0
  213. package/dist/src/telemetry.js.map +1 -1
  214. package/dist/src/utils/{clack-utils.d.ts → clack/index.d.ts} +45 -7
  215. package/dist/src/utils/{clack-utils.js → clack/index.js} +75 -20
  216. package/dist/src/utils/clack/index.js.map +1 -0
  217. package/dist/src/utils/debug.js +1 -1
  218. package/dist/src/utils/debug.js.map +1 -1
  219. package/dist/src/utils/find-files-with-extension.d.ts +1 -0
  220. package/dist/src/utils/find-files-with-extension.js +39 -0
  221. package/dist/src/utils/find-files-with-extension.js.map +1 -0
  222. package/dist/src/utils/package-manager.d.ts +8 -1
  223. package/dist/src/utils/package-manager.js +79 -23
  224. package/dist/src/utils/package-manager.js.map +1 -1
  225. package/dist/src/utils/sentrycli-utils.js +0 -1
  226. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  227. package/dist/src/utils/types.d.ts +4 -0
  228. package/dist/src/utils/types.js.map +1 -1
  229. package/dist/src/version.d.ts +1 -1
  230. package/dist/src/version.js +1 -1
  231. package/dist/src/version.js.map +1 -1
  232. package/dist/test/android/code-tools.test.js +13 -13
  233. package/dist/test/android/code-tools.test.js.map +1 -1
  234. package/dist/test/apple/cocoapod.test.js +78 -73
  235. package/dist/test/apple/cocoapod.test.js.map +1 -1
  236. package/dist/test/apple/code-tools.test.js +174 -167
  237. package/dist/test/apple/code-tools.test.js.map +1 -1
  238. package/dist/test/apple/fastfile.test.js +87 -84
  239. package/dist/test/apple/fastfile.test.js.map +1 -1
  240. package/dist/test/apple/templates.test.js +32 -27
  241. package/dist/test/apple/templates.test.js.map +1 -1
  242. package/dist/test/apple/xcode-manager.test.js +208 -185
  243. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  244. package/dist/test/flutter/code-tools.test.js +29 -30
  245. package/dist/test/flutter/code-tools.test.js.map +1 -1
  246. package/dist/test/flutter/templates.test.js +38 -37
  247. package/dist/test/flutter/templates.test.js.map +1 -1
  248. package/dist/test/nextjs/templates.test.js +155 -103
  249. package/dist/test/nextjs/templates.test.js.map +1 -1
  250. package/dist/test/nuxt/templates.test.js +25 -24
  251. package/dist/test/nuxt/templates.test.js.map +1 -1
  252. package/dist/test/react-native/expo-metro.test.js +12 -11
  253. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  254. package/dist/test/react-native/expo.test.js +11 -10
  255. package/dist/test/react-native/expo.test.js.map +1 -1
  256. package/dist/test/react-native/gradle.test.js +27 -26
  257. package/dist/test/react-native/gradle.test.js.map +1 -1
  258. package/dist/test/react-native/javascript.test.js +109 -59
  259. package/dist/test/react-native/javascript.test.js.map +1 -1
  260. package/dist/test/react-native/metro.test.js +66 -65
  261. package/dist/test/react-native/metro.test.js.map +1 -1
  262. package/dist/test/react-native/xcode.test.js +138 -37
  263. package/dist/test/react-native/xcode.test.js.map +1 -1
  264. package/dist/test/remix/client-entry.test.js +8 -7
  265. package/dist/test/remix/client-entry.test.js.map +1 -1
  266. package/dist/test/remix/server-instrumentation.test.js +6 -5
  267. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  268. package/dist/test/sourcemaps/tools/sentry-cli.test.js +21 -21
  269. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  270. package/dist/test/sourcemaps/tools/tsc.test.js +13 -14
  271. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  272. package/dist/test/sourcemaps/tools/vite.test.js +13 -14
  273. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  274. package/dist/test/sourcemaps/tools/webpack.test.js +19 -20
  275. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  276. package/dist/test/sveltekit/templates.test.js +13 -12
  277. package/dist/test/sveltekit/templates.test.js.map +1 -1
  278. package/dist/test/utils/ast-utils.test.js +45 -44
  279. package/dist/test/utils/ast-utils.test.js.map +1 -1
  280. package/dist/test/utils/clack/index.test.d.ts +1 -0
  281. package/dist/test/utils/clack/index.test.js +375 -0
  282. package/dist/test/utils/clack/index.test.js.map +1 -0
  283. package/dist/test/utils/package-manager.test.d.ts +1 -0
  284. package/dist/test/utils/package-manager.test.js +30 -0
  285. package/dist/test/utils/package-manager.test.js.map +1 -0
  286. package/package.json +10 -38
  287. package/dist/e2e-tests/jest.config.d.ts +0 -17
  288. package/dist/e2e-tests/jest.config.js +0 -23
  289. package/dist/e2e-tests/jest.config.js.map +0 -1
  290. package/dist/src/utils/clack-utils.js.map +0 -1
  291. package/dist/test/utils/clack-utils.test.js +0 -306
  292. package/dist/test/utils/clack-utils.test.js.map +0 -1
  293. /package/dist/{test/utils/clack-utils.test.d.ts → e2e-tests/tests/help-message.test.d.ts} +0 -0
@@ -1,18 +1,31 @@
1
1
  import type { Answers } from 'inquirer';
2
2
  import type { Args } from '../Constants';
3
+ import { Config } from '../Types';
3
4
  export interface SentryCliProps {
4
- [s: string]: string;
5
+ 'defaults/url': string;
6
+ 'defaults/org': string | null;
7
+ 'defaults/project': string | null;
8
+ 'auth/token': string | null;
9
+ 'cli/executable'?: string;
5
10
  }
6
- type SentryCliConfig = Record<string, SentryCliProps>;
11
+ type SentryCliConfig = Record<string, Partial<SentryCliProps>>;
12
+ type RequireResolve = typeof require.resolve;
7
13
  export declare class SentryCli {
8
14
  protected _argv: Args;
9
15
  private _resolve;
10
16
  constructor(_argv: Args);
11
- setResolveFunction(resolve: (path: string) => string): void;
12
- convertAnswersToProperties(answers: Answers): SentryCliProps;
13
- /** Create the contents of a `sentry.properties` file */
14
- dumpProperties(props: SentryCliProps): string;
15
- dumpConfig(config: SentryCliConfig): string;
17
+ setResolveFunction(resolve: RequireResolve): void;
18
+ convertAnswersToProperties(answers: Answers & {
19
+ config?: Config;
20
+ }): SentryCliProps;
21
+ /**
22
+ * Create the contents of a `sentry.properties` file
23
+ * @param props the properties to write to the file
24
+ * @param format the format of the file, either `rc`
25
+ * (.sentryclirc) or `properties` (sentry.properties)
26
+ */
27
+ dumpProperties(props: Partial<SentryCliProps>, format?: 'rc' | 'properties'): string;
28
+ dumpConfig(config: Partial<SentryCliConfig>): string;
16
29
  /**
17
30
  * Creates `.sentryclirc` and `sentry.properties` files with the CLI properties
18
31
  * obtained from the user answers (or from logging into Sentry).
@@ -33,7 +33,6 @@ const GITIGNORE_FILENAME = '.gitignore';
33
33
  const PROPERTIES_FILENAME = 'sentry.properties';
34
34
  class SentryCli {
35
35
  _argv;
36
- // eslint-disable-next-line @typescript-eslint/typedef
37
36
  _resolve = require.resolve;
38
37
  constructor(_argv) {
39
38
  this._argv = _argv;
@@ -42,11 +41,12 @@ class SentryCli {
42
41
  this._resolve = resolve;
43
42
  }
44
43
  convertAnswersToProperties(answers) {
45
- const props = {};
46
- props['defaults/url'] = this._argv.url;
47
- props['defaults/org'] = answers.config?.organization?.slug ?? null;
48
- props['defaults/project'] = answers.config?.project?.slug ?? null;
49
- props['auth/token'] = answers.config?.auth?.token ?? null;
44
+ const props = {
45
+ 'defaults/url': this._argv.url,
46
+ 'defaults/org': answers.config?.organization?.slug ?? null,
47
+ 'defaults/project': answers.config?.project?.slug ?? null,
48
+ 'auth/token': answers.config?.auth?.token ?? null,
49
+ };
50
50
  try {
51
51
  const cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {
52
52
  paths: [process.cwd()],
@@ -60,11 +60,19 @@ class SentryCli {
60
60
  }
61
61
  return props;
62
62
  }
63
- /** Create the contents of a `sentry.properties` file */
64
- dumpProperties(props) {
63
+ /**
64
+ * Create the contents of a `sentry.properties` file
65
+ * @param props the properties to write to the file
66
+ * @param format the format of the file, either `rc`
67
+ * (.sentryclirc) or `properties` (sentry.properties)
68
+ */
69
+ dumpProperties(props, format = 'properties') {
70
+ const propEntries = Object.entries(props);
65
71
  const rv = [];
66
- for (const [key, value] of Object.entries(props)) {
67
- const normalizedKey = key.replace(/\//g, '.');
72
+ for (const [key, value] of propEntries) {
73
+ const normalizedKey = format === 'properties'
74
+ ? key.replace(/\//g, '.')
75
+ : key.split('/').at(1) ?? '';
68
76
  if (value === undefined || value === null) {
69
77
  // comment that property out since it has no value
70
78
  rv.push(`#${normalizedKey}=`);
@@ -78,8 +86,8 @@ class SentryCli {
78
86
  }
79
87
  dumpConfig(config) {
80
88
  const dumpedSections = [];
81
- for (const [sectionName, val] of Object.entries(config)) {
82
- const props = this.dumpProperties(val);
89
+ for (const [sectionName, values] of Object.entries(config)) {
90
+ const props = values ? this.dumpProperties(values, 'rc') : '';
83
91
  const section = `[${sectionName}]\n${props}`;
84
92
  dumpedSections.push(section);
85
93
  }
@@ -105,7 +113,7 @@ class SentryCli {
105
113
  */
106
114
  if (authToken) {
107
115
  try {
108
- await fs.promises.appendFile(SENTRYCLIRC_FILENAME, this.dumpConfig({ auth: { token: authToken } }));
116
+ await fs.promises.appendFile(SENTRYCLIRC_FILENAME, this.dumpConfig({ auth: { 'auth/token': authToken } }));
109
117
  (0, Logging_1.green)(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);
110
118
  }
111
119
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../lib/Helper/SentryCli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAE9B,gDAAkC;AAGlC,+BAAuC;AACvC,uCAA8C;AAE9C,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAQhD,MAAa,SAAS;IAIS;IAH7B,sDAAsD;IAC9C,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAEnC,YAA6B,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;IAAG,CAAC;IAErC,kBAAkB,CAAC,OAAiC;QACzD,IAAI,CAAC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IAAA,WAAC,EACC,sFAAsF,CACvF,CAAC;YACF,IAAA,WAAC,EACC,8CAA8C;gBAC5C,8FAA8F,CACjG,CAAC;SACH;QAED,MAAM,IAAA,oBAAc,EAClB,oBAAoB,EACpB,mBAAmB,oBAAoB,OAAO,kBAAkB,8CAA8C,CAC/G,CAAC;QAEF,IAAI;YACF,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,KAAK,mBAAmB,EAAE,EAC1B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CACrC,CAAC;YACF,IAAA,eAAK,EAAC,0CAA0C,CAAC,CAAC;SACnD;QAAC,MAAM;YACN,IAAA,aAAG,EAAC,2CAA2C,mBAAmB,EAAE,CAAC,CAAC;YACtE,IAAA,WAAC,EACC,2HAA2H,CAC5H,CAAC;SACH;QACD,IAAA,YAAE,GAAE,CAAC;IACP,CAAC;CACF;AAxHD,8BAwHC","sourcesContent":["import * as fs from 'node:fs';\nimport type { Answers } from 'inquirer';\nimport * as path from 'node:path';\n\nimport type { Args } from '../Constants';\nimport { addToGitignore } from './Git';\nimport { green, l, nl, red } from './Logging';\n\nconst SENTRYCLIRC_FILENAME = '.sentryclirc';\nconst GITIGNORE_FILENAME = '.gitignore';\nconst PROPERTIES_FILENAME = 'sentry.properties';\n\nexport interface SentryCliProps {\n [s: string]: string;\n}\n\ntype SentryCliConfig = Record<string, SentryCliProps>;\n\nexport class SentryCli {\n // eslint-disable-next-line @typescript-eslint/typedef\n private _resolve = require.resolve;\n\n public constructor(protected _argv: Args) {}\n\n public setResolveFunction(resolve: (path: string) => string): void {\n this._resolve = resolve as any;\n }\n\n public convertAnswersToProperties(answers: Answers): SentryCliProps {\n const props: SentryCliProps = {};\n props['defaults/url'] = this._argv.url;\n props['defaults/org'] = answers.config?.organization?.slug ?? null;\n props['defaults/project'] = answers.config?.project?.slug ?? null;\n props['auth/token'] = answers.config?.auth?.token ?? null;\n try {\n const cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {\n paths: [process.cwd()],\n });\n props['cli/executable'] = path\n .relative(process.cwd(), cliPath)\n .replace(/\\\\/g, '\\\\\\\\');\n } catch (e) {\n // we do nothing and leave everything as it is\n }\n return props;\n }\n\n /** Create the contents of a `sentry.properties` file */\n public dumpProperties(props: SentryCliProps): string {\n const rv = [];\n for (const [key, value] of Object.entries(props)) {\n const normalizedKey = key.replace(/\\//g, '.');\n if (value === undefined || value === null) {\n // comment that property out since it has no value\n rv.push(`#${normalizedKey}=`);\n } else {\n rv.push(`${normalizedKey}=${value}`);\n }\n }\n // eslint-disable-next-line prefer-template\n return rv.join('\\n') + '\\n';\n }\n\n public dumpConfig(config: SentryCliConfig): string {\n const dumpedSections: string[] = [];\n for (const [sectionName, val] of Object.entries(config)) {\n const props = this.dumpProperties(val);\n const section = `[${sectionName}]\\n${props}`;\n dumpedSections.push(section);\n }\n return dumpedSections.join('\\n');\n }\n\n /**\n * Creates `.sentryclirc` and `sentry.properties` files with the CLI properties\n * obtained from the user answers (or from logging into Sentry).\n * The `.sentryclirc` only contains the auth token and will be added to the\n * user's `.gitignore` file. The properties file contains the rest of the\n * properties (org, project, etc.).\n *\n * @param sentryCli instance of the Sentry CLI\n * @param cliProps the properties to write to the files\n */\n public async createSentryCliConfig(cliProps: SentryCliProps): Promise<void> {\n const { 'auth/token': authToken, ...cliPropsToWrite } = cliProps;\n\n /**\n * To not commit the auth token to the VCS, instead of adding it to the\n * properties file (like the rest of props), it's added to the Sentry CLI\n * config, which is added to the gitignore. This way makes the properties\n * file safe to commit without exposing any auth tokens.\n */\n if (authToken) {\n try {\n await fs.promises.appendFile(\n SENTRYCLIRC_FILENAME,\n this.dumpConfig({ auth: { token: authToken } }),\n );\n green(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);\n } catch {\n red(\n `⚠ Could not add the auth token to ${SENTRYCLIRC_FILENAME}, ` +\n `please add it to identify your user account:\\n${authToken}`,\n );\n nl();\n }\n } else {\n red(\n `⚠ Did not find an auth token, please add your token to ${SENTRYCLIRC_FILENAME}`,\n );\n l(\n 'To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/',\n );\n l(\n 'To learn how to configure Sentry CLI, visit ' +\n 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n\n await addToGitignore(\n SENTRYCLIRC_FILENAME,\n `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, please add it to not commit your auth key.`,\n );\n\n try {\n await fs.promises.writeFile(\n `./${PROPERTIES_FILENAME}`,\n this.dumpProperties(cliPropsToWrite),\n );\n green('✓ Successfully created sentry.properties');\n } catch {\n red(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);\n l(\n 'See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n nl();\n }\n}\n"]}
1
+ {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../lib/Helper/SentryCli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAE9B,gDAAkC;AAGlC,+BAAuC;AACvC,uCAA8C;AAG9C,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAahD,MAAa,SAAS;IAGS;IAFrB,QAAQ,GAAmB,OAAO,CAAC,OAAO,CAAC;IAEnD,YAA6B,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;IAAG,CAAC;IAErC,kBAAkB,CAAC,OAAuB;QAC/C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAEM,0BAA0B,CAC/B,OAAsC;QAEtC,MAAM,KAAK,GAAmB;YAC5B,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;YAC9B,cAAc,EAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,IAAI,IAAI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AAC,EACC,8CAA8C;gBAC5C,8FAA8F,CACjG,CAAC;SACH;QAED,MAAM,IAAA,oBAAc,EAClB,oBAAoB,EACpB,mBAAmB,oBAAoB,OAAO,kBAAkB,8CAA8C,CAC/G,CAAC;QAEF,IAAI;YACF,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,KAAK,mBAAmB,EAAE,EAC1B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CACrC,CAAC;YACF,IAAA,eAAK,EAAC,0CAA0C,CAAC,CAAC;SACnD;QAAC,MAAM;YACN,IAAA,aAAG,EAAC,2CAA2C,mBAAmB,EAAE,CAAC,CAAC;YACtE,IAAA,WAAC,EACC,2HAA2H,CAC5H,CAAC;SACH;QACD,IAAA,YAAE,GAAE,CAAC;IACP,CAAC;CACF;AA1ID,8BA0IC","sourcesContent":["import * as fs from 'node:fs';\nimport type { Answers } from 'inquirer';\nimport * as path from 'node:path';\n\nimport type { Args } from '../Constants';\nimport { addToGitignore } from './Git';\nimport { green, l, nl, red } from './Logging';\nimport { Config } from '../Types';\n\nconst SENTRYCLIRC_FILENAME = '.sentryclirc';\nconst GITIGNORE_FILENAME = '.gitignore';\nconst PROPERTIES_FILENAME = 'sentry.properties';\n\nexport interface SentryCliProps {\n 'defaults/url': string;\n 'defaults/org': string | null;\n 'defaults/project': string | null;\n 'auth/token': string | null;\n 'cli/executable'?: string;\n}\n\ntype SentryCliConfig = Record<string, Partial<SentryCliProps>>;\ntype RequireResolve = typeof require.resolve;\n\nexport class SentryCli {\n private _resolve: RequireResolve = require.resolve;\n\n public constructor(protected _argv: Args) {}\n\n public setResolveFunction(resolve: RequireResolve): void {\n this._resolve = resolve;\n }\n\n public convertAnswersToProperties(\n answers: Answers & { config?: Config },\n ): SentryCliProps {\n const props: SentryCliProps = {\n 'defaults/url': this._argv.url,\n 'defaults/org': answers.config?.organization?.slug ?? null,\n 'defaults/project': answers.config?.project?.slug ?? null,\n 'auth/token': answers.config?.auth?.token ?? null,\n };\n\n try {\n const cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {\n paths: [process.cwd()],\n });\n props['cli/executable'] = path\n .relative(process.cwd(), cliPath)\n .replace(/\\\\/g, '\\\\\\\\');\n } catch (e) {\n // we do nothing and leave everything as it is\n }\n return props;\n }\n\n /**\n * Create the contents of a `sentry.properties` file\n * @param props the properties to write to the file\n * @param format the format of the file, either `rc`\n * (.sentryclirc) or `properties` (sentry.properties)\n */\n public dumpProperties(\n props: Partial<SentryCliProps>,\n format: 'rc' | 'properties' = 'properties',\n ): string {\n const propEntries = Object.entries(props) as [\n keyof SentryCliProps,\n SentryCliProps[keyof SentryCliProps],\n ][];\n const rv: string[] = [];\n for (const [key, value] of propEntries) {\n const normalizedKey =\n format === 'properties'\n ? key.replace(/\\//g, '.')\n : key.split('/').at(1) ?? '';\n if (value === undefined || value === null) {\n // comment that property out since it has no value\n rv.push(`#${normalizedKey}=`);\n } else {\n rv.push(`${normalizedKey}=${value}`);\n }\n }\n // eslint-disable-next-line prefer-template\n return rv.join('\\n') + '\\n';\n }\n\n public dumpConfig(config: Partial<SentryCliConfig>): string {\n const dumpedSections: string[] = [];\n for (const [sectionName, values] of Object.entries(config)) {\n const props = values ? this.dumpProperties(values, 'rc') : '';\n const section = `[${sectionName}]\\n${props}`;\n dumpedSections.push(section);\n }\n return dumpedSections.join('\\n');\n }\n\n /**\n * Creates `.sentryclirc` and `sentry.properties` files with the CLI properties\n * obtained from the user answers (or from logging into Sentry).\n * The `.sentryclirc` only contains the auth token and will be added to the\n * user's `.gitignore` file. The properties file contains the rest of the\n * properties (org, project, etc.).\n *\n * @param sentryCli instance of the Sentry CLI\n * @param cliProps the properties to write to the files\n */\n public async createSentryCliConfig(cliProps: SentryCliProps): Promise<void> {\n const { 'auth/token': authToken, ...cliPropsToWrite } = cliProps;\n\n /**\n * To not commit the auth token to the VCS, instead of adding it to the\n * properties file (like the rest of props), it's added to the Sentry CLI\n * config, which is added to the gitignore. This way makes the properties\n * file safe to commit without exposing any auth tokens.\n */\n if (authToken) {\n try {\n await fs.promises.appendFile(\n SENTRYCLIRC_FILENAME,\n this.dumpConfig({ auth: { 'auth/token': authToken } }),\n );\n green(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);\n } catch {\n red(\n `⚠ Could not add the auth token to ${SENTRYCLIRC_FILENAME}, ` +\n `please add it to identify your user account:\\n${authToken}`,\n );\n nl();\n }\n } else {\n red(\n `⚠ Did not find an auth token, please add your token to ${SENTRYCLIRC_FILENAME}`,\n );\n l(\n 'To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/',\n );\n l(\n 'To learn how to configure Sentry CLI, visit ' +\n 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n\n await addToGitignore(\n SENTRYCLIRC_FILENAME,\n `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, please add it to not commit your auth key.`,\n );\n\n try {\n await fs.promises.writeFile(\n `./${PROPERTIES_FILENAME}`,\n this.dumpProperties(cliPropsToWrite),\n );\n green('✓ Successfully created sentry.properties');\n } catch {\n red(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);\n l(\n 'See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n nl();\n }\n}\n"]}
@@ -8,15 +8,19 @@ function sanitizeAndValidateArgs(argv) {
8
8
  argv.quiet = true;
9
9
  (0, Logging_1.dim)('will activate quiet mode for you');
10
10
  }
11
- // @ts-ignore skip-connect does not exist on args
12
11
  if (argv['skip-connect']) {
13
- // @ts-ignore skip-connect does not exist on args
14
12
  argv.skipConnect = argv['skip-connect'];
15
- // @ts-ignore skip-connect does not exist on args
16
13
  delete argv['skip-connect'];
17
14
  }
18
- // @ts-ignore skip-connect does not exist on args
19
15
  argv.promoCode = argv['promo-code'];
16
+ if (argv['ignore-git-changes']) {
17
+ argv.ignoreGitChanges = argv['ignore-git-changes'];
18
+ delete argv['ignore-git-changes'];
19
+ }
20
+ if (argv['xcode-project-dir']) {
21
+ argv.xcodeProjectDir = argv['xcode-project-dir'];
22
+ delete argv['xcode-project-dir'];
23
+ }
20
24
  }
21
25
  function getCurrentIntegration(answers) {
22
26
  return answers.integration;
@@ -43,7 +47,7 @@ async function startWizard(argv, ...steps) {
43
47
  BottomBar_1.BottomBar.hide();
44
48
  (0, Logging_1.nl)();
45
49
  (0, Logging_1.red)('Sentry Wizard failed with:');
46
- (0, Logging_1.red)(argv.debug ? e : e.message);
50
+ (0, Logging_1.red)(argv.debug && e instanceof Error ? e.message : String(e));
47
51
  (0, Logging_1.nl)();
48
52
  (0, Logging_1.red)('Protip: Add --debug to see whats going on');
49
53
  (0, Logging_1.red)('OR use --help to see your options');
@@ -1 +1 @@
1
- {"version":3,"file":"Wizard.js","sourceRoot":"","sources":["../../../lib/Helper/Wizard.ts"],"names":[],"mappings":";;;AAKA,2CAAwC;AACxC,uCAAgD;AAEhD,SAAS,uBAAuB,CAAC,IAAU;IACzC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAA,aAAG,EAAC,kCAAkC,CAAC,CAAC;KACzC;IACD,iDAAiD;IACjD,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE;QACxB,iDAAiD;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;QACxC,iDAAiD;QACjD,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;KAC7B;IACD,iDAAiD;IACjD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO,OAAO,CAAC,WAA8B,CAAC;AAChD,CAAC;AAFD,sDAEC;AAEM,KAAK,UAAU,WAAW,CAC/B,IAAU,EACV,GAAG,KAAsC;IAEzC,IAAI;QACF,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;SACb;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAA,aAAG,EAAC,4CAA4C,CAAC,CAAC;SACnD;QACD,OAAO,MAAM,KAAK;aACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;aAC7B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC7B,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC;YAChC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC5C,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC;QACvC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;KAC3B;IAAC,OAAO,CAAC,EAAE;QACV,qBAAS,CAAC,IAAI,EAAE,CAAC;QACjB,IAAA,YAAE,GAAE,CAAC;QACL,IAAA,aAAG,EAAC,4BAA4B,CAAC,CAAC;QAClC,IAAA,aAAG,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAChC,IAAA,YAAE,GAAE,CAAC;QACL,IAAA,aAAG,EAAC,2CAA2C,CAAC,CAAC;QACjD,IAAA,aAAG,EAAC,mCAAmC,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AA7BD,kCA6BC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../Constants';\nimport type { IStep } from '../Steps/BaseStep';\nimport type { BaseIntegration } from '../Steps/Integrations/BaseIntegration';\nimport { BottomBar } from './BottomBar';\nimport { debug, dim, nl, red } from './Logging';\n\nfunction sanitizeAndValidateArgs(argv: Args): void {\n if (argv.quiet === undefined) {\n argv.quiet = true;\n dim('will activate quiet mode for you');\n }\n // @ts-ignore skip-connect does not exist on args\n if (argv['skip-connect']) {\n // @ts-ignore skip-connect does not exist on args\n argv.skipConnect = argv['skip-connect'];\n // @ts-ignore skip-connect does not exist on args\n delete argv['skip-connect'];\n }\n // @ts-ignore skip-connect does not exist on args\n argv.promoCode = argv['promo-code'];\n}\n\nexport function getCurrentIntegration(answers: Answers): BaseIntegration {\n return answers.integration as BaseIntegration;\n}\n\nexport async function startWizard<M extends IStep>(\n argv: Args,\n ...steps: Array<{ new (debug: Args): M }>\n): Promise<Answers> {\n try {\n sanitizeAndValidateArgs(argv);\n if (argv.debug) {\n debug(argv);\n }\n if (argv.quiet) {\n dim(\"Quiet mode On, DAMA, don't ask me anything\");\n }\n return await steps\n .map((step) => new step(argv))\n .reduce(async (answer, step) => {\n const prevAnswer = await answer;\n const answers = await step.emit(prevAnswer);\n return { ...prevAnswer, ...answers };\n }, Promise.resolve({}));\n } catch (e) {\n BottomBar.hide();\n nl();\n red('Sentry Wizard failed with:');\n red(argv.debug ? e : e.message);\n nl();\n red('Protip: Add --debug to see whats going on');\n red('OR use --help to see your options');\n process.exit(1);\n }\n}\n"]}
1
+ {"version":3,"file":"Wizard.js","sourceRoot":"","sources":["../../../lib/Helper/Wizard.ts"],"names":[],"mappings":";;;AAKA,2CAAwC;AACxC,uCAAgD;AAEhD,SAAS,uBAAuB,CAAC,IAAoC;IACnE,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAA,aAAG,EAAC,kCAAkC,CAAC,CAAC;KACzC;IACD,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,CAAwB,CAAC;QAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;KAC7B;IACD,I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AC;QACjB,IAAA,YAAE,GAAE,CAAC;QACL,IAAA,aAAG,EAAC,4BAA4B,CAAC,CAAC;QAClC,IAAA,aAAG,EAAC,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAA,YAAE,GAAE,CAAC;QACL,IAAA,aAAG,EAAC,2CAA2C,CAAC,CAAC;QACjD,IAAA,aAAG,EAAC,mCAAmC,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AA7BD,kCA6BC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../Constants';\nimport type { IStep } from '../Steps/BaseStep';\nimport type { BaseIntegration } from '../Steps/Integrations/BaseIntegration';\nimport { BottomBar } from './BottomBar';\nimport { debug, dim, nl, red } from './Logging';\n\nfunction sanitizeAndValidateArgs(argv: Args & Record<string, unknown>): void {\n if (argv.quiet === undefined) {\n argv.quiet = true;\n dim('will activate quiet mode for you');\n }\n if (argv['skip-connect']) {\n argv.skipConnect = argv['skip-connect'] as Args['skipConnect'];\n delete argv['skip-connect'];\n }\n argv.promoCode = argv['promo-code'] as Args['promoCode'];\n if (argv['ignore-git-changes']) {\n argv.ignoreGitChanges = argv[\n 'ignore-git-changes'\n ] as Args['ignoreGitChanges'];\n delete argv['ignore-git-changes'];\n }\n if (argv['xcode-project-dir']) {\n argv.xcodeProjectDir = argv['xcode-project-dir'] as Args['xcodeProjectDir'];\n delete argv['xcode-project-dir'];\n }\n}\n\nexport function getCurrentIntegration(answers: Answers): BaseIntegration {\n return answers.integration as BaseIntegration;\n}\n\nexport async function startWizard<M extends IStep>(\n argv: Args,\n ...steps: Array<{ new (debug: Args): M }>\n): Promise<Answers> {\n try {\n sanitizeAndValidateArgs(argv as Args & Record<string, unknown>);\n if (argv.debug) {\n debug(argv);\n }\n if (argv.quiet) {\n dim(\"Quiet mode On, DAMA, don't ask me anything\");\n }\n return await steps\n .map((step) => new step(argv))\n .reduce(async (answer, step) => {\n const prevAnswer = await answer;\n const answers = await step.emit(prevAnswer);\n return { ...prevAnswer, ...answers };\n }, Promise.resolve({}));\n } catch (e: unknown) {\n BottomBar.hide();\n nl();\n red('Sentry Wizard failed with:');\n red(argv.debug && e instanceof Error ? e.message : String(e));\n nl();\n red('Protip: Add --debug to see whats going on');\n red('OR use --help to see your options');\n process.exit(1);\n }\n}\n"]}
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /// <reference types="jest" />
3
+ const vitest_1 = require("vitest");
4
4
  const File_1 = require("../File");
5
- describe('SentryCli', () => {
6
- test('exists', () => {
7
- expect((0, File_1.exists)('**/File.ts')).toBeTruthy();
8
- expect((0, File_1.exists)('Filea.ts')).toBeFalsy();
5
+ (0, vitest_1.describe)('SentryCli', () => {
6
+ (0, vitest_1.test)('exists', () => {
7
+ (0, vitest_1.expect)((0, File_1.exists)('**/File.ts')).toBeTruthy();
8
+ (0, vitest_1.expect)((0, File_1.exists)('Filea.ts')).toBeFalsy();
9
9
  });
10
- test('matchesContent', () => {
11
- expect((0, File_1.matchesContent)('**/File.ts', /exists/g)).toBeTruthy();
12
- expect((0, File_1.matchesContent)('**/File.ts', /blabla/g)).toBeFalsy();
13
- expect((0, File_1.matchesContent)('Filea.ts', /exists/g)).toBeFalsy();
10
+ (0, vitest_1.test)('matchesContent', () => {
11
+ (0, vitest_1.expect)((0, File_1.matchesContent)('**/File.ts', /exists/g)).toBeTruthy();
12
+ (0, vitest_1.expect)((0, File_1.matchesContent)('**/File.ts', /blabla/g)).toBeFalsy();
13
+ (0, vitest_1.expect)((0, File_1.matchesContent)('Filea.ts', /exists/g)).toBeFalsy();
14
14
  });
15
15
  });
16
16
  //# sourceMappingURL=File.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/File.ts"],"names":[],"mappings":";;AAAA,8BAA8B;AAC9B,kCAAiD;AAEjD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;QAClB,MAAM,CAAC,IAAA,aAAM,EAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAA,aAAM,EAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC1B,MAAM,CAAC,IAAA,qBAAc,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QAC7D,MAAM,CAAC,IAAA,qBAAc,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QAC5D,MAAM,CAAC,IAAA,qBAAc,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"jest\" />\nimport { exists, matchesContent } from '../File';\n\ndescribe('SentryCli', () => {\n test('exists', () => {\n expect(exists('**/File.ts')).toBeTruthy();\n expect(exists('Filea.ts')).toBeFalsy();\n });\n\n test('matchesContent', () => {\n expect(matchesContent('**/File.ts', /exists/g)).toBeTruthy();\n expect(matchesContent('**/File.ts', /blabla/g)).toBeFalsy();\n expect(matchesContent('Filea.ts', /exists/g)).toBeFalsy();\n });\n});\n"]}
1
+ {"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/File.ts"],"names":[],"mappings":";;AAAA,mCAAgD;AAChD,kCAAiD;AAEjD,IAAA,iBAAQ,EAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAA,aAAI,EAAC,QAAQ,EAAE,GAAG,EAAE;QAClB,IAAA,eAAM,EAAC,IAAA,aAAM,EAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QAC1C,IAAA,eAAM,EAAC,IAAA,aAAM,EAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,gBAAgB,EAAE,GAAG,EAAE;QAC1B,IAAA,eAAM,EAAC,IAAA,qBAAc,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QAC7D,IAAA,eAAM,EAAC,IAAA,qBAAc,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QAC5D,IAAA,eAAM,EAAC,IAAA,qBAAc,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test } from 'vitest';\nimport { exists, matchesContent } from '../File';\n\ndescribe('SentryCli', () => {\n test('exists', () => {\n expect(exists('**/File.ts')).toBeTruthy();\n expect(exists('Filea.ts')).toBeFalsy();\n });\n\n test('matchesContent', () => {\n expect(matchesContent('**/File.ts', /exists/g)).toBeTruthy();\n expect(matchesContent('**/File.ts', /blabla/g)).toBeFalsy();\n expect(matchesContent('Filea.ts', /exists/g)).toBeFalsy();\n });\n});\n"]}
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- /// <reference types="jest" />
27
26
  const fs = __importStar(require("fs"));
28
27
  const path = __importStar(require("path"));
29
28
  const MergeConfig_1 = require("../MergeConfig");
29
+ const vitest_1 = require("vitest");
30
30
  const configPath = path.join(__dirname, '..', 'test-fixtures/next.config.js');
31
31
  const templatePath = path.join(__dirname, '..', '..', '..', 'scripts/NextJs/configs/next.config.template.js');
32
32
  function configFileNames(num) {
@@ -34,47 +34,47 @@ function configFileNames(num) {
34
34
  const mergedPath = path.join(__dirname, '..', `test-fixtures/next.config.${num}-merged.js`);
35
35
  return { sourcePath, mergedPath };
36
36
  }
37
- describe('Merging next.config.js', () => {
38
- afterEach(() => {
37
+ (0, vitest_1.describe)('Merging next.config.js', () => {
38
+ (0, vitest_1.afterEach)(() => {
39
39
  fs.unlinkSync(configPath);
40
40
  });
41
- test('merge basic next.config.js return true', () => {
41
+ (0, vitest_1.test)('merge basic next.config.js return true', () => {
42
42
  const { sourcePath } = configFileNames(1);
43
43
  fs.copyFileSync(sourcePath, configPath);
44
- expect((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(true);
44
+ (0, vitest_1.expect)((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(true);
45
45
  });
46
- test('merge basic next.config.js', () => {
46
+ (0, vitest_1.test)('merge basic next.config.js', () => {
47
47
  const { sourcePath, mergedPath } = configFileNames(1);
48
48
  fs.copyFileSync(sourcePath, configPath);
49
49
  (0, MergeConfig_1.mergeConfigFile)(configPath, templatePath);
50
- expect(fs.readFileSync(configPath, 'utf8')).toEqual(fs.readFileSync(mergedPath, 'utf8'));
50
+ (0, vitest_1.expect)(fs.readFileSync(configPath, 'utf8')).toEqual(fs.readFileSync(mergedPath, 'utf8'));
51
51
  });
52
- test('merge invalid javascript config return false', () => {
52
+ (0, vitest_1.test)('merge invalid javascript config return false', () => {
53
53
  const { sourcePath } = configFileNames(2);
54
54
  fs.copyFileSync(sourcePath, configPath);
55
- expect((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(false);
55
+ (0, vitest_1.expect)((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(false);
56
56
  });
57
- test('merge more complicated next.config.js return true', () => {
57
+ (0, vitest_1.test)('merge more complicated next.config.js return true', () => {
58
58
  const { sourcePath } = configFileNames(3);
59
59
  fs.copyFileSync(sourcePath, configPath);
60
- expect((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(true);
60
+ (0, vitest_1.expect)((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(true);
61
61
  });
62
- test('merge more complicated next.config.js', () => {
62
+ (0, vitest_1.test)('merge more complicated next.config.js', () => {
63
63
  const { sourcePath, mergedPath } = configFileNames(3);
64
64
  fs.copyFileSync(sourcePath, configPath);
65
65
  (0, MergeConfig_1.mergeConfigFile)(configPath, templatePath);
66
- expect(fs.readFileSync(configPath, 'utf8')).toEqual(fs.readFileSync(mergedPath, 'utf8'));
66
+ (0, vitest_1.expect)(fs.readFileSync(configPath, 'utf8')).toEqual(fs.readFileSync(mergedPath, 'utf8'));
67
67
  });
68
- test('merge next.config.js with function return true', () => {
68
+ (0, vitest_1.test)('merge next.config.js with function return true', () => {
69
69
  const { sourcePath } = configFileNames(4);
70
70
  fs.copyFileSync(sourcePath, configPath);
71
- expect((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(true);
71
+ (0, vitest_1.expect)((0, MergeConfig_1.mergeConfigFile)(configPath, templatePath)).toBe(true);
72
72
  });
73
- test('merge next.config.js with function', () => {
73
+ (0, vitest_1.test)('merge next.config.js with function', () => {
74
74
  const { sourcePath, mergedPath } = configFileNames(4);
75
75
  fs.copyFileSync(sourcePath, configPath);
76
76
  (0, MergeConfig_1.mergeConfigFile)(configPath, templatePath);
77
- expect(fs.readFileSync(configPath, 'utf8')).toEqual(fs.readFileSync(mergedPath, 'utf8'));
77
+ (0, vitest_1.expect)(fs.readFileSync(configPath, 'utf8')).toEqual(fs.readFileSync(mergedPath, 'utf8'));
78
78
  });
79
79
  });
80
80
  //# sourceMappingURL=MergeConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MergeConfig.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/MergeConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,uCAAyB;AACzB,2CAA6B;AAE7B,gDAAiD;AAE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G,eAAe,CAAC,CAAC,CAAC,CAAC;QAC1C,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAExC,MAAM,CAAC,IAAA,6BAAe,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACtD,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAExC,IAAA,6BAAe,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAE1C,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CACjD,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"jest\" />\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nimport { mergeConfigFile } from '../MergeConfig';\n\nconst configPath = path.join(__dirname, '..', 'test-fixtures/next.config.js');\nconst templatePath = path.join(\n __dirname,\n '..',\n '..',\n '..',\n 'scripts/NextJs/configs/next.config.template.js',\n);\n\nfunction configFileNames(num: number): {\n sourcePath: string;\n mergedPath: string;\n} {\n const sourcePath = path.join(\n __dirname,\n '..',\n `test-fixtures/next.config.${num}.js`,\n );\n const mergedPath = path.join(\n __dirname,\n '..',\n `test-fixtures/next.config.${num}-merged.js`,\n );\n return { sourcePath, mergedPath };\n}\n\ndescribe('Merging next.config.js', () => {\n afterEach(() => {\n fs.unlinkSync(configPath);\n });\n\n test('merge basic next.config.js return true', () => {\n const { sourcePath } = configFileNames(1);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(true);\n });\n\n test('merge basic next.config.js', () => {\n const { sourcePath, mergedPath } = configFileNames(1);\n fs.copyFileSync(sourcePath, configPath);\n\n mergeConfigFile(configPath, templatePath);\n\n expect(fs.readFileSync(configPath, 'utf8')).toEqual(\n fs.readFileSync(mergedPath, 'utf8'),\n );\n });\n\n test('merge invalid javascript config return false', () => {\n const { sourcePath } = configFileNames(2);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(false);\n });\n\n test('merge more complicated next.config.js return true', () => {\n const { sourcePath } = configFileNames(3);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(true);\n });\n\n test('merge more complicated next.config.js', () => {\n const { sourcePath, mergedPath } = configFileNames(3);\n fs.copyFileSync(sourcePath, configPath);\n\n mergeConfigFile(configPath, templatePath);\n\n expect(fs.readFileSync(configPath, 'utf8')).toEqual(\n fs.readFileSync(mergedPath, 'utf8'),\n );\n });\n\n test('merge next.config.js with function return true', () => {\n const { sourcePath } = configFileNames(4);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(true);\n });\n\n test('merge next.config.js with function', () => {\n const { sourcePath, mergedPath } = configFileNames(4);\n fs.copyFileSync(sourcePath, configPath);\n\n mergeConfigFile(configPath, templatePath);\n\n expect(fs.readFileSync(configPath, 'utf8')).toEqual(\n fs.readFileSync(mergedPath, 'utf8'),\n );\n });\n});\n"]}
1
+ {"version":3,"file":"MergeConfig.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/MergeConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,gDAAiD;AACjD,mCAA2D;AAE3D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,8BAA8B,CAAC,CAAC;AAC9E,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CA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Y,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAExC,IAAA,eAAM,EAAC,IAAA,6BAAe,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACtD,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAExC,IAAA,6BAAe,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAE1C,IAAA,eAAM,EAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CACjD,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nimport { mergeConfigFile } from '../MergeConfig';\nimport { afterEach, describe, expect, test } from 'vitest';\n\nconst configPath = path.join(__dirname, '..', 'test-fixtures/next.config.js');\nconst templatePath = path.join(\n __dirname,\n '..',\n '..',\n '..',\n 'scripts/NextJs/configs/next.config.template.js',\n);\n\nfunction configFileNames(num: number): {\n sourcePath: string;\n mergedPath: string;\n} {\n const sourcePath = path.join(\n __dirname,\n '..',\n `test-fixtures/next.config.${num}.js`,\n );\n const mergedPath = path.join(\n __dirname,\n '..',\n `test-fixtures/next.config.${num}-merged.js`,\n );\n return { sourcePath, mergedPath };\n}\n\ndescribe('Merging next.config.js', () => {\n afterEach(() => {\n fs.unlinkSync(configPath);\n });\n\n test('merge basic next.config.js return true', () => {\n const { sourcePath } = configFileNames(1);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(true);\n });\n\n test('merge basic next.config.js', () => {\n const { sourcePath, mergedPath } = configFileNames(1);\n fs.copyFileSync(sourcePath, configPath);\n\n mergeConfigFile(configPath, templatePath);\n\n expect(fs.readFileSync(configPath, 'utf8')).toEqual(\n fs.readFileSync(mergedPath, 'utf8'),\n );\n });\n\n test('merge invalid javascript config return false', () => {\n const { sourcePath } = configFileNames(2);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(false);\n });\n\n test('merge more complicated next.config.js return true', () => {\n const { sourcePath } = configFileNames(3);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(true);\n });\n\n test('merge more complicated next.config.js', () => {\n const { sourcePath, mergedPath } = configFileNames(3);\n fs.copyFileSync(sourcePath, configPath);\n\n mergeConfigFile(configPath, templatePath);\n\n expect(fs.readFileSync(configPath, 'utf8')).toEqual(\n fs.readFileSync(mergedPath, 'utf8'),\n );\n });\n\n test('merge next.config.js with function return true', () => {\n const { sourcePath } = configFileNames(4);\n fs.copyFileSync(sourcePath, configPath);\n\n expect(mergeConfigFile(configPath, templatePath)).toBe(true);\n });\n\n test('merge next.config.js with function', () => {\n const { sourcePath, mergedPath } = configFileNames(4);\n fs.copyFileSync(sourcePath, configPath);\n\n mergeConfigFile(configPath, templatePath);\n\n expect(fs.readFileSync(configPath, 'utf8')).toEqual(\n fs.readFileSync(mergedPath, 'utf8'),\n );\n });\n});\n"]}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Constants_1 = require("../../Constants");
4
4
  const SentryCli_1 = require("../SentryCli");
5
+ const vitest_1 = require("vitest");
5
6
  const args = {
6
7
  debug: false,
7
8
  integration: Constants_1.Integration.reactNative,
@@ -26,24 +27,25 @@ const demoAnswers = {
26
27
  },
27
28
  },
28
29
  };
29
- describe('SentryCli', () => {
30
- test('convertAnswersToProperties', () => {
31
- const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');
30
+ (0, vitest_1.describe)('SentryCli', () => {
31
+ const resolveFunc = vitest_1.vi
32
+ .fn()
33
+ .mockReturnValue('node_modules/sentry/cli');
34
+ (0, vitest_1.test)('convertAnswersToProperties', () => {
32
35
  const sentry = new SentryCli_1.SentryCli(args);
33
36
  sentry.setResolveFunction(resolveFunc);
34
37
  const props = sentry.convertAnswersToProperties(demoAnswers);
35
- expect(props['defaults/url']).toBe('https://localhost:1234');
36
- expect(props['defaults/org']).toBe('test_org');
37
- expect(props['defaults/project']).toBe('test_proj');
38
- expect(props['auth/token']).toBe('abcd');
39
- expect(props['cli/executable']).toBe('node_modules/sentry/cli');
38
+ (0, vitest_1.expect)(props['defaults/url']).toBe('https://localhost:1234');
39
+ (0, vitest_1.expect)(props['defaults/org']).toBe('test_org');
40
+ (0, vitest_1.expect)(props['defaults/project']).toBe('test_proj');
41
+ (0, vitest_1.expect)(props['auth/token']).toBe('abcd');
42
+ (0, vitest_1.expect)(props['cli/executable']).toBe('node_modules/sentry/cli');
40
43
  });
41
- test('dump properties', () => {
42
- const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');
44
+ (0, vitest_1.test)('dump properties', () => {
43
45
  const sentry = new SentryCli_1.SentryCli(args);
44
46
  sentry.setResolveFunction(resolveFunc);
45
47
  const props = sentry.convertAnswersToProperties(demoAnswers);
46
- expect(sentry.dumpProperties(props))
48
+ (0, vitest_1.expect)(sentry.dumpProperties(props))
47
49
  .toBe(`defaults.url=https://localhost:1234
48
50
  defaults.org=test_org
49
51
  defaults.project=test_proj
@@ -51,23 +53,39 @@ auth.token=abcd
51
53
  cli.executable=node_modules/sentry/cli
52
54
  `);
53
55
  });
54
- test('convertAnswersToProperties windows', () => {
55
- const resolveFunc = jest.fn().mockReturnValue('node_modules\\sentry\\cli');
56
+ (0, vitest_1.test)('dump config', () => {
57
+ const sentry = new SentryCli_1.SentryCli(args);
58
+ sentry.setResolveFunction(resolveFunc);
59
+ const props = {
60
+ auth: { 'auth/token': 'myToken' },
61
+ };
62
+ (0, vitest_1.expect)(sentry.dumpConfig(props)).toMatchInlineSnapshot(`
63
+ "[auth]
64
+ token=myToken
65
+ "
66
+ `);
67
+ });
68
+ (0, vitest_1.test)('convertAnswersToProperties windows', () => {
69
+ const resolveFunc = vitest_1.vi
70
+ .fn()
71
+ .mockReturnValue('node_modules\\sentry\\cli');
56
72
  const sentry = new SentryCli_1.SentryCli(args);
57
73
  sentry.setResolveFunction(resolveFunc);
58
74
  const props = sentry.convertAnswersToProperties(demoAnswers);
59
- expect(props['defaults/url']).toBe('https://localhost:1234');
60
- expect(props['defaults/org']).toBe('test_org');
61
- expect(props['defaults/project']).toBe('test_proj');
62
- expect(props['auth/token']).toBe('abcd');
63
- expect(props['cli/executable']).toBe('node_modules\\\\sentry\\\\cli');
75
+ (0, vitest_1.expect)(props['defaults/url']).toBe('https://localhost:1234');
76
+ (0, vitest_1.expect)(props['defaults/org']).toBe('test_org');
77
+ (0, vitest_1.expect)(props['defaults/project']).toBe('test_proj');
78
+ (0, vitest_1.expect)(props['auth/token']).toBe('abcd');
79
+ (0, vitest_1.expect)(props['cli/executable']).toBe('node_modules\\\\sentry\\\\cli');
64
80
  });
65
- test('dump properties windows', () => {
66
- const resolveFunc = jest.fn().mockReturnValue('node_modules\\sentry\\cli');
81
+ (0, vitest_1.test)('dump properties windows', () => {
82
+ const resolveFunc = vitest_1.vi
83
+ .fn()
84
+ .mockReturnValue('node_modules\\sentry\\cli');
67
85
  const sentry = new SentryCli_1.SentryCli(args);
68
86
  sentry.setResolveFunction(resolveFunc);
69
87
  const props = sentry.convertAnswersToProperties(demoAnswers);
70
- expect(sentry.dumpProperties(props))
88
+ (0, vitest_1.expect)(sentry.dumpProperties(props))
71
89
  .toBe(`defaults.url=https://localhost:1234
72
90
  defaults.org=test_org
73
91
  defaults.project=test_proj
@@ -1 +1 @@
1
- {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/SentryCli.ts"],"names":[],"mappings":";;AAIA,+C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B,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAAC;QAC3E,MAAM,MAAM,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aACjC,IAAI,CAAC;;;;;CAKX,CAAC,CAAC;IACD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"jest\" />\nimport type { Answers } from 'inquirer';\n\nimport type { Args } from '../../Constants';\nimport { Integration, Platform } from '../../Constants';\nimport { SentryCli } from '../SentryCli';\n\nconst args: Args = {\n debug: false,\n integration: Integration.reactNative,\n platform: [Platform.ios],\n quiet: false,\n skipConnect: false,\n uninstall: false,\n url: 'https://localhost:1234',\n signup: false,\n disableTelemetry: false,\n};\n\nconst demoAnswers: Answers = {\n config: {\n auth: {\n token: 'abcd',\n },\n organization: {\n slug: 'test_org',\n },\n project: {\n slug: 'test_proj',\n },\n },\n};\n\ndescribe('SentryCli', () => {\n test('convertAnswersToProperties', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules/sentry/cli');\n });\n\n test('dump properties', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules/sentry/cli\n`);\n });\n\n test('convertAnswersToProperties windows', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules\\\\sentry\\\\cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules\\\\\\\\sentry\\\\\\\\cli');\n });\n\n test('dump properties windows', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules\\\\sentry\\\\cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules\\\\\\\\sentry\\\\\\\\cli\n`);\n });\n});\n"]}
1
+ {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/SentryCli.ts"],"names":[],"mappings":";;AAGA,+CAAwD;AACxD,4CAAyC;AACzC,mCAAoD;AAIpD,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,uBAAW,CAAC,WAAW;IACpC,QAAQ,EAAE,CAAC,oBAAQ,CAAC,GAAG,CAAC;IACxB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,GAAG,EAAE,wBAAwB;IAC7B,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AAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,IAAA,eAAM,EAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,WAAW,GAAG,WAAE;aACnB,EAAE,EAAE;aACJ,eAAe,CACd,2BAA2B,CACC,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC7D,IAAA,eAAM,EAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aACjC,IAAI,CAAC;;;;;CAKX,CAAC,CAAC;IACD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../../Constants';\nimport { Integration, Platform } from '../../Constants';\nimport { SentryCli } from '../SentryCli';\nimport { describe, expect, test, vi } from 'vitest';\n\ntype RequireResolve = typeof require.resolve;\n\nconst args: Args = {\n debug: false,\n integration: Integration.reactNative,\n platform: [Platform.ios],\n quiet: false,\n skipConnect: false,\n uninstall: false,\n url: 'https://localhost:1234',\n signup: false,\n disableTelemetry: false,\n};\n\nconst demoAnswers: Answers = {\n config: {\n auth: {\n token: 'abcd',\n },\n organization: {\n slug: 'test_org',\n },\n project: {\n slug: 'test_proj',\n },\n },\n};\n\ndescribe('SentryCli', () => {\n const resolveFunc = vi\n .fn()\n .mockReturnValue('node_modules/sentry/cli') as unknown as RequireResolve;\n test('convertAnswersToProperties', () => {\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules/sentry/cli');\n });\n\n test('dump properties', () => {\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules/sentry/cli\n`);\n });\n\n test('dump config', () => {\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = {\n auth: { 'auth/token': 'myToken' },\n };\n expect(sentry.dumpConfig(props)).toMatchInlineSnapshot(`\n \"[auth]\n token=myToken\n \"\n `);\n });\n\n test('convertAnswersToProperties windows', () => {\n const resolveFunc = vi\n .fn()\n .mockReturnValue(\n 'node_modules\\\\sentry\\\\cli',\n ) as unknown as RequireResolve;\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules\\\\\\\\sentry\\\\\\\\cli');\n });\n\n test('dump properties windows', () => {\n const resolveFunc = vi\n .fn()\n .mockReturnValue(\n 'node_modules\\\\sentry\\\\cli',\n ) as unknown as RequireResolve;\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules\\\\\\\\sentry\\\\\\\\cli\n`);\n });\n});\n"]}
@@ -1,7 +1,10 @@
1
+ import { Answers } from 'inquirer';
2
+ import { Args } from './Constants';
3
+ import { WizardOptions } from '../src/utils/types';
1
4
  /**
2
5
  * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.
3
6
  * When creating new wizards, we now add them to clack-based wizards under `src`.
4
7
  * Therefor, do not call this function anymore.
5
8
  * Use `run` from {@link ../src/run.ts} instead.
6
9
  */
7
- export declare function run(argv: any): Promise<any>;
10
+ export declare function run(argv: Args, wizardOptions: WizardOptions): Promise<Answers>;
package/dist/lib/Setup.js CHANGED
@@ -28,13 +28,15 @@ const debug_1 = require("../src/utils/debug");
28
28
  const Env_1 = require("./Helper/Env");
29
29
  const Wizard_1 = require("./Helper/Wizard");
30
30
  const Step = __importStar(require("./Steps"));
31
+ const telemetry_1 = require("../src/telemetry");
32
+ const node_1 = require("@sentry/node");
31
33
  /**
32
34
  * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.
33
35
  * When creating new wizards, we now add them to clack-based wizards under `src`.
34
36
  * Therefor, do not call this function anymore.
35
37
  * Use `run` from {@link ../src/run.ts} instead.
36
38
  */
37
- async function run(argv) {
39
+ async function run(argv, wizardOptions) {
38
40
  const args = { ...argv, ...(0, Env_1.readEnvironment)() };
39
41
  if (argv.debug) {
40
42
  (0, debug_1.enableDebugLogs)();
@@ -52,7 +54,15 @@ async function run(argv) {
52
54
  steps.push(Step.OpenSentry, Step.WaitForSentry, Step.SentryProjectSelector, Step.PromptForParameters);
53
55
  }
54
56
  steps.push(Step.ConfigureProject, Step.Result);
55
- return (0, Wizard_1.startWizard)(args, ...steps);
57
+ return (0, telemetry_1.withTelemetry)({
58
+ enabled: wizardOptions.telemetryEnabled,
59
+ integration: args.integration,
60
+ wizardOptions,
61
+ }, async () => {
62
+ const res = await (0, Wizard_1.startWizard)(args, ...steps);
63
+ await (0, node_1.flush)(3000);
64
+ return res;
65
+ });
56
66
  }
57
67
  exports.run = run;
58
68
  //# sourceMappingURL=Setup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Setup.js","sourceRoot":"","sources":["../../lib/Setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAqD;AAErD,sCAA+C;AAC/C,4CAA8C;AAC9C,8CAAgC;AAEhC;;;;;GAKG;AACI,KAAK,UAAU,GAAG,CAAC,IAAS;IACjC,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAA,qBAAe,GAAE,EAAE,CAAC;IAE/C,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAA,uBAAe,GAAE,CAAC;KACnB;IAED,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;KACxB;IACD,MAAM,KAAK,GAAG;QACZ,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,iBAAiB;QACtB,IAAI,CAAC,eAAe;KACrB,CAAC;IACF,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE;QAC5B,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,mBAAmB,CACzB,CAAC;KACH;IACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE/C,OAAO,IAAA,oBAAW,EAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;AACrC,CAAC;AA3BD,kBA2BC","sourcesContent":["import { enableDebugLogs } from '../src/utils/debug';\n\nimport { readEnvironment } from './Helper/Env';\nimport { startWizard } from './Helper/Wizard';\nimport * as Step from './Steps';\n\n/**\n * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.\n * When creating new wizards, we now add them to clack-based wizards under `src`.\n * Therefor, do not call this function anymore.\n * Use `run` from {@link ../src/run.ts} instead.\n */\nexport async function run(argv: any): Promise<any> {\n const args = { ...argv, ...readEnvironment() };\n\n if (argv.debug) {\n enableDebugLogs();\n }\n\n if (args.uninstall === undefined) {\n args.uninstall = false;\n }\n const steps = [\n Step.Initial,\n Step.Welcome,\n Step.ChooseIntegration,\n Step.ShouldConfigure,\n ];\n if (args.uninstall === false) {\n steps.push(\n Step.OpenSentry,\n Step.WaitForSentry,\n Step.SentryProjectSelector,\n Step.PromptForParameters,\n );\n }\n steps.push(Step.ConfigureProject, Step.Result);\n\n return startWizard(args, ...steps);\n}\n"]}
1
+ {"version":3,"file":"Setup.js","sourceRoot":"","sources":["../../lib/Setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAAqD;AAGrD,sCAA+C;AAC/C,4CAA8C;AAC9C,8CAAgC;AAChC,gDAAiD;AAEjD,uCAAqC;AAErC;;;;;GAKG;AACI,KAAK,UAAU,GAAG,CACvB,IAAU,EACV,aAA4B;IAE5B,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAA,qBAAe,GAAE,EAAE,CAAC;IAE/C,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAA,uBAAe,GAAE,CAAC;KACnB;IAED,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;KACxB;IACD,MAAM,KAAK,GAAG;QACZ,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,iBAAiB;QACtB,IAAI,CAAC,eAAe;KACrB,CAAC;IACF,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE;QAC5B,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,mBAAmB,CACzB,CAAC;KACH;IACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE/C,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,aAAa,CAAC,gBAAgB;QACvC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa;KACd,EACD,KAAK,IAAI,EAAE;QACT,MAAM,GAAG,GAAG,MAAM,IAAA,oBAAW,EAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;QAC9C,MAAM,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC;QAClB,OAAO,GAAG,CAAC;IACb,CAAC,CACF,CAAC;AACJ,CAAC;AAzCD,kBAyCC","sourcesContent":["import { Answers } from 'inquirer';\nimport { enableDebugLogs } from '../src/utils/debug';\nimport { Args } from './Constants';\n\nimport { readEnvironment } from './Helper/Env';\nimport { startWizard } from './Helper/Wizard';\nimport * as Step from './Steps';\nimport { withTelemetry } from '../src/telemetry';\nimport { WizardOptions } from '../src/utils/types';\nimport { flush } from '@sentry/node';\n\n/**\n * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.\n * When creating new wizards, we now add them to clack-based wizards under `src`.\n * Therefor, do not call this function anymore.\n * Use `run` from {@link ../src/run.ts} instead.\n */\nexport async function run(\n argv: Args,\n wizardOptions: WizardOptions,\n): Promise<Answers> {\n const args = { ...argv, ...readEnvironment() };\n\n if (argv.debug) {\n enableDebugLogs();\n }\n\n if (args.uninstall === undefined) {\n args.uninstall = false;\n }\n const steps = [\n Step.Initial,\n Step.Welcome,\n Step.ChooseIntegration,\n Step.ShouldConfigure,\n ];\n if (args.uninstall === false) {\n steps.push(\n Step.OpenSentry,\n Step.WaitForSentry,\n Step.SentryProjectSelector,\n Step.PromptForParameters,\n );\n }\n steps.push(Step.ConfigureProject, Step.Result);\n\n return withTelemetry(\n {\n enabled: wizardOptions.telemetryEnabled,\n integration: args.integration,\n wizardOptions,\n },\n async () => {\n const res = await startWizard(args, ...steps);\n await flush(3000);\n return res;\n },\n );\n}\n"]}
@@ -4,7 +4,7 @@ export declare abstract class BaseStep implements IStep {
4
4
  protected _argv: Args;
5
5
  protected _isDebug: boolean;
6
6
  constructor(_argv: Args);
7
- debug(msg: any): void;
7
+ debug(msg: unknown): void;
8
8
  abstract emit(answers: Answers): Promise<Answers>;
9
9
  }
10
10
  export interface IStep {
@@ -1 +1 @@
1
- {"version":3,"file":"BaseStep.js","sourceRoot":"","sources":["../../../lib/Steps/BaseStep.ts"],"names":[],"mappings":";;;AAGA,+CAA8C;AAE9C,MAAsB,QAAQ;IAEC;IADnB,QAAQ,GAAG,KAAK,CAAC;IAC3B,YAA6B,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QACtC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,GAAQ;QACnB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAA,YAAE,GAAE,CAAC;YACL,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;YACX,IAAA,YAAE,GAAE,CAAC;SACN;IACH,CAAC;CAGF;AAfD,4BAeC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../Constants';\nimport { debug, nl } from '../Helper/Logging';\n\nexport abstract class BaseStep implements IStep {\n protected _isDebug = false;\n public constructor(protected _argv: Args) {\n this._isDebug = _argv.debug;\n }\n\n public debug(msg: any): void {\n if (this._isDebug) {\n nl();\n debug(msg);\n nl();\n }\n }\n\n public abstract emit(answers: Answers): Promise<Answers>;\n}\n\nexport interface IStep {\n emit(answers?: Answers): Promise<Answers>;\n}\n"]}
1
+ {"version":3,"file":"BaseStep.js","sourceRoot":"","sources":["../../../lib/Steps/BaseStep.ts"],"names":[],"mappings":";;;AAGA,+CAA8C;AAE9C,MAAsB,QAAQ;IAEC;IADnB,QAAQ,GAAG,KAAK,CAAC;IAC3B,YAA6B,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QACtC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,GAAY;QACvB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAA,YAAE,GAAE,CAAC;YACL,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;YACX,IAAA,YAAE,GAAE,CAAC;SACN;IACH,CAAC;CAGF;AAfD,4BAeC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../Constants';\nimport { debug, nl } from '../Helper/Logging';\n\nexport abstract class BaseStep implements IStep {\n protected _isDebug = false;\n public constructor(protected _argv: Args) {\n this._isDebug = _argv.debug;\n }\n\n public debug(msg: unknown): void {\n if (this._isDebug) {\n nl();\n debug(msg);\n nl();\n }\n }\n\n public abstract emit(answers: Answers): Promise<Answers>;\n}\n\nexport interface IStep {\n emit(answers?: Answers): Promise<Answers>;\n}\n"]}
@@ -9,8 +9,7 @@ class BaseIntegration extends BaseStep_1.BaseStep {
9
9
  constructor(_argv) {
10
10
  super(_argv);
11
11
  this._argv = _argv;
12
- // @ts-ignore property construct does not exist on BaseIntegration
13
- this.type = this.construct;
12
+ this.type = this.constructor.name;
14
13
  }
15
14
  // eslint-disable-next-line @typescript-eslint/require-await
16
15
  async uninstall(_answers) {
@@ -1 +1 @@
1
- {"version":3,"file":"BaseIntegration.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/BaseIntegration.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AAEvC,MAAsB,eAAgB,SAAQ,mBAAQ;IAIvB;IAHtB,IAAI,CAAS;IACV,gBAAgB,CAAmB;IAE7C,YAA6B,KAAW;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QADc,UAAK,GAAL,KAAK,CAAM;QAEtC,kEAAkE;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;IAC7B,CAAC;IAED,4DAA4D;IACrD,KAAK,CAAC,SAAS,CAAC,QAAiB;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,QAAiB;QAC5C,kEAAkE;QAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,QAAiB;QACvC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAC7D,CAAC,MAAe,EAAE,EAAE,CAAC,MAAM,CAC5B,CAAC;IACJ,CAAC;CAGF;AApCD,0CAoCC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../../Constants';\nimport { BaseStep } from '../BaseStep';\n\nexport abstract class BaseIntegration extends BaseStep {\n public type: string;\n protected _shouldConfigure: Promise<Answers>;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n // @ts-ignore property construct does not exist on BaseIntegration\n this.type = this.construct;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n public async uninstall(_answers: Answers): Promise<Answers> {\n return {};\n }\n\n /**\n * This can be used for example for platform:boolean to determine\n * if we should configure iOS/Android.\n * Basically this will be merged into answers so it can be checked by a later step.\n */\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n this._shouldConfigure = Promise.resolve({ platform: true });\n return this._shouldConfigure;\n }\n\n public async shouldEmit(_answers: Answers): Promise<boolean> {\n return Object.values(await this.shouldConfigure(_answers)).some(\n (active: boolean) => active,\n );\n }\n\n public abstract emit(answers: Answers): Promise<Answers>;\n}\n"]}
1
+ {"version":3,"file":"BaseIntegration.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/BaseIntegration.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AAEvC,MAAsB,eAAgB,SAAQ,mBAAQ;IAIvB;IAHtB,IAAI,CAAS;IACV,gBAAgB,CAAmB;IAE7C,YAA6B,KAAW;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QADc,UAAK,GAAL,KAAK,CAAM;QAEtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;IAED,4DAA4D;IACrD,KAAK,CAAC,SAAS,CAAC,QAAiB;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,QAAiB;QAC5C,kEAAkE;QAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,QAAiB;QACvC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAC7D,CAAC,MAAe,EAAE,EAAE,CAAC,MAAM,CAC5B,CAAC;IACJ,CAAC;CAGF;AAnCD,0CAmCC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../../Constants';\nimport { BaseStep } from '../BaseStep';\n\nexport abstract class BaseIntegration extends BaseStep {\n public type: string;\n protected _shouldConfigure: Promise<Answers>;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this.type = this.constructor.name;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n public async uninstall(_answers: Answers): Promise<Answers> {\n return {};\n }\n\n /**\n * This can be used for example for platform:boolean to determine\n * if we should configure iOS/Android.\n * Basically this will be merged into answers so it can be checked by a later step.\n */\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n this._shouldConfigure = Promise.resolve({ platform: true });\n return this._shouldConfigure;\n }\n\n public async shouldEmit(_answers: Answers): Promise<boolean> {\n return Object.values(await this.shouldConfigure(_answers)).some(\n (active: boolean) => active,\n );\n }\n\n public abstract emit(answers: Answers): Promise<Answers>;\n}\n"]}