@sentry/wizard 4.6.0 → 4.8.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 (218) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +19 -19
  3. package/dist/bin.js +9 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/e2e-tests/tests/angular-17.test.d.ts +1 -0
  6. package/dist/e2e-tests/tests/angular-17.test.js +196 -0
  7. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -0
  8. package/dist/e2e-tests/tests/angular-19.test.d.ts +1 -0
  9. package/dist/e2e-tests/tests/angular-19.test.js +194 -0
  10. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -0
  11. package/dist/e2e-tests/tests/expo.test.d.ts +1 -0
  12. package/dist/e2e-tests/tests/expo.test.js +95 -0
  13. package/dist/e2e-tests/tests/expo.test.js.map +1 -0
  14. package/dist/e2e-tests/tests/flutter.test.js +16 -16
  15. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/help-message.test.d.ts +1 -0
  17. package/dist/e2e-tests/tests/help-message.test.js +56 -0
  18. package/dist/e2e-tests/tests/help-message.test.js.map +1 -0
  19. package/dist/e2e-tests/tests/nextjs-14.test.js +15 -15
  20. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  21. package/dist/e2e-tests/tests/nextjs-15.test.js +15 -15
  22. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  23. package/dist/e2e-tests/tests/nuxt-3.test.js +13 -12
  24. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  25. package/dist/e2e-tests/tests/nuxt-4.test.js +13 -12
  26. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  27. package/dist/e2e-tests/tests/react-native.test.d.ts +1 -0
  28. package/dist/e2e-tests/tests/react-native.test.js +97 -0
  29. package/dist/e2e-tests/tests/react-native.test.js.map +1 -0
  30. package/dist/e2e-tests/tests/remix.test.js +24 -24
  31. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  32. package/dist/e2e-tests/tests/sveltekit.test.js +22 -22
  33. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  34. package/dist/e2e-tests/utils/index.d.ts +7 -0
  35. package/dist/e2e-tests/utils/index.js +33 -12
  36. package/dist/e2e-tests/utils/index.js.map +1 -1
  37. package/dist/lib/Constants.d.ts +6 -1
  38. package/dist/lib/Constants.js +3 -0
  39. package/dist/lib/Constants.js.map +1 -1
  40. package/dist/lib/Helper/Logging.d.ts +1 -1
  41. package/dist/lib/Helper/Logging.js.map +1 -1
  42. package/dist/lib/Helper/__tests__/File.js +9 -9
  43. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  44. package/dist/lib/Helper/__tests__/MergeConfig.js +17 -17
  45. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  46. package/dist/lib/Helper/__tests__/SentryCli.js +23 -22
  47. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  48. package/dist/lib/Setup.d.ts +2 -1
  49. package/dist/lib/Setup.js +12 -2
  50. package/dist/lib/Setup.js.map +1 -1
  51. package/dist/lib/Steps/BaseStep.d.ts +1 -1
  52. package/dist/lib/Steps/BaseStep.js.map +1 -1
  53. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  54. package/dist/lib/Steps/Welcome.js +5 -0
  55. package/dist/lib/Steps/Welcome.js.map +1 -1
  56. package/dist/lib/__tests__/Env.js +4 -3
  57. package/dist/lib/__tests__/Env.js.map +1 -1
  58. package/dist/src/angular/angular-wizard.d.ts +3 -0
  59. package/dist/src/angular/angular-wizard.js +186 -0
  60. package/dist/src/angular/angular-wizard.js.map +1 -0
  61. package/dist/src/angular/codemods/app-config.d.ts +3 -0
  62. package/dist/src/angular/codemods/app-config.js +211 -0
  63. package/dist/src/angular/codemods/app-config.js.map +1 -0
  64. package/dist/src/angular/codemods/main.d.ts +20 -0
  65. package/dist/src/angular/codemods/main.js +62 -0
  66. package/dist/src/angular/codemods/main.js.map +1 -0
  67. package/dist/src/angular/codemods/sourcemaps.d.ts +21 -0
  68. package/dist/src/angular/codemods/sourcemaps.js +94 -0
  69. package/dist/src/angular/codemods/sourcemaps.js.map +1 -0
  70. package/dist/src/angular/example-component.d.ts +8 -0
  71. package/dist/src/angular/example-component.js +286 -0
  72. package/dist/src/angular/example-component.js.map +1 -0
  73. package/dist/src/angular/sdk-setup.d.ts +6 -0
  74. package/dist/src/angular/sdk-setup.js +99 -0
  75. package/dist/src/angular/sdk-setup.js.map +1 -0
  76. package/dist/src/apple/apple-wizard.js +24 -64
  77. package/dist/src/apple/apple-wizard.js.map +1 -1
  78. package/dist/src/apple/configure-package-manager.d.ts +5 -0
  79. package/dist/src/apple/configure-package-manager.js +68 -0
  80. package/dist/src/apple/configure-package-manager.js.map +1 -0
  81. package/dist/src/apple/configure-sentry-cli.d.ts +4 -0
  82. package/dist/src/apple/configure-sentry-cli.js +47 -0
  83. package/dist/src/apple/configure-sentry-cli.js.map +1 -0
  84. package/dist/src/apple/configure-xcode-project.d.ts +8 -0
  85. package/dist/src/apple/configure-xcode-project.js +11 -0
  86. package/dist/src/apple/configure-xcode-project.js.map +1 -0
  87. package/dist/src/apple/inject-code-snippet.d.ts +6 -0
  88. package/dist/src/apple/inject-code-snippet.js +54 -0
  89. package/dist/src/apple/inject-code-snippet.js.map +1 -0
  90. package/dist/src/apple/templates.js +11 -7
  91. package/dist/src/apple/templates.js.map +1 -1
  92. package/dist/src/apple/xcode-manager.js +3 -6
  93. package/dist/src/apple/xcode-manager.js.map +1 -1
  94. package/dist/src/flutter/flutter-wizard.js +10 -2
  95. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  96. package/dist/src/nextjs/nextjs-wizard.js +26 -12
  97. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  98. package/dist/src/nextjs/templates.js +59 -8
  99. package/dist/src/nextjs/templates.js.map +1 -1
  100. package/dist/src/nuxt/templates.js +30 -0
  101. package/dist/src/nuxt/templates.js.map +1 -1
  102. package/dist/src/react-native/expo-metro.js +4 -1
  103. package/dist/src/react-native/expo-metro.js.map +1 -1
  104. package/dist/src/react-native/expo.js +5 -1
  105. package/dist/src/react-native/expo.js.map +1 -1
  106. package/dist/src/react-native/javascript.d.ts +6 -4
  107. package/dist/src/react-native/javascript.js +33 -10
  108. package/dist/src/react-native/javascript.js.map +1 -1
  109. package/dist/src/react-native/metro.js +8 -2
  110. package/dist/src/react-native/metro.js.map +1 -1
  111. package/dist/src/react-native/react-native-wizard.d.ts +4 -0
  112. package/dist/src/react-native/react-native-wizard.js +30 -5
  113. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  114. package/dist/src/react-native/xcode.d.ts +7 -3
  115. package/dist/src/react-native/xcode.js +68 -20
  116. package/dist/src/react-native/xcode.js.map +1 -1
  117. package/dist/src/remix/sdk-example.js +30 -1
  118. package/dist/src/remix/sdk-example.js.map +1 -1
  119. package/dist/src/remix/sdk-setup.js +11 -5
  120. package/dist/src/remix/sdk-setup.js.map +1 -1
  121. package/dist/src/run.d.ts +1 -1
  122. package/dist/src/run.js +7 -2
  123. package/dist/src/run.js.map +1 -1
  124. package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +1 -1
  125. package/dist/src/sourcemaps/sourcemaps-wizard.js +35 -20
  126. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  127. package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
  128. package/dist/src/sourcemaps/tools/angular.js +7 -7
  129. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  130. package/dist/src/sourcemaps/tools/sentry-cli.d.ts +5 -1
  131. package/dist/src/sourcemaps/tools/sentry-cli.js +6 -3
  132. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  133. package/dist/src/sourcemaps/tools/tsc.js +5 -1
  134. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  135. package/dist/src/sourcemaps/tools/vite.js +4 -1
  136. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  137. package/dist/src/sourcemaps/tools/webpack.js +4 -1
  138. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  139. package/dist/src/sveltekit/sdk-example.js +1 -1
  140. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  141. package/dist/src/sveltekit/sveltekit-wizard.js +2 -2
  142. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  143. package/dist/src/sveltekit/templates.js +28 -1
  144. package/dist/src/sveltekit/templates.js.map +1 -1
  145. package/dist/src/utils/clack/index.d.ts +11 -3
  146. package/dist/src/utils/clack/index.js +12 -4
  147. package/dist/src/utils/clack/index.js.map +1 -1
  148. package/dist/src/utils/package-manager.d.ts +2 -0
  149. package/dist/src/utils/package-manager.js +55 -5
  150. package/dist/src/utils/package-manager.js.map +1 -1
  151. package/dist/src/version.d.ts +1 -1
  152. package/dist/src/version.js +1 -1
  153. package/dist/src/version.js.map +1 -1
  154. package/dist/test/android/code-tools.test.js +13 -12
  155. package/dist/test/android/code-tools.test.js.map +1 -1
  156. package/dist/test/angular/angular-wizard.test.d.ts +1 -0
  157. package/dist/test/angular/angular-wizard.test.js +27 -0
  158. package/dist/test/angular/angular-wizard.test.js.map +1 -0
  159. package/dist/test/angular/codemods/sourcemaps.test.d.ts +1 -0
  160. package/dist/test/angular/codemods/sourcemaps.test.js +237 -0
  161. package/dist/test/angular/codemods/sourcemaps.test.js.map +1 -0
  162. package/dist/test/angular/example-component.test.d.ts +1 -0
  163. package/dist/test/angular/example-component.test.js +105 -0
  164. package/dist/test/angular/example-component.test.js.map +1 -0
  165. package/dist/test/apple/cocoapod.test.js +77 -72
  166. package/dist/test/apple/cocoapod.test.js.map +1 -1
  167. package/dist/test/apple/code-tools.test.js +173 -166
  168. package/dist/test/apple/code-tools.test.js.map +1 -1
  169. package/dist/test/apple/fastfile.test.js +86 -83
  170. package/dist/test/apple/fastfile.test.js.map +1 -1
  171. package/dist/test/apple/templates.test.js +32 -27
  172. package/dist/test/apple/templates.test.js.map +1 -1
  173. package/dist/test/apple/xcode-manager.test.js +182 -183
  174. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  175. package/dist/test/flutter/code-tools.test.js +29 -28
  176. package/dist/test/flutter/code-tools.test.js.map +1 -1
  177. package/dist/test/flutter/templates.test.js +15 -14
  178. package/dist/test/flutter/templates.test.js.map +1 -1
  179. package/dist/test/nextjs/templates.test.js +43 -36
  180. package/dist/test/nextjs/templates.test.js.map +1 -1
  181. package/dist/test/nuxt/templates.test.js +25 -24
  182. package/dist/test/nuxt/templates.test.js.map +1 -1
  183. package/dist/test/react-native/expo-metro.test.js +11 -10
  184. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  185. package/dist/test/react-native/expo.test.js +11 -10
  186. package/dist/test/react-native/expo.test.js.map +1 -1
  187. package/dist/test/react-native/gradle.test.js +27 -26
  188. package/dist/test/react-native/gradle.test.js.map +1 -1
  189. package/dist/test/react-native/javascript.test.js +108 -58
  190. package/dist/test/react-native/javascript.test.js.map +1 -1
  191. package/dist/test/react-native/metro.test.js +178 -64
  192. package/dist/test/react-native/metro.test.js.map +1 -1
  193. package/dist/test/react-native/xcode.test.js +138 -37
  194. package/dist/test/react-native/xcode.test.js.map +1 -1
  195. package/dist/test/remix/client-entry.test.js +18 -17
  196. package/dist/test/remix/client-entry.test.js.map +1 -1
  197. package/dist/test/remix/server-instrumentation.test.js +6 -5
  198. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  199. package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -20
  200. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  201. package/dist/test/sourcemaps/tools/tsc.test.js +13 -14
  202. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  203. package/dist/test/sourcemaps/tools/vite.test.js +13 -14
  204. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  205. package/dist/test/sourcemaps/tools/webpack.test.js +19 -20
  206. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  207. package/dist/test/sveltekit/templates.test.js +13 -12
  208. package/dist/test/sveltekit/templates.test.js.map +1 -1
  209. package/dist/test/utils/ast-utils.test.js +45 -44
  210. package/dist/test/utils/ast-utils.test.js.map +1 -1
  211. package/dist/test/utils/clack/index.test.js +140 -144
  212. package/dist/test/utils/clack/index.test.js.map +1 -1
  213. package/dist/test/utils/package-manager.test.js +8 -7
  214. package/dist/test/utils/package-manager.test.js.map +1 -1
  215. package/package.json +10 -38
  216. package/dist/e2e-tests/jest.config.d.ts +0 -17
  217. package/dist/e2e-tests/jest.config.js +0 -23
  218. package/dist/e2e-tests/jest.config.js.map +0 -1
@@ -0,0 +1,94 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.addSourceMapsSetting = exports.addSourcemapEntryToAngularJSON = void 0;
27
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
28
+ const clack = __importStar(require("@clack/prompts"));
29
+ const path = __importStar(require("path"));
30
+ const fs = __importStar(require("fs"));
31
+ const angular_1 = require("../../sourcemaps/tools/angular");
32
+ const node_1 = require("@sentry/node");
33
+ async function addSourcemapEntryToAngularJSON() {
34
+ const angularJsonPath = path.join(process.cwd(), 'angular.json');
35
+ const angularJson = getParsedAngularJson(angularJsonPath);
36
+ if (!angularJson || typeof angularJson !== 'object') {
37
+ await (0, angular_1.configureAngularSourcemapGenerationFlow)();
38
+ return;
39
+ }
40
+ const updatedAngularJson = addSourceMapsSetting(angularJson);
41
+ if (!updatedAngularJson) {
42
+ await (0, angular_1.configureAngularSourcemapGenerationFlow)();
43
+ return;
44
+ }
45
+ try {
46
+ fs.writeFileSync(angularJsonPath, JSON.stringify(updatedAngularJson, null, 2));
47
+ }
48
+ catch (error) {
49
+ clack.log.error(`Failed to write sourcemap configuration to angular.json`);
50
+ (0, node_1.captureException)('Failed to write sourcemap configuration to angular.json');
51
+ await (0, angular_1.configureAngularSourcemapGenerationFlow)();
52
+ }
53
+ }
54
+ exports.addSourcemapEntryToAngularJSON = addSourcemapEntryToAngularJSON;
55
+ /**
56
+ * Extracted from `addSourcemapEntryToAngularJSON` and exported to allow for easier testing.
57
+ */
58
+ function addSourceMapsSetting(angularJson) {
59
+ const newAngularJson = { ...angularJson };
60
+ const projectKeys = Object.keys(newAngularJson.projects || {});
61
+ if (!projectKeys.length || !newAngularJson.projects) {
62
+ return undefined;
63
+ }
64
+ // Emit sourcemaps from all projects in angular.json
65
+ for (const projectKey of projectKeys) {
66
+ const projectConfig = newAngularJson.projects[projectKey];
67
+ if (!projectConfig.architect) {
68
+ projectConfig.architect = {};
69
+ }
70
+ if (!projectConfig.architect.build) {
71
+ projectConfig.architect.build = {};
72
+ }
73
+ if (!projectConfig.architect.build.configurations) {
74
+ projectConfig.architect.build.configurations = {};
75
+ }
76
+ projectConfig.architect.build.configurations.production = {
77
+ ...projectConfig.architect.build.configurations.production,
78
+ sourceMap: true,
79
+ };
80
+ }
81
+ return newAngularJson;
82
+ }
83
+ exports.addSourceMapsSetting = addSourceMapsSetting;
84
+ function getParsedAngularJson(path) {
85
+ try {
86
+ const angularJSONFile = fs.readFileSync(path, 'utf-8');
87
+ return JSON.parse(angularJSONFile);
88
+ }
89
+ catch {
90
+ (0, node_1.captureException)('Could not parse `angular.json`');
91
+ return undefined;
92
+ }
93
+ }
94
+ //# sourceMappingURL=sourcemaps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourcemaps.js","sourceRoot":"","sources":["../../../../src/angular/codemods/sourcemaps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,2CAA6B;AAC7B,uCAAyB;AACzB,4DAAyF;AACzF,uCAAgD;AAkBzC,KAAK,UAAU,8BAA8B;IAClD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;IACjE,MAAM,WAAW,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAE1D,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnD,MAAM,IAAA,iDAAuC,GAAE,CAAC;QAChD,OAAO;KACR;IAED,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAE7D,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAA,iDAAuC,GAAE,CAAC;QAChD,OAAO;KACR;IAED,IAAI;QACF,EAAE,CAAC,aAAa,CACd,eAAe,EACf,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC,CAC5C,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC3E,IAAA,uBAAgB,EAAC,yDAAyD,CAAC,CAAC;QAC5E,MAAM,IAAA,iDAAuC,GAAE,CAAC;KACjD;AACH,CAAC;AA1BD,wEA0BC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,WAA+B;IAE/B,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;IAE1C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAE/D,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,oDAAoD;IACpD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,aAAa,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAE1D,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;YAC5B,aAAa,CAAC,SAAS,GAAG,EAAE,CAAC;SAC9B;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE;YAClC,aAAa,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC;SACpC;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,EAAE;YACjD,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,GAAG,EAAE,CAAC;SACnD;QAED,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,GAAG;YACxD,GAAG,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;YAC1D,SAAS,EAAE,IAAI;SAChB,CAAC;KACH;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAlCD,oDAkCC;AAED,SAAS,oBAAoB,CAAC,IAAY;IACxC,IAAI;QACF,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe,CAAmC,CAAC;KACtE;IAAC,MAAM;QACN,IAAA,uBAAgB,EAAC,gCAAgC,CAAC,CAAC;QACnD,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { configureAngularSourcemapGenerationFlow } from '../../sourcemaps/tools/angular';\nimport { captureException } from '@sentry/node';\n\ninterface PartialAngularJson {\n projects?: {\n [key: string]: {\n architect?: {\n build?: {\n configurations?: {\n production?: {\n sourceMap?: boolean;\n } & Record<string, unknown>;\n };\n };\n };\n };\n };\n}\n\nexport async function addSourcemapEntryToAngularJSON(): Promise<void> {\n const angularJsonPath = path.join(process.cwd(), 'angular.json');\n const angularJson = getParsedAngularJson(angularJsonPath);\n\n if (!angularJson || typeof angularJson !== 'object') {\n await configureAngularSourcemapGenerationFlow();\n return;\n }\n\n const updatedAngularJson = addSourceMapsSetting(angularJson);\n\n if (!updatedAngularJson) {\n await configureAngularSourcemapGenerationFlow();\n return;\n }\n\n try {\n fs.writeFileSync(\n angularJsonPath,\n JSON.stringify(updatedAngularJson, null, 2),\n );\n } catch (error) {\n clack.log.error(`Failed to write sourcemap configuration to angular.json`);\n captureException('Failed to write sourcemap configuration to angular.json');\n await configureAngularSourcemapGenerationFlow();\n }\n}\n\n/**\n * Extracted from `addSourcemapEntryToAngularJSON` and exported to allow for easier testing.\n */\nexport function addSourceMapsSetting(\n angularJson: PartialAngularJson,\n): PartialAngularJson | undefined {\n const newAngularJson = { ...angularJson };\n\n const projectKeys = Object.keys(newAngularJson.projects || {});\n\n if (!projectKeys.length || !newAngularJson.projects) {\n return undefined;\n }\n\n // Emit sourcemaps from all projects in angular.json\n for (const projectKey of projectKeys) {\n const projectConfig = newAngularJson.projects[projectKey];\n\n if (!projectConfig.architect) {\n projectConfig.architect = {};\n }\n\n if (!projectConfig.architect.build) {\n projectConfig.architect.build = {};\n }\n\n if (!projectConfig.architect.build.configurations) {\n projectConfig.architect.build.configurations = {};\n }\n\n projectConfig.architect.build.configurations.production = {\n ...projectConfig.architect.build.configurations.production,\n sourceMap: true,\n };\n }\n\n return newAngularJson;\n}\n\nfunction getParsedAngularJson(path: string): PartialAngularJson | undefined {\n try {\n const angularJSONFile = fs.readFileSync(path, 'utf-8');\n return JSON.parse(angularJSONFile) as PartialAngularJson | undefined;\n } catch {\n captureException('Could not parse `angular.json`');\n return undefined;\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ interface ExampleComponentOptions {
2
+ url: string;
3
+ orgSlug: string;
4
+ projectId: string;
5
+ }
6
+ export declare function createExampleComponent(options: ExampleComponentOptions): Promise<void>;
7
+ export declare function getSentryExampleComponentCode(options: ExampleComponentOptions): string;
8
+ export {};
@@ -0,0 +1,286 @@
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.getSentryExampleComponentCode = exports.createExampleComponent = void 0;
30
+ const fs = __importStar(require("fs"));
31
+ const clack_1 = require("../utils/clack");
32
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
33
+ const clack = __importStar(require("@clack/prompts"));
34
+ const url_1 = require("../utils/url");
35
+ const chalk_1 = __importDefault(require("chalk"));
36
+ async function createExampleComponent(options) {
37
+ const componentName = 'sentry-example';
38
+ const appRootPath = './src/app';
39
+ let componentDirPath = appRootPath;
40
+ const hasAppRoot = fs.existsSync(appRootPath);
41
+ if (!hasAppRoot) {
42
+ componentDirPath = await (0, clack_1.abortIfCancelled)(clack.text({
43
+ message: 'Where should we create the example component?',
44
+ placeholder: appRootPath,
45
+ }));
46
+ }
47
+ if (!fs.existsSync(componentDirPath)) {
48
+ fs.mkdirSync(componentDirPath, { recursive: true });
49
+ }
50
+ const componentCode = getSentryExampleComponentCode(options);
51
+ const componentFilePath = `${componentDirPath}/${componentName}.component.ts`;
52
+ fs.writeFileSync(componentFilePath, componentCode);
53
+ clack.log.success(`Created example component at ${chalk_1.default.cyan(componentFilePath)}`);
54
+ const addComponentCodeSnippet = (0, clack_1.makeCodeSnippet)(true, (unchanged, plus) => unchanged(`${plus("import { SentryExample } from './sentry-example.component'")}
55
+
56
+ @Component({
57
+ selector: 'app-root',
58
+ standalone: true,
59
+ imports: [RouterOutlet, ${plus('SentryExample')}],
60
+ template: \`
61
+ <div class="app">
62
+ <h1>Your Application</h1>
63
+ ${plus('<app-sentry-example></app-sentry-example>')}
64
+ </div>
65
+ \`,
66
+ })
67
+ `));
68
+ await (0, clack_1.showCopyPasteInstructions)({
69
+ instructions: `Add the example component one of your pages or components (for example, in ${chalk_1.default.cyan('app.component.ts')}).`,
70
+ codeSnippet: addComponentCodeSnippet,
71
+ });
72
+ }
73
+ exports.createExampleComponent = createExampleComponent;
74
+ function getSentryExampleComponentCode(options) {
75
+ const issueStreamUrl = (0, url_1.getIssueStreamUrl)(options);
76
+ return `import { NgIf } from '@angular/common';
77
+ import { Component, OnInit } from '@angular/core';
78
+ import * as Sentry from '@sentry/angular';
79
+
80
+ /**
81
+ * This is just a very simple component that throws an example error.
82
+ * Feel free to delete this file once you verify that Sentry is working.
83
+ */
84
+
85
+ @Component({
86
+ selector: 'app-sentry-example',
87
+ standalone: true,
88
+ imports: [NgIf],
89
+ template: \`
90
+ <svg height="40" width="40" fill="none" xmlns="http://www.w3.org/2000/svg">
91
+ <path
92
+ d="M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z"
93
+ fill="currentcolor"
94
+ />
95
+ </svg>
96
+
97
+ <h1>app-sentry-example</h1>
98
+
99
+ <p class="description">
100
+ Click the button below, and view the sample error on the Sentry
101
+ <a
102
+ target="_blank"
103
+ href="${issueStreamUrl}"
104
+ >Issues Page</a
105
+ >. For more details about setting up Sentry,
106
+ <a
107
+ target="_blank"
108
+ href="https://docs.sentry.io/platforms/javascript/guides/angular/"
109
+ >read our docs</a
110
+ >.
111
+ </p>
112
+
113
+ <button (click)="throwError()">
114
+ <span>Throw Sample Error</span>
115
+ </button>
116
+
117
+ <div *ngIf="isConnected && sentError" class="success">
118
+ Sample error was sent to Sentry.
119
+ </div>
120
+ <div *ngIf="isConnected && !sentError" class="success_placeholder"></div>
121
+
122
+ <div *ngIf="!isConnected" class="connectivity-error">
123
+ <p>
124
+ The Sentry SDK is not able to reach Sentry right now - this may be due
125
+ to an adblocker. For more information, see
126
+ <a
127
+ target="_blank"
128
+ href="https://docs.sentry.io/platforms/javascript/guides/angular/troubleshooting/#the-sdk-is-not-sending-any-data"
129
+ >the troubleshooting guide</a
130
+ >.
131
+ </p>
132
+ </div>
133
+
134
+ <p class="description">
135
+ Adblockers will prevent errors from being sent to Sentry.
136
+ </p>
137
+ \`,
138
+ styles: \`
139
+ :host {
140
+ display: flex;
141
+ flex-direction: column;
142
+ justify-content: space-between;
143
+ align-items: center;
144
+ border: 2px solid #553DB8;
145
+ border-radius: 8px;
146
+ padding: 1em;
147
+ margin: 0.5em;
148
+ width: 500px;
149
+ height: 495px;
150
+ gap: 1em;
151
+ }
152
+
153
+ h1 {
154
+ padding: 0px 4px;
155
+ border-radius: 4px;
156
+ background-color: rgba(24, 20, 35, 0.03);
157
+ font-family: monospace;
158
+ font-size: 20px;
159
+ line-height: 1.2;
160
+ }
161
+
162
+ p {
163
+ margin: 0;
164
+ font-size: 20px;
165
+ }
166
+
167
+ a {
168
+ color: #6341F0;
169
+ text-decoration: underline;
170
+ cursor: pointer;
171
+
172
+ @media (prefers-color-scheme: dark) {
173
+ color: #B3A1FF;
174
+ }
175
+ }
176
+
177
+ button {
178
+ border-radius: 8px;
179
+ color: white;
180
+ cursor: pointer;
181
+ background-color: #553DB8;
182
+ border: none;
183
+ padding: 0;
184
+ margin-top: 4px;
185
+
186
+ & > span {
187
+ display: inline-block;
188
+ padding: 12px 16px;
189
+ border-radius: inherit;
190
+ font-size: 20px;
191
+ font-weight: bold;
192
+ line-height: 1;
193
+ background-color: #7553FF;
194
+ border: 1px solid #553DB8;
195
+ transform: translateY(-4px);
196
+ }
197
+
198
+ &:hover > span {
199
+ transform: translateY(-8px);
200
+ }
201
+
202
+ &:active > span {
203
+ transform: translateY(0);
204
+ }
205
+ }
206
+
207
+ .success {
208
+ padding: 12px 16px;
209
+ border-radius: 8px;
210
+ font-size: 20px;
211
+ line-height: 1;
212
+ background-color: #00F261;
213
+ border: 1px solid #00BF4D;
214
+ color: #181423;
215
+ }
216
+
217
+ .success_placeholder {
218
+ height: 46px;
219
+ }
220
+
221
+ .description {
222
+ text-align: center;
223
+ color: #6E6C75;
224
+ max-width: 500px;
225
+ line-height: 1.5;
226
+ font-size: 20px;
227
+
228
+ @media (prefers-color-scheme: dark) {
229
+ color: #A49FB5;
230
+ }
231
+ }
232
+
233
+ .connectivity-error {
234
+ padding: 12px 16px;
235
+ background-color: #E50045;
236
+ border-radius: 8px;
237
+ width: 500px;
238
+ color: #FFFFFF;
239
+ border: 1px solid #A80033;
240
+ text-align: center;
241
+ margin: 0;
242
+ max-width: 400px;
243
+ }
244
+
245
+ .connectivity-error a {
246
+ color: #FFFFFF;
247
+ text-decoration: underline;
248
+ }
249
+ \`,
250
+ })
251
+ export class SentryExample implements OnInit {
252
+ sentError = false;
253
+ isConnected = true;
254
+
255
+ async ngOnInit(): Promise<void> {
256
+ const res = await Sentry.diagnoseSdkConnectivity();
257
+ this.isConnected = res !== 'sentry-unreachable';
258
+ console.log({ res });
259
+ }
260
+
261
+ throwError() {
262
+ Sentry.startSpan(
263
+ {
264
+ name: 'Example Frontend Span',
265
+ op: 'test',
266
+ },
267
+ () => {
268
+ this.sentError = true;
269
+ throw new SentryExampleError(
270
+ 'This error was thrown by the Sentry example component.'
271
+ );
272
+ }
273
+ );
274
+ }
275
+ }
276
+
277
+ class SentryExampleError extends Error {
278
+ constructor(message: string | undefined) {
279
+ super(message);
280
+ this.name = 'SentryExampleError';
281
+ }
282
+ }
283
+ `;
284
+ }
285
+ exports.getSentryExampleComponentCode = getSentryExampleComponentCode;
286
+ //# sourceMappingURL=example-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-component.js","sourceRoot":"","sources":["../../../src/angular/example-component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,0CAIwB;AAExB,+EAA+E;AAC/E,sDAAwC;AACxC,sCAAiD;AACjD,kDAA0B;AAQnB,KAAK,UAAU,sBAAsB,CAAC,OAAgC;IAC3E,MAAM,aAAa,GAAG,gBAAgB,CAAC;IACvC,MAAM,WAAW,GAAG,WAAW,CAAC;IAEhC,IAAI,gBAAgB,GAAG,WAAW,CAAC;IACnC,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE;QACf,gBAAgB,GAAG,MAAM,IAAA,wBAAgB,EACvC,KAAK,CAAC,IAAI,CAAC;YACT,OAAO,EAAE,+CAA+C;YACxD,WAAW,EAAE,WAAW;SACzB,CAAC,CACH,CAAC;KACH;IAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACpC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACrD;IAED,MAAM,aAAa,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAE7D,MAAM,iBAAiB,GAAG,GAAG,gBAAgB,IAAI,aAAa,eAAe,CAAC;IAE9E,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;IAEnD,KAAK,CAAC,GAAG,CAAC,OAAO,CACf,gCAAgC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAChE,CAAC;IAEF,MAAM,uBAAuB,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CACxE,SAAS,CAAC,GAAG,IAAI,CACf,4DAA4D,CAC7D;;;;;4BAKuB,IAAI,CAAC,eAAe,CAAC;;;;QAIzC,IAAI,CAAC,2CAA2C,CAAC;;;;CAIxD,CAAC,CACC,CAAC;IAEF,MAAM,IAAA,iCAAyB,EAAC;QAC9B,YAAY,EAAE,8EAA8E,eAAK,CAAC,IAAI,CACpG,kBAAkB,CACnB,IAAI;QACL,WAAW,EAAE,uBAAuB;KACrC,CAAC,CAAC;AACL,CAAC;AAtDD,wDAsDC;AAED,SAAgB,6BAA6B,CAC3C,OAAgC;IAEhC,MAAM,cAAc,GAAG,IAAA,uBAAiB,EAAC,OAAO,CAAC,CAAC;IAElD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2BO,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoL7B,CAAC;AACF,CAAC;AArND,sEAqNC","sourcesContent":["import * as fs from 'fs';\nimport {\n abortIfCancelled,\n makeCodeSnippet,\n showCopyPasteInstructions,\n} from '../utils/clack';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { getIssueStreamUrl } from '../utils/url';\nimport chalk from 'chalk';\n\ninterface ExampleComponentOptions {\n url: string;\n orgSlug: string;\n projectId: string;\n}\n\nexport async function createExampleComponent(options: ExampleComponentOptions) {\n const componentName = 'sentry-example';\n const appRootPath = './src/app';\n\n let componentDirPath = appRootPath;\n const hasAppRoot = fs.existsSync(appRootPath);\n if (!hasAppRoot) {\n componentDirPath = await abortIfCancelled(\n clack.text({\n message: 'Where should we create the example component?',\n placeholder: appRootPath,\n }),\n );\n }\n\n if (!fs.existsSync(componentDirPath)) {\n fs.mkdirSync(componentDirPath, { recursive: true });\n }\n\n const componentCode = getSentryExampleComponentCode(options);\n\n const componentFilePath = `${componentDirPath}/${componentName}.component.ts`;\n\n fs.writeFileSync(componentFilePath, componentCode);\n\n clack.log.success(\n `Created example component at ${chalk.cyan(componentFilePath)}`,\n );\n\n const addComponentCodeSnippet = makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\n \"import { SentryExample } from './sentry-example.component'\",\n )}\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [RouterOutlet, ${plus('SentryExample')}],\n template: \\`\n <div class=\"app\">\n <h1>Your Application</h1>\n ${plus('<app-sentry-example></app-sentry-example>')}\n </div>\n \\`,\n})\n`),\n );\n\n await showCopyPasteInstructions({\n instructions: `Add the example component one of your pages or components (for example, in ${chalk.cyan(\n 'app.component.ts',\n )}).`,\n codeSnippet: addComponentCodeSnippet,\n });\n}\n\nexport function getSentryExampleComponentCode(\n options: ExampleComponentOptions,\n) {\n const issueStreamUrl = getIssueStreamUrl(options);\n\n return `import { NgIf } from '@angular/common';\nimport { Component, OnInit } from '@angular/core';\nimport * as Sentry from '@sentry/angular';\n\n/**\n * This is just a very simple component that throws an example error.\n * Feel free to delete this file once you verify that Sentry is working.\n */\n\n@Component({\n selector: 'app-sentry-example',\n standalone: true,\n imports: [NgIf],\n template: \\`\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\"\n fill=\"currentcolor\"\n />\n </svg>\n\n <h1>app-sentry-example</h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry\n <a\n target=\"_blank\"\n href=\"${issueStreamUrl}\"\n >Issues Page</a\n >. For more details about setting up Sentry,\n <a\n target=\"_blank\"\n href=\"https://docs.sentry.io/platforms/javascript/guides/angular/\"\n >read our docs</a\n >.\n </p>\n\n <button (click)=\"throwError()\">\n <span>Throw Sample Error</span>\n </button>\n\n <div *ngIf=\"isConnected && sentError\" class=\"success\">\n Sample error was sent to Sentry.\n </div>\n <div *ngIf=\"isConnected && !sentError\" class=\"success_placeholder\"></div>\n\n <div *ngIf=\"!isConnected\" class=\"connectivity-error\">\n <p>\n The Sentry SDK is not able to reach Sentry right now - this may be due\n to an adblocker. For more information, see\n <a\n target=\"_blank\"\n href=\"https://docs.sentry.io/platforms/javascript/guides/angular/troubleshooting/#the-sdk-is-not-sending-any-data\"\n >the troubleshooting guide</a\n >.\n </p>\n </div>\n\n <p class=\"description\">\n Adblockers will prevent errors from being sent to Sentry.\n </p>\n \\`,\n styles: \\`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: center;\n border: 2px solid #553DB8;\n border-radius: 8px;\n padding: 1em;\n margin: 0.5em;\n width: 500px;\n height: 495px;\n gap: 1em;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n } \n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n max-width: 400px;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n \\`,\n})\nexport class SentryExample implements OnInit {\n sentError = false;\n isConnected = true;\n\n async ngOnInit(): Promise<void> {\n const res = await Sentry.diagnoseSdkConnectivity();\n this.isConnected = res !== 'sentry-unreachable';\n console.log({ res });\n }\n\n throwError() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test',\n },\n () => {\n this.sentError = true;\n throw new SentryExampleError(\n 'This error was thrown by the Sentry example component.'\n );\n }\n );\n }\n}\n\nclass SentryExampleError extends Error {\n constructor(message: string | undefined) {\n super(message);\n this.name = 'SentryExampleError';\n }\n}\n`;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { SemVer } from 'semver';
2
+ export declare function initalizeSentryOnApplicationEntry(dsn: string, selectedFeatures: {
3
+ performance: boolean;
4
+ replay: boolean;
5
+ }): Promise<void>;
6
+ export declare function updateAppConfig(angularVersion: SemVer, isTracingEnabled: boolean): Promise<void>;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.updateAppConfig = exports.initalizeSentryOnApplicationEntry = void 0;
31
+ // @ts-expect-error - magicast is ESM and TS complains about that. It works though
32
+ const magicast_1 = require("magicast");
33
+ const fs = __importStar(require("fs"));
34
+ const path = __importStar(require("path"));
35
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
36
+ const prompts_1 = __importDefault(require("@clack/prompts"));
37
+ const chalk_1 = __importDefault(require("chalk"));
38
+ const app_config_1 = require("./codemods/app-config");
39
+ const main_1 = require("./codemods/main");
40
+ const ast_utils_1 = require("../utils/ast-utils");
41
+ const Sentry = __importStar(require("@sentry/node"));
42
+ async function initalizeSentryOnApplicationEntry(dsn, selectedFeatures) {
43
+ const appEntryFilename = 'main.ts';
44
+ const appEntryPath = path.join(process.cwd(), 'src', appEntryFilename);
45
+ const originalAppEntry = await (0, magicast_1.loadFile)(appEntryPath);
46
+ if ((0, ast_utils_1.hasSentryContent)(originalAppEntry.$ast)) {
47
+ prompts_1.default.log.warn(`File ${chalk_1.default.cyan(appEntryFilename)} already contains Sentry.
48
+ Skipping adding Sentry functionality to ${chalk_1.default.cyan(appEntryFilename)}.`);
49
+ return;
50
+ }
51
+ const updatedAppEntryMod = (0, main_1.updateAppEntryMod)(originalAppEntry, dsn, selectedFeatures);
52
+ try {
53
+ await (0, magicast_1.writeFile)(updatedAppEntryMod.$ast, appEntryPath);
54
+ }
55
+ catch (error) {
56
+ prompts_1.default.log.error(`Error while adding Sentry to ${chalk_1.default.cyan(appEntryFilename)}`);
57
+ prompts_1.default.log.warn(`Please refer to the documentation for manual setup:
58
+ ${chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/angular/#configure')}`);
59
+ return;
60
+ }
61
+ prompts_1.default.log.success(`Successfully initialized Sentry on ${chalk_1.default.cyan(appEntryFilename)}`);
62
+ }
63
+ exports.initalizeSentryOnApplicationEntry = initalizeSentryOnApplicationEntry;
64
+ async function updateAppConfig(angularVersion, isTracingEnabled) {
65
+ const appConfigFilename = 'app.config.ts';
66
+ const appConfigPath = path.join(process.cwd(), 'src', 'app', appConfigFilename);
67
+ if (!fs.existsSync(appConfigPath)) {
68
+ Sentry.setTag('angular-app-config-found', false);
69
+ prompts_1.default.log.warn(`File ${chalk_1.default.cyan(appConfigFilename)} not found. Skipping adding Sentry functionality.`);
70
+ prompts_1.default.log.warn(`Please refer to the documentation for manual setup:
71
+ ${chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/angular/#configure')}`);
72
+ return;
73
+ }
74
+ Sentry.setTag('angular-app-config-found', true);
75
+ const appConfig = await (0, magicast_1.loadFile)(appConfigPath);
76
+ if ((0, ast_utils_1.hasSentryContent)(appConfig.$ast)) {
77
+ prompts_1.default.log.warn(`File ${chalk_1.default.cyan(appConfigFilename)} already contains Sentry.
78
+ Skipping adding Sentry functionality to ${chalk_1.default.cyan(appConfigFilename)}.`);
79
+ return;
80
+ }
81
+ try {
82
+ const updatedAppConfigMod = (0, app_config_1.updateAppConfigMod)(appConfig, angularVersion, isTracingEnabled);
83
+ await (0, magicast_1.writeFile)(updatedAppConfigMod.$ast, appConfigPath);
84
+ }
85
+ catch (error) {
86
+ prompts_1.default.log.error(`Error while updating your app config ${chalk_1.default.cyan(appConfigFilename)}.`);
87
+ prompts_1.default.log.info(chalk_1.default.dim(typeof error === 'object' && error != null && 'toString' in error
88
+ ? error.toString()
89
+ : typeof error === 'string'
90
+ ? error
91
+ : ''));
92
+ prompts_1.default.log.warn(`Please refer to the documentation for manual setup:
93
+ ${chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/angular/#configure')}`);
94
+ return;
95
+ }
96
+ prompts_1.default.log.success(`Successfully updated your app config ${chalk_1.default.cyan(appConfigFilename)}`);
97
+ }
98
+ exports.updateAppConfig = updateAppConfig;
99
+ //# sourceMappingURL=sdk-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/angular/sdk-setup.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, writeFile } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { updateAppConfigMod } from './codemods/app-config';\nimport { updateAppEntryMod } from './codemods/main';\nimport { hasSentryContent } from '../utils/ast-utils';\nimport * as Sentry from '@sentry/node';\n\nimport type { namedTypes as t } from 'ast-types';\nimport type { SemVer } from 'semver';\n\nexport async function initalizeSentryOnApplicationEntry(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n): Promise<void> {\n const appEntryFilename = 'main.ts';\n const appEntryPath = path.join(process.cwd(), 'src', appEntryFilename);\n\n const originalAppEntry = await loadFile(appEntryPath);\n\n if (hasSentryContent(originalAppEntry.$ast as t.Program)) {\n clack.log.warn(\n `File ${chalk.cyan(appEntryFilename)} already contains Sentry.\nSkipping adding Sentry functionality to ${chalk.cyan(appEntryFilename)}.`,\n );\n\n return;\n }\n\n const updatedAppEntryMod = updateAppEntryMod(\n originalAppEntry,\n dsn,\n selectedFeatures,\n );\n\n try {\n await writeFile(updatedAppEntryMod.$ast, appEntryPath);\n } catch (error: unknown) {\n clack.log.error(\n `Error while adding Sentry to ${chalk.cyan(appEntryFilename)}`,\n );\n\n clack.log.warn(\n `Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`,\n );\n\n return;\n }\n\n clack.log.success(\n `Successfully initialized Sentry on ${chalk.cyan(appEntryFilename)}`,\n );\n}\n\nexport async function updateAppConfig(\n angularVersion: SemVer,\n isTracingEnabled: boolean,\n): Promise<void> {\n const appConfigFilename = 'app.config.ts';\n const appConfigPath = path.join(\n process.cwd(),\n 'src',\n 'app',\n appConfigFilename,\n );\n\n if (!fs.existsSync(appConfigPath)) {\n Sentry.setTag('angular-app-config-found', false);\n\n clack.log.warn(\n `File ${chalk.cyan(\n appConfigFilename,\n )} not found. Skipping adding Sentry functionality.`,\n );\n\n clack.log.warn(`Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`);\n\n return;\n }\n\n Sentry.setTag('angular-app-config-found', true);\n\n const appConfig = await loadFile(appConfigPath);\n\n if (hasSentryContent(appConfig.$ast as t.Program)) {\n clack.log.warn(\n `File ${chalk.cyan(appConfigFilename)} already contains Sentry.\n Skipping adding Sentry functionality to ${chalk.cyan(appConfigFilename)}.`,\n );\n\n return;\n }\n\n try {\n const updatedAppConfigMod = updateAppConfigMod(\n appConfig,\n angularVersion,\n isTracingEnabled,\n );\n\n await writeFile(updatedAppConfigMod.$ast, appConfigPath);\n } catch (error: unknown) {\n clack.log.error(\n `Error while updating your app config ${chalk.cyan(appConfigFilename)}.`,\n );\n\n clack.log.info(\n chalk.dim(\n typeof error === 'object' && error != null && 'toString' in error\n ? error.toString()\n : typeof error === 'string'\n ? error\n : '',\n ),\n );\n\n clack.log.warn(`Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`);\n\n return;\n }\n\n clack.log.success(\n `Successfully updated your app config ${chalk.cyan(appConfigFilename)}`,\n );\n}\n"]}
@@ -1,49 +1,19 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.runAppleWizard = void 0;
30
- /* eslint-disable max-lines */
31
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
32
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
33
- /* eslint-disable @typescript-eslint/no-unsafe-call */
34
- /* eslint-disable @typescript-eslint/no-unused-vars */
35
7
  // @ts-expect-error - clack is ESM and TS complains about that. It works though
36
8
  const prompts_1 = __importDefault(require("@clack/prompts"));
37
- const Sentry = __importStar(require("@sentry/node"));
38
- const chalk_1 = __importDefault(require("chalk"));
39
9
  const telemetry_1 = require("../telemetry");
40
- const SentryUtils = __importStar(require("../utils/sentrycli-utils"));
41
- const cocoapod = __importStar(require("./cocoapod"));
42
- const codeTools = __importStar(require("./code-tools"));
43
- /* eslint-enable @typescript-eslint/no-unused-vars */
44
10
  const clack_1 = require("../utils/clack");
45
11
  const check_installed_cli_1 = require("./check-installed-cli");
46
12
  const configure_fastlane_1 = require("./configure-fastlane");
13
+ const configure_package_manager_1 = require("./configure-package-manager");
14
+ const configure_sentry_cli_1 = require("./configure-sentry-cli");
15
+ const configure_xcode_project_1 = require("./configure-xcode-project");
16
+ const inject_code_snippet_1 = require("./inject-code-snippet");
47
17
  const lookup_xcode_project_1 = require("./lookup-xcode-project");
48
18
  async function runAppleWizard(options) {
49
19
  return (0, telemetry_1.withTelemetry)({
@@ -76,38 +46,28 @@ async function runAppleWizardWithTelementry(options) {
76
46
  });
77
47
  // Step - Sentry Project and API Key
78
48
  const { selectedProject, authToken } = await (0, clack_1.getOrAskForProjectData)(options, 'apple-ios');
79
- SentryUtils.createSentryCLIRC(projectDir, { auth_token: authToken });
80
- prompts_1.default.log.info(`Created a ${chalk_1.default.cyan('.sentryclirc')} file in your project directory to provide an auth token for Sentry CLI.
81
-
82
- It was also added to your ${chalk_1.default.cyan('.gitignore')} file.
83
- Set the ${chalk_1.default.cyan('SENTRY_AUTH_TOKEN')} environment variable in your CI environment. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`);
84
- let hasCocoa = cocoapod.usesCocoaPod(projectDir);
85
- Sentry.setTag('cocoapod-exists', hasCocoa);
86
- if (hasCocoa) {
87
- const pm = (await (0, telemetry_1.traceStep)('Choose a package manager', () => (0, clack_1.askForItemSelection)(['Swift Package Manager', 'CocoaPods'], 'Which package manager would you like to use to add Sentry?'))).value;
88
- hasCocoa = pm === 'CocoaPods';
89
- if (hasCocoa) {
90
- const podAdded = await (0, telemetry_1.traceStep)('Add CocoaPods reference', () => cocoapod.addCocoaPods(projectDir));
91
- Sentry.setTag('cocoapod-added', podAdded);
92
- if (!podAdded) {
93
- prompts_1.default.log.warn("Could not add Sentry pod to your Podfile. You'll have to add it manually.\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install");
94
- }
95
- }
96
- }
97
- Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');
98
- (0, telemetry_1.traceStep)('Update Xcode project', () => {
99
- xcProject.updateXcodeProject(selectedProject, target, !hasCocoa, true);
49
+ // Step - Sentry CLI Configuration Setup
50
+ (0, configure_sentry_cli_1.configureSentryCLI)({
51
+ projectDir,
52
+ authToken: authToken,
53
+ });
54
+ // Step - Set up Package Manager
55
+ const { shouldUseSPM } = await (0, configure_package_manager_1.configurePackageManager)({
56
+ projectDir,
57
+ });
58
+ // Step - Configure Xcode Project
59
+ (0, configure_xcode_project_1.configureXcodeProject)({
60
+ xcProject,
61
+ project: selectedProject,
62
+ target,
63
+ shouldUseSPM,
100
64
  });
101
- const codeAdded = (0, telemetry_1.traceStep)('Add code snippet', () => {
102
- const files = xcProject.filesForTarget(target);
103
- if (files === undefined || files.length == 0)
104
- return false;
105
- return codeTools.addCodeSnippetToProject(projectDir, files, selectedProject.keys[0].dsn.public);
65
+ // Step - Add Code Snippet
66
+ (0, inject_code_snippet_1.injectCodeSnippet)({
67
+ project: xcProject,
68
+ target,
69
+ dsn: selectedProject.keys[0].dsn.public,
106
70
  });
107
- Sentry.setTag('Snippet-Added', codeAdded);
108
- if (!codeAdded) {
109
- prompts_1.default.log.warn('Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure');
110
- }
111
71
  // Step - Fastlane Configuration
112
72
  await (0, configure_fastlane_1.configureFastlane)({
113
73
  projectDir,