@sentry/wizard 4.7.0 → 4.9.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 (175) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +19 -19
  3. package/dist/e2e-tests/tests/angular-17.test.d.ts +1 -0
  4. package/dist/e2e-tests/tests/angular-17.test.js +196 -0
  5. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -0
  6. package/dist/e2e-tests/tests/angular-19.test.d.ts +1 -0
  7. package/dist/e2e-tests/tests/angular-19.test.js +194 -0
  8. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -0
  9. package/dist/e2e-tests/tests/expo.test.d.ts +1 -0
  10. package/dist/e2e-tests/tests/expo.test.js +103 -0
  11. package/dist/e2e-tests/tests/expo.test.js.map +1 -0
  12. package/dist/e2e-tests/tests/help-message.test.js +2 -2
  13. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/react-native.test.d.ts +1 -0
  15. package/dist/e2e-tests/tests/react-native.test.js +132 -0
  16. package/dist/e2e-tests/tests/react-native.test.js.map +1 -0
  17. package/dist/e2e-tests/tests/remix.test.js +4 -4
  18. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  19. package/dist/e2e-tests/tests/sveltekit.test.js +2 -2
  20. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  21. package/dist/e2e-tests/utils/index.d.ts +7 -0
  22. package/dist/e2e-tests/utils/index.js +32 -7
  23. package/dist/e2e-tests/utils/index.js.map +1 -1
  24. package/dist/lib/Constants.d.ts +1 -0
  25. package/dist/lib/Constants.js +3 -0
  26. package/dist/lib/Constants.js.map +1 -1
  27. package/dist/lib/Helper/SentryCli.d.ts +0 -11
  28. package/dist/lib/Helper/SentryCli.js +0 -52
  29. package/dist/lib/Helper/SentryCli.js.map +1 -1
  30. package/dist/src/android/templates.js +2 -0
  31. package/dist/src/android/templates.js.map +1 -1
  32. package/dist/src/angular/angular-wizard.d.ts +3 -0
  33. package/dist/src/angular/angular-wizard.js +186 -0
  34. package/dist/src/angular/angular-wizard.js.map +1 -0
  35. package/dist/src/angular/codemods/app-config.d.ts +3 -0
  36. package/dist/src/angular/codemods/app-config.js +211 -0
  37. package/dist/src/angular/codemods/app-config.js.map +1 -0
  38. package/dist/src/angular/codemods/main.d.ts +20 -0
  39. package/dist/src/angular/codemods/main.js +62 -0
  40. package/dist/src/angular/codemods/main.js.map +1 -0
  41. package/dist/src/angular/codemods/sourcemaps.d.ts +21 -0
  42. package/dist/src/angular/codemods/sourcemaps.js +94 -0
  43. package/dist/src/angular/codemods/sourcemaps.js.map +1 -0
  44. package/dist/src/angular/example-component.d.ts +8 -0
  45. package/dist/src/angular/example-component.js +286 -0
  46. package/dist/src/angular/example-component.js.map +1 -0
  47. package/dist/src/angular/sdk-setup.d.ts +6 -0
  48. package/dist/src/angular/sdk-setup.js +99 -0
  49. package/dist/src/angular/sdk-setup.js.map +1 -0
  50. package/dist/src/apple/code-tools.d.ts +4 -2
  51. package/dist/src/apple/code-tools.js +21 -11
  52. package/dist/src/apple/code-tools.js.map +1 -1
  53. package/dist/src/apple/inject-code-snippet.js +5 -3
  54. package/dist/src/apple/inject-code-snippet.js.map +1 -1
  55. package/dist/src/apple/macos-system-helper.d.ts +5 -0
  56. package/dist/src/apple/macos-system-helper.js +86 -0
  57. package/dist/src/apple/macos-system-helper.js.map +1 -0
  58. package/dist/src/apple/templates.js +10 -0
  59. package/dist/src/apple/templates.js.map +1 -1
  60. package/dist/src/apple/xcode-manager.d.ts +237 -11
  61. package/dist/src/apple/xcode-manager.js +736 -65
  62. package/dist/src/apple/xcode-manager.js.map +1 -1
  63. package/dist/src/apple/xcode-project-object-with-id.d.ts +5 -0
  64. package/dist/src/apple/xcode-project-object-with-id.js +3 -0
  65. package/dist/src/apple/xcode-project-object-with-id.js.map +1 -0
  66. package/dist/src/flutter/flutter-wizard.js +10 -2
  67. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  68. package/dist/src/flutter/templates.js +7 -1
  69. package/dist/src/flutter/templates.js.map +1 -1
  70. package/dist/src/nextjs/nextjs-wizard.js +27 -15
  71. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  72. package/dist/src/nextjs/templates.js +56 -7
  73. package/dist/src/nextjs/templates.js.map +1 -1
  74. package/dist/src/nuxt/nuxt-wizard.js +1 -3
  75. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  76. package/dist/src/nuxt/templates.js +30 -0
  77. package/dist/src/nuxt/templates.js.map +1 -1
  78. package/dist/src/react-native/expo-env-file.js +5 -0
  79. package/dist/src/react-native/expo-env-file.js.map +1 -1
  80. package/dist/src/react-native/expo-metro.js +22 -6
  81. package/dist/src/react-native/expo-metro.js.map +1 -1
  82. package/dist/src/react-native/expo.js +11 -1
  83. package/dist/src/react-native/expo.js.map +1 -1
  84. package/dist/src/react-native/glob.js +14 -4
  85. package/dist/src/react-native/glob.js.map +1 -1
  86. package/dist/src/react-native/gradle.js +14 -4
  87. package/dist/src/react-native/gradle.js.map +1 -1
  88. package/dist/src/react-native/javascript.d.ts +9 -4
  89. package/dist/src/react-native/javascript.js +52 -23
  90. package/dist/src/react-native/javascript.js.map +1 -1
  91. package/dist/src/react-native/metro.d.ts +1 -1
  92. package/dist/src/react-native/metro.js +36 -4
  93. package/dist/src/react-native/metro.js.map +1 -1
  94. package/dist/src/react-native/react-native-wizard.d.ts +4 -0
  95. package/dist/src/react-native/react-native-wizard.js +32 -4
  96. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  97. package/dist/src/react-native/xcode.js +29 -10
  98. package/dist/src/react-native/xcode.js.map +1 -1
  99. package/dist/src/remix/remix-wizard.js +1 -3
  100. package/dist/src/remix/remix-wizard.js.map +1 -1
  101. package/dist/src/remix/sdk-example.js +30 -1
  102. package/dist/src/remix/sdk-example.js.map +1 -1
  103. package/dist/src/remix/sdk-setup.js +11 -5
  104. package/dist/src/remix/sdk-setup.js.map +1 -1
  105. package/dist/src/run.d.ts +1 -1
  106. package/dist/src/run.js +5 -0
  107. package/dist/src/run.js.map +1 -1
  108. package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +1 -1
  109. package/dist/src/sourcemaps/sourcemaps-wizard.js +35 -20
  110. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  111. package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
  112. package/dist/src/sourcemaps/tools/angular.js +7 -7
  113. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  114. package/dist/src/sourcemaps/tools/sentry-cli.d.ts +5 -1
  115. package/dist/src/sourcemaps/tools/sentry-cli.js +6 -3
  116. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  117. package/dist/src/sourcemaps/tools/tsc.js +5 -1
  118. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  119. package/dist/src/sourcemaps/tools/vite.js +4 -1
  120. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  121. package/dist/src/sourcemaps/tools/webpack.js +4 -1
  122. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  123. package/dist/src/sveltekit/sdk-example.js +1 -1
  124. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  125. package/dist/src/sveltekit/sveltekit-wizard.js +3 -5
  126. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  127. package/dist/src/sveltekit/templates.js +28 -1
  128. package/dist/src/sveltekit/templates.js.map +1 -1
  129. package/dist/src/utils/clack/index.d.ts +13 -15
  130. package/dist/src/utils/clack/index.js +17 -50
  131. package/dist/src/utils/clack/index.js.map +1 -1
  132. package/dist/src/utils/git.d.ts +11 -0
  133. package/dist/src/utils/git.js +69 -0
  134. package/dist/src/utils/git.js.map +1 -0
  135. package/dist/src/utils/sentrycli-utils.js +13 -4
  136. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  137. package/dist/src/version.d.ts +1 -1
  138. package/dist/src/version.js +1 -1
  139. package/dist/src/version.js.map +1 -1
  140. package/dist/test/angular/angular-wizard.test.d.ts +1 -0
  141. package/dist/test/angular/angular-wizard.test.js +27 -0
  142. package/dist/test/angular/angular-wizard.test.js.map +1 -0
  143. package/dist/test/angular/codemods/sourcemaps.test.d.ts +1 -0
  144. package/dist/test/angular/codemods/sourcemaps.test.js +237 -0
  145. package/dist/test/angular/codemods/sourcemaps.test.js.map +1 -0
  146. package/dist/test/angular/example-component.test.d.ts +1 -0
  147. package/dist/test/angular/example-component.test.js +105 -0
  148. package/dist/test/angular/example-component.test.js.map +1 -0
  149. package/dist/test/apple/code-tools.test.js +54 -35
  150. package/dist/test/apple/code-tools.test.js.map +1 -1
  151. package/dist/test/apple/configure-sentry-cli.test.d.ts +1 -0
  152. package/dist/test/apple/configure-sentry-cli.test.js +131 -0
  153. package/dist/test/apple/configure-sentry-cli.test.js.map +1 -0
  154. package/dist/test/apple/macos-system-helper-mocked.test.d.ts +1 -0
  155. package/dist/test/apple/macos-system-helper-mocked.test.js +46 -0
  156. package/dist/test/apple/macos-system-helper-mocked.test.js.map +1 -0
  157. package/dist/test/apple/macos-system-helper.test.d.ts +1 -0
  158. package/dist/test/apple/macos-system-helper.test.js +88 -0
  159. package/dist/test/apple/macos-system-helper.test.js.map +1 -0
  160. package/dist/test/apple/templates.test.js +10 -0
  161. package/dist/test/apple/templates.test.js.map +1 -1
  162. package/dist/test/apple/xcode-manager.test.js +745 -379
  163. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  164. package/dist/test/flutter/templates.test.js +9 -0
  165. package/dist/test/flutter/templates.test.js.map +1 -1
  166. package/dist/test/react-native/javascript.test.js +119 -0
  167. package/dist/test/react-native/javascript.test.js.map +1 -1
  168. package/dist/test/react-native/metro.test.js +113 -0
  169. package/dist/test/react-native/metro.test.js.map +1 -1
  170. package/dist/test/remix/client-entry.test.js +10 -10
  171. package/dist/test/remix/client-entry.test.js.map +1 -1
  172. package/dist/test/utils/git.test.d.ts +1 -0
  173. package/dist/test/utils/git.test.js +70 -0
  174. package/dist/test/utils/git.test.js.map +1 -0
  175. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../e2e-tests/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAGlC,2DAAqD;AAErD,sDAA2D;AAC3D,mCAAgC;AAEnB,QAAA,IAAI,GAAG;IAClB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;CACX,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;IACnE,WAAW,EACT,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,0CAA0C;IAC3E,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,eAAe;IACxD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,mBAAmB;CACrE,CAAC;AAEW,QAAA,GAAG,GAAG;IACjB,OAAO,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,IAAA,eAAK,EAAC,aAAa,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;QACxB,IAAA,aAAG,EAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IAC3B,CAAC;IACD,KAAK,EAAE,CAAC,OAAgB,EAAE,EAAE;QAC1B,SAAS,aAAa,CAAC,OAAgB,EAAE,KAAa;YACpD,IAAI,KAAK,GAAG,CAAC,EAAE;gBACb,OAAO,KAAK,CAAC;aACd;YAED,IAAI,OAAO,YAAY,KAAK,EAAE;gBAC5B,OAAO,IAAI,CAAC,SAAS,CACnB;oBACE,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,OAAO,EAAE,OAAO,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AEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;IAE9E,IAAA,eAAM,EACJ,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QAC1C,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAbD,oDAaC;AAED;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CACzC,UAAkB,EAClB,cAAsB,EACtB,YAAY,GAAG,OAAO;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE;QAC9D,GAAG,EAAE,UAAU;KAChB,CAAC,CAAC;IAEH,IAAA,eAAM,EACJ,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QAC1C,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAhBD,sDAgBC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { Integration } from '../../lib/Constants';\nimport { spawn, execSync } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { dim, green, red } from '../../lib/Helper/Logging';\nimport { expect } from 'vitest';\n\nexport const KEYS = {\n UP: '\\u001b[A',\n DOWN: '\\u001b[B',\n LEFT: '\\u001b[D',\n RIGHT: '\\u001b[C',\n ENTER: '\\r',\n SPACE: ' ',\n};\n\nexport const TEST_ARGS = {\n AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',\n PROJECT_DSN:\n process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',\n ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',\n PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',\n};\n\nexport const log = {\n success: (message: string) => {\n green(`[SUCCESS] ${message}`);\n },\n info: (message: string) => {\n dim(`[INFO] ${message}`);\n },\n error: (message: unknown) => {\n function formatMessage(message: unknown, depth: number): string {\n if (depth > 3) {\n return '...';\n }\n\n if (message instanceof Error) {\n return JSON.stringify(\n {\n name: message.name,\n message: message.message,\n stack: message.stack,\n ...(message.cause\n ? {\n cause: formatMessage(message.cause, depth + 1),\n }\n : {}),\n },\n null,\n 2,\n );\n }\n return String(message);\n }\n red(`[ERROR] ${formatMessage(message, 0)}`);\n },\n};\n\nexport class WizardTestEnv {\n taskHandle: ChildProcess;\n\n constructor(\n cmd: string,\n args: string[],\n opts?: {\n cwd?: string;\n debug?: boolean;\n },\n ) {\n this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });\n\n if (opts?.debug) {\n this.taskHandle.stdout?.pipe(process.stdout);\n this.taskHandle.stderr?.pipe(process.stderr);\n }\n }\n\n sendStdin(input: string) {\n this.taskHandle.stdin?.write(input);\n }\n\n /**\n * Sends the input and waits for the output.\n * @returns a promise that resolves when the output was found\n * @throws an error when the output was not found within the timeout\n */\n sendStdinAndWaitForOutput(\n input: string | string[],\n output: string,\n options?: { timeout?: number; optional?: boolean },\n ) {\n const outputPromise = this.waitForOutput(output, options);\n\n if (Array.isArray(input)) {\n for (const i of input) {\n this.sendStdin(i);\n }\n } else {\n this.sendStdin(input);\n }\n return outputPromise;\n }\n\n /**\n * Waits for the task to exit with a given `statusCode`.\n *\n * @returns a promise that resolves to `true` if the run ends with the status\n * code, or it rejects when the `timeout` was reached.\n */\n waitForStatusCode(\n statusCode: number | null,\n options: {\n /** Timeout in ms */\n timeout?: number;\n } = {},\n ) {\n const { timeout } = {\n timeout: 60_000,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.kill();\n reject(\n new Error(`Timeout waiting for status code: ${statusCode ?? 'null'}`),\n );\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.on('exit', (code: number | null) => {\n clearTimeout(timeoutId);\n resolve(code === statusCode);\n });\n });\n }\n\n /**\n * Waits for the provided output with `.includes()` logic.\n *\n * @returns a promise that resolves to `true` if the output was found, `false` if the output was not found within the\n * timeout and `optional: true` is set, or it rejects when the timeout was reached with `optional: false`\n */\n waitForOutput(\n output: string,\n options: {\n /** Timeout in ms */\n timeout?: number;\n /** Whether to always resolve after the timeout, no matter whether the input was actually found or not. */\n optional?: boolean;\n } = {},\n ) {\n const { timeout, optional } = {\n timeout: 60_000,\n optional: false,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n let outputBuffer = '';\n const timeoutId = setTimeout(() => {\n this.kill();\n if (optional) {\n // The output is not found but it's optional so we can resolve the promise with false\n resolve(false);\n } else {\n reject(\n new Error(\n `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,\n ),\n );\n }\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.stdout?.on('data', (data) => {\n outputBuffer += data;\n if (outputBuffer.includes(output)) {\n clearTimeout(timeoutId);\n // The output is found so we can resolve the promise with true\n resolve(true);\n }\n });\n });\n }\n\n kill() {\n this.taskHandle.stdin?.destroy();\n this.taskHandle.stderr?.destroy();\n this.taskHandle.stdout?.destroy();\n this.taskHandle.kill('SIGINT');\n this.taskHandle.unref();\n }\n}\n\n/**\n * Initialize a git repository in the given directory\n * @param projectDir\n */\nexport function initGit(projectDir: string): void {\n try {\n execSync('git init', { cwd: projectDir });\n // Add all files to the git repo\n execSync('git add -A', { cwd: projectDir });\n // Add author info to avoid git commit error\n execSync('git config user.email test@test.sentry.io', { cwd: projectDir });\n execSync('git config user.name Test', { cwd: projectDir });\n execSync('git commit -m init', { cwd: projectDir });\n } catch (e) {\n log.error('Error initializing git');\n log.error(e);\n }\n}\n\n/**\n * Cleanup the git repository in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n * @param projectDir\n */\nexport function cleanupGit(projectDir: string): void {\n try {\n // Remove the .git directory\n execSync(`rm -rf ${projectDir}/.git`);\n } catch (e) {\n log.error('Error cleaning up git');\n log.error(e);\n }\n}\n\n/**\n * Revert local changes in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n *\n * @param projectDir\n */\nexport function revertLocalChanges(projectDir: string): void {\n try {\n // Revert tracked files\n execSync('git restore .', { cwd: projectDir });\n // Revert untracked files\n execSync('git clean -fd .', { cwd: projectDir });\n } catch (e) {\n log.error('Error reverting local changes');\n log.error(e);\n }\n}\n\n/**\n * Start the wizard instance with the given integration and project directory\n * @param integration\n * @param projectDir\n *\n * @returns WizardTestEnv\n */\nexport function startWizardInstance(\n integration: Integration,\n projectDir: string,\n debug = false,\n): WizardTestEnv {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n initGit(projectDir);\n\n return new WizardTestEnv(\n binPath,\n [\n '--debug',\n '-i',\n integration,\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n '--disable-telemetry',\n ],\n { cwd: projectDir, debug },\n );\n}\n\n/**\n * Create a file with the given content\n *\n * @param filePath\n * @param content\n */\nexport function createFile(filePath: string, content?: string) {\n return fs.writeFileSync(filePath, content || '');\n}\n\n/**\n * Modify the file with the new content\n *\n * @param filePath\n * @param oldContent\n * @param newContent\n */\nexport function modifyFile(\n filePath: string,\n replaceMap: Record<string, string>,\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n let newFileContent = fileContent;\n\n for (const [oldContent, newContent] of Object.entries(replaceMap)) {\n newFileContent = newFileContent.replace(oldContent, newContent);\n }\n\n fs.writeFileSync(filePath, newFileContent);\n}\n\n/**\n * Read the file contents and check if it contains the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileContents(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).toContain(c);\n }\n}\n\n/**\n * Check if the file exists\n *\n * @param filePath\n */\nexport function checkFileExists(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(true);\n}\n\n/**\n * Check if the package.json contains the given integration\n *\n * @param projectDir\n * @param integration\n */\nexport function checkPackageJson(projectDir: string, integration: Integration) {\n checkFileContents(`${projectDir}/package.json`, `@sentry/${integration}`);\n}\n\n/**\n * Check if the .sentryclirc contains the auth token\n *\n * @param projectDir\n */\nexport function checkSentryCliRc(projectDir: string) {\n checkFileContents(\n `${projectDir}/.sentryclirc`,\n `token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the .env.sentry-build-plugin contains the auth token\n * @param projectDir\n */\nexport function checkEnvBuildPlugin(projectDir: string) {\n checkFileContents(\n `${projectDir}/.env.sentry-build-plugin`,\n `SENTRY_AUTH_TOKEN=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the sentry.properties contains the auth token\n * @param projectDir\n */\nexport function checkSentryProperties(projectDir: string) {\n checkFileContents(\n `${projectDir}/sentry.properties`,\n `auth_token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the project builds\n * Check if the project builds and ends with status code 0.\n * @param projectDir\n */\nexport async function checkIfBuilds(projectDir: string) {\n const testEnv = new WizardTestEnv('npm', ['run', 'build'], {\n cwd: projectDir,\n });\n\n const builtSuccessfully = await testEnv.waitForStatusCode(0, {\n timeout: 120_000,\n });\n\n expect(builtSuccessfully).toBe(true);\n}\n\n/**\n * Check if the flutter project builds\n * @param projectDir\n */\nexport async function checkIfFlutterBuilds(\n projectDir: string,\n expectedOutput: string,\n debug = false,\n) {\n const testEnv = new WizardTestEnv('flutter', ['build', 'web'], {\n cwd: projectDir,\n debug: debug,\n });\n\n const outputReceived = await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n });\n\n expect(outputReceived).toBe(true);\n}\n\n/**\n * Check if the project runs on dev mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnDevMode(\n projectDir: string,\n expectedOutput: string,\n) {\n const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });\n\n expect(\n await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n testEnv.kill();\n}\n\n/**\n * Check if the project runs on prod mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnProdMode(\n projectDir: string,\n expectedOutput: string,\n startCommand = 'start',\n) {\n const testEnv = new WizardTestEnv('npm', ['run', startCommand], {\n cwd: projectDir,\n });\n\n expect(\n await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n testEnv.kill();\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../e2e-tests/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAGlC,2DAAqD;AAErD,sDAA2D;AAC3D,mCAAgC;AAEnB,QAAA,IAAI,GAAG;IAClB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,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,GAAG,OAAO;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE;QAC9D,GAAG,EAAE,UAAU;KAChB,CAAC,CAAC;IAEH,IAAA,eAAM,EACJ,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QAC1C,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAhBD,sDAgBC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { Integration } from '../../lib/Constants';\nimport { spawn, execSync } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { dim, green, red } from '../../lib/Helper/Logging';\nimport { expect } from 'vitest';\n\nexport const KEYS = {\n UP: '\\u001b[A',\n DOWN: '\\u001b[B',\n LEFT: '\\u001b[D',\n RIGHT: '\\u001b[C',\n ENTER: '\\r',\n SPACE: ' ',\n};\n\nexport const TEST_ARGS = {\n AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',\n PROJECT_DSN:\n process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',\n ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',\n PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',\n};\n\nexport const log = {\n success: (message: string) => {\n green(`[SUCCESS] ${message}`);\n },\n info: (message: string) => {\n dim(`[INFO] ${message}`);\n },\n error: (message: unknown) => {\n function formatMessage(message: unknown, depth: number): string {\n if (depth > 3) {\n return '...';\n }\n\n if (message instanceof Error) {\n return JSON.stringify(\n {\n name: message.name,\n message: message.message,\n stack: message.stack,\n ...(message.cause\n ? {\n cause: formatMessage(message.cause, depth + 1),\n }\n : {}),\n },\n null,\n 2,\n );\n }\n return String(message);\n }\n red(`[ERROR] ${formatMessage(message, 0)}`);\n },\n};\n\nexport class WizardTestEnv {\n taskHandle: ChildProcess;\n\n constructor(\n cmd: string,\n args: string[],\n opts?: {\n cwd?: string;\n debug?: boolean;\n },\n ) {\n this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });\n\n if (opts?.debug) {\n this.taskHandle.stdout?.pipe(process.stdout);\n this.taskHandle.stderr?.pipe(process.stderr);\n }\n }\n\n sendStdin(input: string) {\n this.taskHandle.stdin?.write(input);\n }\n\n /**\n * Sends the input and waits for the output.\n * @returns a promise that resolves when the output was found\n * @throws an error when the output was not found within the timeout\n */\n sendStdinAndWaitForOutput(\n input: string | string[],\n output: string,\n options?: { timeout?: number; optional?: boolean },\n ) {\n const outputPromise = this.waitForOutput(output, options);\n\n if (Array.isArray(input)) {\n for (const i of input) {\n this.sendStdin(i);\n }\n } else {\n this.sendStdin(input);\n }\n return outputPromise;\n }\n\n /**\n * Waits for the task to exit with a given `statusCode`.\n *\n * @returns a promise that resolves to `true` if the run ends with the status\n * code, or it rejects when the `timeout` was reached.\n */\n waitForStatusCode(\n statusCode: number | null,\n options: {\n /** Timeout in ms */\n timeout?: number;\n } = {},\n ) {\n const { timeout } = {\n timeout: 60_000,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.kill();\n reject(\n new Error(`Timeout waiting for status code: ${statusCode ?? 'null'}`),\n );\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.on('exit', (code: number | null) => {\n clearTimeout(timeoutId);\n resolve(code === statusCode);\n });\n });\n }\n\n /**\n * Waits for the provided output with `.includes()` logic.\n *\n * @returns a promise that resolves to `true` if the output was found, `false` if the output was not found within the\n * timeout and `optional: true` is set, or it rejects when the timeout was reached with `optional: false`\n */\n waitForOutput(\n output: string,\n options: {\n /** Timeout in ms */\n timeout?: number;\n /** Whether to always resolve after the timeout, no matter whether the input was actually found or not. */\n optional?: boolean;\n } = {},\n ) {\n const { timeout, optional } = {\n timeout: 60_000,\n optional: false,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n let outputBuffer = '';\n const timeoutId = setTimeout(() => {\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n\n this.kill();\n if (optional) {\n // The output is not found but it's optional so we can resolve the promise with false\n resolve(false);\n } else {\n reject(\n new Error(\n `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,\n ),\n );\n }\n }, timeout);\n\n const dataListener = (data: string) => {\n outputBuffer += data;\n if (outputBuffer.includes(output)) {\n clearTimeout(timeoutId);\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n // The output is found so we can resolve the promise with true\n resolve(true);\n }\n };\n\n const errorListener = (err: Error) => {\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n clearTimeout(timeoutId);\n reject(err);\n };\n\n this.taskHandle.on('error', errorListener);\n this.taskHandle.stdout?.on('data', dataListener);\n });\n }\n\n kill() {\n this.taskHandle.stdin?.destroy();\n this.taskHandle.stderr?.destroy();\n this.taskHandle.stdout?.destroy();\n this.taskHandle.kill('SIGINT');\n this.taskHandle.unref();\n }\n}\n\n/**\n * Initialize a git repository in the given directory\n * @param projectDir\n */\nexport function initGit(projectDir: string): void {\n try {\n execSync('git init', { cwd: projectDir });\n // Add all files to the git repo\n execSync('git add -A', { cwd: projectDir });\n // Add author info to avoid git commit error\n execSync('git config user.email test@test.sentry.io', { cwd: projectDir });\n execSync('git config user.name Test', { cwd: projectDir });\n execSync('git commit -m init', { cwd: projectDir });\n } catch (e) {\n log.error('Error initializing git');\n log.error(e);\n }\n}\n\n/**\n * Cleanup the git repository in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n * @param projectDir\n */\nexport function cleanupGit(projectDir: string): void {\n try {\n // Remove the .git directory\n execSync(`rm -rf ${projectDir}/.git`);\n } catch (e) {\n log.error('Error cleaning up git');\n log.error(e);\n }\n}\n\n/**\n * Revert local changes in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n *\n * @param projectDir\n */\nexport function revertLocalChanges(projectDir: string): void {\n try {\n // Revert tracked files\n execSync('git restore .', { cwd: projectDir });\n // Revert untracked files\n execSync('git clean -fd .', { cwd: projectDir });\n // Remove node_modules and dist (.gitignore'd and therefore not removed via git clean)\n execSync('rm -rf node_modules', { cwd: projectDir });\n execSync('rm -rf dist', { cwd: projectDir });\n } catch (e) {\n log.error('Error reverting local changes');\n log.error(e);\n }\n}\n\n/**\n * Start the wizard instance with the given integration and project directory\n * @param integration\n * @param projectDir\n *\n * @returns WizardTestEnv\n */\nexport function startWizardInstance(\n integration: Integration,\n projectDir: string,\n debug = false,\n): WizardTestEnv {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n initGit(projectDir);\n\n return new WizardTestEnv(\n binPath,\n [\n '--debug',\n '-i',\n integration,\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n '--disable-telemetry',\n ],\n { cwd: projectDir, debug },\n );\n}\n\n/**\n * Create a file with the given content\n *\n * @param filePath\n * @param content\n */\nexport function createFile(filePath: string, content?: string) {\n return fs.writeFileSync(filePath, content || '');\n}\n\n/**\n * Modify the file with the new content\n *\n * @param filePath\n * @param oldContent\n * @param newContent\n */\nexport function modifyFile(\n filePath: string,\n replaceMap: Record<string, string>,\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n let newFileContent = fileContent;\n\n for (const [oldContent, newContent] of Object.entries(replaceMap)) {\n newFileContent = newFileContent.replace(oldContent, newContent);\n }\n\n fs.writeFileSync(filePath, newFileContent);\n}\n\n/**\n * Read the file contents and check if it does not contain the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileDoesNotContain(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).not.toContain(c);\n }\n}\n\n/**\n * Read the file contents and check if it contains the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileContents(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).toContain(c);\n }\n}\n\n/**\n * Check if the file exists\n *\n * @param filePath\n */\nexport function checkFileExists(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(true);\n}\n\n/**\n * Check if the package.json contains the given integration\n *\n * @param projectDir\n * @param integration\n */\nexport function checkPackageJson(projectDir: string, integration: Integration) {\n checkFileContents(`${projectDir}/package.json`, `@sentry/${integration}`);\n}\n\n/**\n * Check if the .sentryclirc contains the auth token\n *\n * @param projectDir\n */\nexport function checkSentryCliRc(projectDir: string) {\n checkFileContents(\n `${projectDir}/.sentryclirc`,\n `token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the .env.sentry-build-plugin contains the auth token\n * @param projectDir\n */\nexport function checkEnvBuildPlugin(projectDir: string) {\n checkFileContents(\n `${projectDir}/.env.sentry-build-plugin`,\n `SENTRY_AUTH_TOKEN=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the sentry.properties contains the auth token\n * @param projectDir\n */\nexport function checkSentryProperties(projectDir: string) {\n checkFileContents(\n `${projectDir}/sentry.properties`,\n `auth_token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the project builds\n * Check if the project builds and ends with status code 0.\n * @param projectDir\n */\nexport async function checkIfBuilds(projectDir: string) {\n const testEnv = new WizardTestEnv('npm', ['run', 'build'], {\n cwd: projectDir,\n });\n\n const builtSuccessfully = await testEnv.waitForStatusCode(0, {\n timeout: 120_000,\n });\n\n expect(builtSuccessfully).toBe(true);\n}\n\n/**\n * Check if the flutter project builds\n * @param projectDir\n */\nexport async function checkIfFlutterBuilds(\n projectDir: string,\n expectedOutput: string,\n debug = false,\n) {\n const testEnv = new WizardTestEnv('flutter', ['build', 'web'], {\n cwd: projectDir,\n debug: debug,\n });\n\n const outputReceived = await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n });\n\n expect(outputReceived).toBe(true);\n}\n\n/**\n * Check if the project runs on dev mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnDevMode(\n projectDir: string,\n expectedOutput: string,\n) {\n const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });\n\n expect(\n await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n testEnv.kill();\n}\n\n/**\n * Check if the project runs on prod mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnProdMode(\n projectDir: string,\n expectedOutput: string,\n startCommand = 'start',\n) {\n const testEnv = new WizardTestEnv('npm', ['run', startCommand], {\n cwd: projectDir,\n });\n\n expect(\n await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n testEnv.kill();\n}\n"]}
@@ -5,6 +5,7 @@ export declare enum Integration {
5
5
  ios = "ios",
6
6
  android = "android",
7
7
  cordova = "cordova",
8
+ angular = "angular",
8
9
  electron = "electron",
9
10
  nextjs = "nextjs",
10
11
  nuxt = "nuxt",
@@ -9,6 +9,7 @@ var Integration;
9
9
  Integration["ios"] = "ios";
10
10
  Integration["android"] = "android";
11
11
  Integration["cordova"] = "cordova";
12
+ Integration["angular"] = "angular";
12
13
  Integration["electron"] = "electron";
13
14
  Integration["nextjs"] = "nextjs";
14
15
  Integration["nuxt"] = "nuxt";
@@ -76,6 +77,8 @@ function mapIntegrationToPlatform(type) {
76
77
  return 'flutter';
77
78
  case Integration.cordova:
78
79
  return 'cordova';
80
+ case Integration.angular:
81
+ return 'javascript-angular';
79
82
  case Integration.electron:
80
83
  return 'javascript-electron';
81
84
  case Integration.nextjs:
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAYX;AAZD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;AAC3B,CAAC,EAZW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAYtB;AAED,wCAAwC;AACxC,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,SAAgB,kBAAkB;IAKhC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,sBAAsB,CAAC,QAAQ,CAAC;QACtC,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC,CAAC;AACN,CAAC;AAVD,gDAUC;AAED,SAAgB,sBAAsB,CAAC,IAAY;IACjD,QAAQ,IAAI,EAAE;QACZ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,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;KAClD;AACH,CAAC;AAzBD,4DAyBC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAkBY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n flutter = 'flutter',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): Array<{\n checked: boolean;\n name: string;\n value: string;\n}> {\n return Object.keys(Platform).map((platform) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.flutter:\n return 'Flutter';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.flutter:\n return 'flutter';\n case Integration.cordova:\n return 'cordova';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;AAC3B,CAAC,EAbW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAatB;AAED,wCAAwC;AACxC,IA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AAED,SAAgB,wBAAwB,CAAC,IAAY;IACnD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,oBAAoB,CAAC;QAC9B,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;KAClD;AACH,CAAC;AA3BD,4DA2BC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAkBY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n flutter = 'flutter',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n angular = 'angular',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): Array<{\n checked: boolean;\n name: string;\n value: string;\n}> {\n return Object.keys(Platform).map((platform) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.flutter:\n return 'Flutter';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.flutter:\n return 'flutter';\n case Integration.cordova:\n return 'cordova';\n case Integration.angular:\n return 'javascript-angular';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
@@ -26,16 +26,5 @@ export declare class SentryCli {
26
26
  */
27
27
  dumpProperties(props: Partial<SentryCliProps>, format?: 'rc' | 'properties'): string;
28
28
  dumpConfig(config: Partial<SentryCliConfig>): string;
29
- /**
30
- * Creates `.sentryclirc` and `sentry.properties` files with the CLI properties
31
- * obtained from the user answers (or from logging into Sentry).
32
- * The `.sentryclirc` only contains the auth token and will be added to the
33
- * user's `.gitignore` file. The properties file contains the rest of the
34
- * properties (org, project, etc.).
35
- *
36
- * @param sentryCli instance of the Sentry CLI
37
- * @param cliProps the properties to write to the files
38
- */
39
- createSentryCliConfig(cliProps: SentryCliProps): Promise<void>;
40
29
  }
41
30
  export {};
@@ -24,13 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.SentryCli = void 0;
27
- const fs = __importStar(require("node:fs"));
28
27
  const path = __importStar(require("node:path"));
29
- const Git_1 = require("./Git");
30
- const Logging_1 = require("./Logging");
31
- const SENTRYCLIRC_FILENAME = '.sentryclirc';
32
- const GITIGNORE_FILENAME = '.gitignore';
33
- const PROPERTIES_FILENAME = 'sentry.properties';
34
28
  class SentryCli {
35
29
  _argv;
36
30
  _resolve = require.resolve;
@@ -93,52 +87,6 @@ class SentryCli {
93
87
  }
94
88
  return dumpedSections.join('\n');
95
89
  }
96
- /**
97
- * Creates `.sentryclirc` and `sentry.properties` files with the CLI properties
98
- * obtained from the user answers (or from logging into Sentry).
99
- * The `.sentryclirc` only contains the auth token and will be added to the
100
- * user's `.gitignore` file. The properties file contains the rest of the
101
- * properties (org, project, etc.).
102
- *
103
- * @param sentryCli instance of the Sentry CLI
104
- * @param cliProps the properties to write to the files
105
- */
106
- async createSentryCliConfig(cliProps) {
107
- const { 'auth/token': authToken, ...cliPropsToWrite } = cliProps;
108
- /**
109
- * To not commit the auth token to the VCS, instead of adding it to the
110
- * properties file (like the rest of props), it's added to the Sentry CLI
111
- * config, which is added to the gitignore. This way makes the properties
112
- * file safe to commit without exposing any auth tokens.
113
- */
114
- if (authToken) {
115
- try {
116
- await fs.promises.appendFile(SENTRYCLIRC_FILENAME, this.dumpConfig({ auth: { 'auth/token': authToken } }));
117
- (0, Logging_1.green)(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);
118
- }
119
- catch {
120
- (0, Logging_1.red)(`⚠ Could not add the auth token to ${SENTRYCLIRC_FILENAME}, ` +
121
- `please add it to identify your user account:\n${authToken}`);
122
- (0, Logging_1.nl)();
123
- }
124
- }
125
- else {
126
- (0, Logging_1.red)(`⚠ Did not find an auth token, please add your token to ${SENTRYCLIRC_FILENAME}`);
127
- (0, Logging_1.l)('To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/');
128
- (0, Logging_1.l)('To learn how to configure Sentry CLI, visit ' +
129
- 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli');
130
- }
131
- await (0, Git_1.addToGitignore)(SENTRYCLIRC_FILENAME, `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, please add it to not commit your auth key.`);
132
- try {
133
- await fs.promises.writeFile(`./${PROPERTIES_FILENAME}`, this.dumpProperties(cliPropsToWrite));
134
- (0, Logging_1.green)('✓ Successfully created sentry.properties');
135
- }
136
- catch {
137
- (0, Logging_1.red)(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);
138
- (0, Logging_1.l)('See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli');
139
- }
140
- (0, Logging_1.nl)();
141
- }
142
90
  }
143
91
  exports.SentryCli = SentryCli;
144
92
  //# sourceMappingURL=SentryCli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../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AAC,qBAAqB,CAAC,QAAwB;QACzD,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GAAG,QAAQ,CAAC;QAEjE;;;;;WAKG;QACH,IAAI,SAAS,EAAE;YACb,IAAI;gBACF,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAC1B,oBAAoB,EACpB,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,CAAC,CACvD,CAAC;gBACF,IAAA,eAAK,EAAC,0CAA0C,oBAAoB,EAAE,CAAC,CAAC;aACzE;YAAC,MAAM;gBACN,IAAA,aAAG,EACD,qCAAqC,oBAAoB,IAAI;oBAC3D,iDAAiD,SAAS,EAAE,CAC/D,CAAC;gBACF,IAAA,YAAE,GAAE,CAAC;aACN;SACF;aAAM;YACL,IAAA,aAAG,EACD,0DAA0D,oBAAoB,EAAE,CACjF,CAAC;YACF,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;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"]}
1
+ {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../lib/Helper/SentryCli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAAkC;AAgBlC,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;YAC1D,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI;YACzD,YAAY,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI;SAClD,CAAC;QAEF,IAAI;YACF,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE;gBAC1D,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;aACvB,CAAC,CAAC;YACH,KAAK,CAAC,gBAAgB,CAAC,GAAG,IAAI;iBAC3B,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC;iBAChC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,C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I,CAAC,OAAO,CAAC,CAAC;SAC9B;QACD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF;AAxED,8BAwEC","sourcesContent":["import type { Answers } from 'inquirer';\nimport * as path from 'node:path';\n\nimport type { Args } from '../Constants';\nimport { Config } from '../Types';\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"]}
@@ -26,6 +26,8 @@ exports.pluginKts = pluginKts;
26
26
  const manifest = (dsn) => `
27
27
  <!-- Required: set your sentry.io project identifier (DSN) -->
28
28
  <meta-data android:name="io.sentry.dsn" android:value="${dsn}" />
29
+ <!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
30
+ <meta-data android:name="io.sentry.send-default-pii" android:value="true" />
29
31
 
30
32
  <!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
31
33
  <meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/android/templates.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;;6CAEP,OAAO;;;CAGnD,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEK,MAAM,eAAe,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;;8CAET,OAAO;;;CAGpD,CAAC;AALW,QAAA,eAAe,mBAK1B;AAEK,MAAM,MAAM,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;6CACD,OAAO;CACnD,CAAC;AAFW,QAAA,MAAM,UAEjB;AAEK,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;8CACH,OAAO;CACpD,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC;;6DAEoB,GAAG;;;;;;;;;;;CAW/D,CAAC;AAbW,QAAA,QAAQ,YAanB;AAEW,QAAA,YAAY,GAAG,4BAA4B,CAAC;AAE5C,QAAA,cAAc,GAAG,2BAA2B,CAAC;AAE7C,QAAA,gBAAgB,GAAG;;;;;;;;;CAS/B,CAAC;AAEW,QAAA,kBAAkB,GAAG;;;;;;;;;CASjC,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAE,EAAE,CAAC;;;aAG1D,OAAO;qBACC,WAAW;;;;;;CAM/B,CAAC;AAVW,QAAA,aAAa,iBAUxB;AAEK,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAE,EAAE,CAAC;;;eAG3D,OAAO;uBACC,WAAW;;;;;;CAMjC,CAAC;AAVW,QAAA,gBAAgB,oBAU3B","sourcesContent":["export const pluginsBlock = (version = '3.12.0') => `\nplugins {\n id 'io.sentry.android.gradle' version '${version}'\n}\n\n`;\n\nexport const pluginsBlockKts = (version = '3.12.0') => `\nplugins {\n id(\"io.sentry.android.gradle\") version \"${version}\"\n}\n\n`;\n\nexport const plugin = (version = '3.12.0') => `\n id 'io.sentry.android.gradle' version '${version}'\n`;\n\nexport const pluginKts = (version = '3.12.0') => `\n id(\"io.sentry.android.gradle\") version \"${version}\"\n`;\n\nexport const manifest = (dsn: string) => `\n <!-- Required: set your sentry.io project identifier (DSN) -->\n <meta-data android:name=\"io.sentry.dsn\" android:value=\"${dsn}\" />\n\n <!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->\n <meta-data android:name=\"io.sentry.traces.user-interaction.enable\" android:value=\"true\" />\n <!-- enable screenshot for crashes (could contain sensitive/PII data) -->\n <meta-data android:name=\"io.sentry.attach-screenshot\" android:value=\"true\" />\n <!-- enable view hierarchy for crashes -->\n <meta-data android:name=\"io.sentry.attach-view-hierarchy\" android:value=\"true\" />\n\n <!-- enable the performance API by setting a sample-rate, adjust in production env -->\n <meta-data android:name=\"io.sentry.traces.sample-rate\" android:value=\"1.0\" />\n`;\n\nexport const sentryImport = `import io.sentry.Sentry;\\n`;\n\nexport const sentryImportKt = `import io.sentry.Sentry\\n`;\n\nexport const testErrorSnippet = `\n // waiting for view to draw to better represent a captured error with a screenshot\n findViewById(android.R.id.content).getViewTreeObserver().addOnGlobalLayoutListener(() -> {\n try {\n throw new Exception(\"This app uses Sentry! :)\");\n } catch (Exception e) {\n Sentry.captureException(e);\n }\n });\n`;\n\nexport const testErrorSnippetKt = `\n // waiting for view to draw to better represent a captured error with a screenshot\n findViewById<android.view.View>(android.R.id.content).viewTreeObserver.addOnGlobalLayoutListener {\n try {\n throw Exception(\"This app uses Sentry! :)\")\n } catch (e: Exception) {\n Sentry.captureException(e)\n }\n }\n`;\n\nexport const sourceContext = (orgSlug: string, projectSlug: string) => `\n\nsentry {\n org = \"${orgSlug}\"\n projectName = \"${projectSlug}\"\n\n // this will upload your source code to Sentry to show it as part of the stack traces\n // disable if you don't want to expose your sources\n includeSourceContext = true\n}\n`;\n\nexport const sourceContextKts = (orgSlug: string, projectSlug: string) => `\n\nsentry {\n org.set(\"${orgSlug}\")\n projectName.set(\"${projectSlug}\")\n\n // this will upload your source code to Sentry to show it as part of the stack traces\n // disable if you don't want to expose your sources\n includeSourceContext.set(true)\n}\n`;\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/android/templates.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;;6CAEP,OAAO;;;CAGnD,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEK,MAAM,eAAe,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;;8CAET,OAAO;;;CAGpD,CAAC;AALW,QAAA,eAAe,mBAK1B;AAEK,MAAM,MAAM,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;6CACD,OAAO;CACnD,CAAC;AAFW,QAAA,MAAM,UAEjB;AAEK,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;8CACH,OAAO;CACpD,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC;;6DAEoB,GAAG;;;;;;;;;;;;;CAa/D,CAAC;AAfW,QAAA,QAAQ,YAenB;AAEW,QAAA,YAAY,GAAG,4BAA4B,CAAC;AAE5C,QAAA,cAAc,GAAG,2BAA2B,CAAC;AAE7C,QAAA,gBAAgB,GAAG;;;;;;;;;CAS/B,CAAC;AAEW,QAAA,kBAAkB,GAAG;;;;;;;;;CASjC,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAE,EAAE,CAAC;;;aAG1D,OAAO;qBACC,WAAW;;;;;;CAM/B,CAAC;AAVW,QAAA,aAAa,iBAUxB;AAEK,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAE,EAAE,CAAC;;;eAG3D,OAAO;uBACC,WAAW;;;;;;CAMjC,CAAC;AAVW,QAAA,gBAAgB,oBAU3B","sourcesContent":["export const pluginsBlock = (version = '3.12.0') => `\nplugins {\n id 'io.sentry.android.gradle' version '${version}'\n}\n\n`;\n\nexport const pluginsBlockKts = (version = '3.12.0') => `\nplugins {\n id(\"io.sentry.android.gradle\") version \"${version}\"\n}\n\n`;\n\nexport const plugin = (version = '3.12.0') => `\n id 'io.sentry.android.gradle' version '${version}'\n`;\n\nexport const pluginKts = (version = '3.12.0') => `\n id(\"io.sentry.android.gradle\") version \"${version}\"\n`;\n\nexport const manifest = (dsn: string) => `\n <!-- Required: set your sentry.io project identifier (DSN) -->\n <meta-data android:name=\"io.sentry.dsn\" android:value=\"${dsn}\" />\n <!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->\n <meta-data android:name=\"io.sentry.send-default-pii\" android:value=\"true\" />\n\n <!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->\n <meta-data android:name=\"io.sentry.traces.user-interaction.enable\" android:value=\"true\" />\n <!-- enable screenshot for crashes (could contain sensitive/PII data) -->\n <meta-data android:name=\"io.sentry.attach-screenshot\" android:value=\"true\" />\n <!-- enable view hierarchy for crashes -->\n <meta-data android:name=\"io.sentry.attach-view-hierarchy\" android:value=\"true\" />\n\n <!-- enable the performance API by setting a sample-rate, adjust in production env -->\n <meta-data android:name=\"io.sentry.traces.sample-rate\" android:value=\"1.0\" />\n`;\n\nexport const sentryImport = `import io.sentry.Sentry;\\n`;\n\nexport const sentryImportKt = `import io.sentry.Sentry\\n`;\n\nexport const testErrorSnippet = `\n // waiting for view to draw to better represent a captured error with a screenshot\n findViewById(android.R.id.content).getViewTreeObserver().addOnGlobalLayoutListener(() -> {\n try {\n throw new Exception(\"This app uses Sentry! :)\");\n } catch (Exception e) {\n Sentry.captureException(e);\n }\n });\n`;\n\nexport const testErrorSnippetKt = `\n // waiting for view to draw to better represent a captured error with a screenshot\n findViewById<android.view.View>(android.R.id.content).viewTreeObserver.addOnGlobalLayoutListener {\n try {\n throw Exception(\"This app uses Sentry! :)\")\n } catch (e: Exception) {\n Sentry.captureException(e)\n }\n }\n`;\n\nexport const sourceContext = (orgSlug: string, projectSlug: string) => `\n\nsentry {\n org = \"${orgSlug}\"\n projectName = \"${projectSlug}\"\n\n // this will upload your source code to Sentry to show it as part of the stack traces\n // disable if you don't want to expose your sources\n includeSourceContext = true\n}\n`;\n\nexport const sourceContextKts = (orgSlug: string, projectSlug: string) => `\n\nsentry {\n org.set(\"${orgSlug}\")\n projectName.set(\"${projectSlug}\")\n\n // this will upload your source code to Sentry to show it as part of the stack traces\n // disable if you don't want to expose your sources\n includeSourceContext.set(true)\n}\n`;\n"]}
@@ -0,0 +1,3 @@
1
+ import type { WizardOptions } from '../utils/types';
2
+ export declare function runAngularWizard(options: WizardOptions): Promise<void>;
3
+ export declare function buildOutroMessage(createdExampleComponent: boolean): string;
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.buildOutroMessage = exports.runAngularWizard = void 0;
30
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
31
+ const prompts_1 = __importDefault(require("@clack/prompts"));
32
+ const chalk_1 = __importDefault(require("chalk"));
33
+ const telemetry_1 = require("../telemetry");
34
+ const clack_1 = require("../utils/clack");
35
+ const package_json_1 = require("../utils/package-json");
36
+ const semver_1 = require("semver");
37
+ const Sentry = __importStar(require("@sentry/node"));
38
+ const sdk_setup_1 = require("./sdk-setup");
39
+ const sdk_setup_2 = require("./sdk-setup");
40
+ const sourcemaps_wizard_1 = require("../sourcemaps/sourcemaps-wizard");
41
+ const sourcemaps_1 = require("./codemods/sourcemaps");
42
+ const example_component_1 = require("./example-component");
43
+ const MIN_SUPPORTED_ANGULAR_VERSION = '14.0.0';
44
+ const MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = '17.0.0';
45
+ async function runAngularWizard(options) {
46
+ return (0, telemetry_1.withTelemetry)({
47
+ enabled: options.telemetryEnabled,
48
+ integration: 'angular',
49
+ wizardOptions: options,
50
+ }, () => runAngularWizardWithTelemetry(options));
51
+ }
52
+ exports.runAngularWizard = runAngularWizard;
53
+ async function runAngularWizardWithTelemetry(options) {
54
+ (0, clack_1.printWelcome)({
55
+ wizardName: 'Sentry Angular Wizard',
56
+ promoCode: options.promoCode,
57
+ telemetryEnabled: options.telemetryEnabled,
58
+ });
59
+ await (0, clack_1.confirmContinueIfNoOrDirtyGitRepo)({
60
+ ignoreGitChanges: options.ignoreGitChanges,
61
+ cwd: undefined,
62
+ });
63
+ const packageJson = await (0, clack_1.getPackageDotJson)();
64
+ await (0, clack_1.ensurePackageIsInstalled)(packageJson, '@angular/core', 'Angular');
65
+ let installedAngularVersion = (0, package_json_1.getPackageVersion)('@angular/core', packageJson);
66
+ if (!installedAngularVersion) {
67
+ prompts_1.default.log.warn('Could not determine installed Angular version.');
68
+ installedAngularVersion = await (0, clack_1.abortIfCancelled)(prompts_1.default.text({
69
+ message: `Please enter your installed Angular major version (e.g. ${chalk_1.default.cyan('18')} for Angular 18)`,
70
+ validate(value) {
71
+ if (!value) {
72
+ return 'Angular version is required';
73
+ }
74
+ try {
75
+ if (!(0, semver_1.minVersion)(value)) {
76
+ return `Invalid Angular version provided: ${value}`;
77
+ }
78
+ }
79
+ catch (error) {
80
+ return `Invalid Angular version provided: ${value}`;
81
+ }
82
+ },
83
+ }));
84
+ }
85
+ Sentry.setTag('angular-version', installedAngularVersion);
86
+ const installedMinVersion = (0, semver_1.minVersion)(installedAngularVersion);
87
+ const sdkSupportsAngularVersion = (0, semver_1.gte)(installedMinVersion, MIN_SUPPORTED_ANGULAR_VERSION);
88
+ const wizardSupportsAngularVersion = (0, semver_1.gte)(installedMinVersion, MIN_SUPPORTED_WIZARD_ANGULAR_VERSION);
89
+ if (!sdkSupportsAngularVersion) {
90
+ Sentry.setTag('angular-version-compatible', false);
91
+ prompts_1.default.log.warn(`Angular version ${chalk_1.default.cyan(MIN_SUPPORTED_ANGULAR_VERSION)} or higher is required for the Sentry SDK.`);
92
+ prompts_1.default.log.warn(`Please refer to Sentry's version compatibility table for more information:
93
+
94
+ ${chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility')}
95
+ `);
96
+ return (0, clack_1.abort)('Exiting the wizard.', 0);
97
+ }
98
+ if (!wizardSupportsAngularVersion) {
99
+ Sentry.setTag('angular-wizard-version-compatible', false);
100
+ prompts_1.default.log.warn(`The Sentry Angular Wizard requires Angular version ${chalk_1.default.cyan(MIN_SUPPORTED_WIZARD_ANGULAR_VERSION)} or higher.`);
101
+ prompts_1.default.log.warn(`Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:
102
+
103
+ ${chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/angular')}
104
+
105
+ Apologies for the inconvenience!`);
106
+ return (0, clack_1.abort)('Exiting the wizard.', 0);
107
+ }
108
+ const { selectedProject, authToken, sentryUrl, selfHosted } = await (0, clack_1.getOrAskForProjectData)(options, 'javascript-angular');
109
+ const dsn = selectedProject.keys[0].dsn.public;
110
+ const sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('@sentry/angular', packageJson);
111
+ Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
112
+ await (0, clack_1.installPackage)({
113
+ packageName: '@sentry/angular',
114
+ packageNameDisplayLabel: '@sentry/angular',
115
+ alreadyInstalled: sdkAlreadyInstalled,
116
+ });
117
+ const selectedFeatures = await (0, clack_1.featureSelectionPrompt)([
118
+ {
119
+ id: 'performance',
120
+ prompt: `Do you want to enable ${chalk_1.default.bold('Tracing')} to track the performance of your application?`,
121
+ enabledHint: 'recommended',
122
+ },
123
+ {
124
+ id: 'replay',
125
+ prompt: `Do you want to enable ${chalk_1.default.bold('Sentry Session Replay')} to get a video-like reproduction of errors during a user session?`,
126
+ enabledHint: 'recommended, but increases bundle size',
127
+ },
128
+ ]);
129
+ await (0, telemetry_1.traceStep)('Initialize Sentry on Angular application entry point', async () => {
130
+ await (0, sdk_setup_1.initializeSentryOnApplicationEntry)(dsn, selectedFeatures);
131
+ });
132
+ await (0, telemetry_1.traceStep)('Update Angular project configuration', async () => {
133
+ await (0, sdk_setup_2.updateAppConfig)(installedMinVersion, selectedFeatures.performance);
134
+ });
135
+ await (0, telemetry_1.traceStep)('Setup for sourcemap uploads', async () => {
136
+ await (0, sourcemaps_1.addSourcemapEntryToAngularJSON)();
137
+ if (!options.preSelectedProject) {
138
+ options.preSelectedProject = {
139
+ authToken,
140
+ selfHosted,
141
+ project: {
142
+ organization: {
143
+ id: selectedProject.organization.id,
144
+ name: selectedProject.organization.name,
145
+ slug: selectedProject.organization.slug,
146
+ },
147
+ id: selectedProject.id,
148
+ slug: selectedProject.slug,
149
+ keys: [
150
+ {
151
+ dsn: {
152
+ public: dsn,
153
+ },
154
+ },
155
+ ],
156
+ },
157
+ };
158
+ options.url = sentryUrl;
159
+ }
160
+ await (0, sourcemaps_wizard_1.runSourcemapsWizard)(options, 'angular');
161
+ });
162
+ const shouldCreateExampleComponent = await (0, clack_1.askShouldCreateExampleComponent)();
163
+ Sentry.setTag('create-example-component', shouldCreateExampleComponent);
164
+ if (shouldCreateExampleComponent) {
165
+ await (0, telemetry_1.traceStep)('create-example-component', async () => await (0, example_component_1.createExampleComponent)({
166
+ url: sentryUrl,
167
+ orgSlug: selectedProject.organization.slug,
168
+ projectId: selectedProject.id,
169
+ }));
170
+ }
171
+ await (0, telemetry_1.traceStep)('Run Prettier', async () => {
172
+ await (0, clack_1.runPrettierIfInstalled)({ cwd: undefined });
173
+ });
174
+ prompts_1.default.outro(buildOutroMessage(shouldCreateExampleComponent));
175
+ }
176
+ function buildOutroMessage(createdExampleComponent) {
177
+ let msg = chalk_1.default.green('\nSuccessfully installed the Sentry Angular SDK!');
178
+ if (createdExampleComponent) {
179
+ msg += `\n\nYou can validate your setup by starting your dev environment (${chalk_1.default.cyan('ng serve')}) and throwing an error in the example component.`;
180
+ }
181
+ msg += `\n\nCheck out the SDK documentation for further configuration:
182
+ https://docs.sentry.io/platforms/javascript/guides/angular/`;
183
+ return msg;
184
+ }
185
+ exports.buildOutroMessage = buildOutroMessage;
186
+ //# sourceMappingURL=angular-wizard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-wizard.js","sourceRoot":"","sources":["../../../src/angular/angular-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AAEnC,kDAA0B;AAE1B,4CAAwD;AACxD,0CAYwB;AACxB,wDAA+E;AAC/E,mCAAiD;AAEjD,qDAAuC;AACvC,2CAAiE;AACjE,2CAA8C;AAC9C,uEAAsE;AACtE,sDAAuE;AACvE,2DAA6D;AAE7D,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AAC/C,MAAM,oCAAoC,GAAG,QAAQ,CAAC;AAE/C,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAC3D,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAC7C,CAAC;AACJ,CAAC;AATD,4CASC;AAED,KAAK,UAAU,6BAA6B,CAC1C,OAAsB;IAEtB,IAAA,oBAAY,EAAC;QACX,UAAU,EAAE,uBAAuB;QACnC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAC;IAEH,MAAM,IAAA,yC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C,GAAG,GAAG,SAAS,CAAC;SACzB;QAED,MAAM,IAAA,uCAAmB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,MAAM,4BAA4B,GAAG,MAAM,IAAA,uCAA+B,GAAE,CAAC;IAE7E,MAAM,CAAC,MAAM,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAAC;IAExE,IAAI,4BAA4B,EAAE;QAChC,MAAM,IAAA,qBAAS,EACb,0BAA0B,EAC1B,KAAK,IAAI,EAAE,CACT,MAAM,IAAA,0CAAsB,EAAC;YAC3B,GAAG,EAAE,SAAS;YACd,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;YAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;SAC9B,CAAC,CACL,CAAC;KACH;IAED,MAAM,IAAA,qBAAS,EAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,iBAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,iBAAiB,CAAC,uBAAgC;IAChE,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAE1E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,UAAU,CACX,mDAAmD,CAAC;KACtD;IAED,GAAG,IAAI;4DACmD,CAAC;IAE3D,OAAO,GAAG,CAAC;AACb,CAAC;AAbD,8CAaC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nimport chalk from 'chalk';\nimport type { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldCreateExampleComponent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n abort,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { gte, minVersion, SemVer } from 'semver';\n\nimport * as Sentry from '@sentry/node';\nimport { initializeSentryOnApplicationEntry } from './sdk-setup';\nimport { updateAppConfig } from './sdk-setup';\nimport { runSourcemapsWizard } from '../sourcemaps/sourcemaps-wizard';\nimport { addSourcemapEntryToAngularJSON } from './codemods/sourcemaps';\nimport { createExampleComponent } from './example-component';\n\nconst MIN_SUPPORTED_ANGULAR_VERSION = '14.0.0';\nconst MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = '17.0.0';\n\nexport async function runAngularWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'angular',\n wizardOptions: options,\n },\n () => runAngularWizardWithTelemetry(options),\n );\n}\n\nasync function runAngularWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Angular Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@angular/core', 'Angular');\n\n let installedAngularVersion = getPackageVersion('@angular/core', packageJson);\n\n if (!installedAngularVersion) {\n clack.log.warn('Could not determine installed Angular version.');\n\n installedAngularVersion = await abortIfCancelled(\n clack.text({\n message: `Please enter your installed Angular major version (e.g. ${chalk.cyan(\n '18',\n )} for Angular 18)`,\n validate(value) {\n if (!value) {\n return 'Angular version is required';\n }\n\n try {\n if (!minVersion(value)) {\n return `Invalid Angular version provided: ${value}`;\n }\n } catch (error) {\n return `Invalid Angular version provided: ${value}`;\n }\n },\n }),\n );\n }\n\n Sentry.setTag('angular-version', installedAngularVersion);\n\n const installedMinVersion = minVersion(installedAngularVersion) as SemVer;\n\n const sdkSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_ANGULAR_VERSION,\n );\n\n const wizardSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n );\n\n if (!sdkSupportsAngularVersion) {\n Sentry.setTag('angular-version-compatible', false);\n\n clack.log.warn(\n `Angular version ${chalk.cyan(\n MIN_SUPPORTED_ANGULAR_VERSION,\n )} or higher is required for the Sentry SDK.`,\n );\n clack.log.warn(\n `Please refer to Sentry's version compatibility table for more information:\n\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility',\n)}\n`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n if (!wizardSupportsAngularVersion) {\n Sentry.setTag('angular-wizard-version-compatible', false);\n\n clack.log.warn(\n `The Sentry Angular Wizard requires Angular version ${chalk.cyan(\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n )} or higher.`,\n );\n clack.log.warn(\n `Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:\n\n${chalk.underline('https://docs.sentry.io/platforms/javascript/guides/angular')}\n\nApologies for the inconvenience!`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-angular');\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/angular',\n packageJson,\n );\n\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/angular',\n packageNameDisplayLabel: '@sentry/angular',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n await traceStep(\n 'Initialize Sentry on Angular application entry point',\n async () => {\n await initializeSentryOnApplicationEntry(dsn, selectedFeatures);\n },\n );\n\n await traceStep('Update Angular project configuration', async () => {\n await updateAppConfig(installedMinVersion, selectedFeatures.performance);\n });\n\n await traceStep('Setup for sourcemap uploads', async () => {\n await addSourcemapEntryToAngularJSON();\n\n if (!options.preSelectedProject) {\n options.preSelectedProject = {\n authToken,\n selfHosted,\n project: {\n organization: {\n id: selectedProject.organization.id,\n name: selectedProject.organization.name,\n slug: selectedProject.organization.slug,\n },\n id: selectedProject.id,\n slug: selectedProject.slug,\n keys: [\n {\n dsn: {\n public: dsn,\n },\n },\n ],\n },\n };\n\n options.url = sentryUrl;\n }\n\n await runSourcemapsWizard(options, 'angular');\n });\n\n const shouldCreateExampleComponent = await askShouldCreateExampleComponent();\n\n Sentry.setTag('create-example-component', shouldCreateExampleComponent);\n\n if (shouldCreateExampleComponent) {\n await traceStep(\n 'create-example-component',\n async () =>\n await createExampleComponent({\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n }\n\n await traceStep('Run Prettier', async () => {\n await runPrettierIfInstalled({ cwd: undefined });\n });\n\n clack.outro(buildOutroMessage(shouldCreateExampleComponent));\n}\n\nexport function buildOutroMessage(createdExampleComponent: boolean): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Angular SDK!');\n\n if (createdExampleComponent) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n 'ng serve',\n )}) and throwing an error in the example component.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/angular/`;\n\n return msg;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { ProxifiedModule } from 'magicast';
2
+ import { type SemVer } from 'semver';
3
+ export declare function updateAppConfigMod(originalAppConfigMod: ProxifiedModule<any>, angularVersion: SemVer, isTracingEnabled: boolean): ProxifiedModule<any>;