@sentry/wizard 3.16.5 → 3.18.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 (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/package.json +2 -2
  3. package/dist/src/apple/cocoapod.js +2 -0
  4. package/dist/src/apple/cocoapod.js.map +1 -1
  5. package/dist/src/nextjs/nextjs-wizard.js +76 -21
  6. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  7. package/dist/src/nextjs/templates.d.ts +2 -0
  8. package/dist/src/nextjs/templates.js +15 -2
  9. package/dist/src/nextjs/templates.js.map +1 -1
  10. package/dist/src/react-native/metro.d.ts +13 -0
  11. package/dist/src/react-native/metro.js +398 -0
  12. package/dist/src/react-native/metro.js.map +1 -0
  13. package/dist/src/react-native/react-native-wizard.d.ts +2 -0
  14. package/dist/src/react-native/react-native-wizard.js +139 -38
  15. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  16. package/dist/src/react-native/uninstall.js +4 -0
  17. package/dist/src/react-native/uninstall.js.map +1 -1
  18. package/dist/src/react-native/xcode.d.ts +7 -3
  19. package/dist/src/react-native/xcode.js +43 -11
  20. package/dist/src/react-native/xcode.js.map +1 -1
  21. package/dist/src/remix/remix-wizard.js +80 -37
  22. package/dist/src/remix/remix-wizard.js.map +1 -1
  23. package/dist/src/remix/sdk-setup.d.ts +1 -0
  24. package/dist/src/remix/sdk-setup.js +21 -1
  25. package/dist/src/remix/sdk-setup.js.map +1 -1
  26. package/dist/src/utils/ast-utils.d.ts +14 -0
  27. package/dist/src/utils/ast-utils.js +49 -1
  28. package/dist/src/utils/ast-utils.js.map +1 -1
  29. package/dist/test/react-native/metro.test.d.ts +1 -0
  30. package/dist/test/react-native/metro.test.js +125 -0
  31. package/dist/test/react-native/metro.test.js.map +1 -0
  32. package/dist/test/react-native/xcode.test.js +40 -2
  33. package/dist/test/react-native/xcode.test.js.map +1 -1
  34. package/package.json +2 -2
  35. package/src/apple/cocoapod.ts +2 -0
  36. package/src/nextjs/nextjs-wizard.ts +99 -19
  37. package/src/nextjs/templates.ts +77 -0
  38. package/src/react-native/metro.ts +409 -0
  39. package/src/react-native/react-native-wizard.ts +103 -7
  40. package/src/react-native/uninstall.ts +3 -0
  41. package/src/react-native/xcode.ts +70 -12
  42. package/src/remix/remix-wizard.ts +51 -15
  43. package/src/remix/sdk-setup.ts +31 -0
  44. package/src/utils/ast-utils.ts +52 -0
  45. package/test/react-native/metro.test.ts +283 -0
  46. package/test/react-native/xcode.test.ts +76 -3
@@ -73,7 +73,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
73
73
  return (mod && mod.__esModule) ? mod : { "default": mod };
74
74
  };
75
75
  Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.runReactNativeWizardWithTelemetry = exports.runReactNativeWizard = exports.SUPPORTED_RN_RANGE = exports.RN_HUMAN_NAME = exports.RN_PACKAGE = exports.RN_SDK_PACKAGE = void 0;
76
+ exports.runReactNativeWizardWithTelemetry = exports.runReactNativeWizard = exports.SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = exports.SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = exports.SUPPORTED_RN_RANGE = exports.RN_HUMAN_NAME = exports.RN_PACKAGE = exports.RN_SDK_PACKAGE = void 0;
77
77
  /* eslint-disable max-lines */
78
78
  // @ts-ignore - clack is ESM and TS complains about that. It works though
79
79
  var prompts_1 = __importDefault(require("@clack/prompts"));
@@ -92,13 +92,20 @@ var glob_1 = require("./glob");
92
92
  var javascript_1 = require("./javascript");
93
93
  var telemetry_1 = require("../telemetry");
94
94
  var Sentry = __importStar(require("@sentry/node"));
95
+ var semver_1 = require("../utils/semver");
95
96
  var url_1 = require("../utils/url");
97
+ var metro_1 = require("./metro");
96
98
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
97
99
  var xcode = require('xcode');
98
100
  exports.RN_SDK_PACKAGE = '@sentry/react-native';
99
101
  exports.RN_PACKAGE = 'react-native';
100
102
  exports.RN_HUMAN_NAME = 'React Native';
101
103
  exports.SUPPORTED_RN_RANGE = '>=0.69.0';
104
+ // The following SDK version ship with bundled Xcode scripts
105
+ // which simplifies the Xcode Build Phases setup.
106
+ exports.SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = '>=5.11.0';
107
+ // The following SDK version ship with Sentry Metro plugin
108
+ exports.SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = '>=5.11.0';
102
109
  function runReactNativeWizard(params) {
103
110
  return __awaiter(this, void 0, void 0, function () {
104
111
  return __generator(this, function (_a) {
@@ -112,9 +119,9 @@ function runReactNativeWizard(params) {
112
119
  exports.runReactNativeWizard = runReactNativeWizard;
113
120
  function runReactNativeWizardWithTelemetry(options) {
114
121
  return __awaiter(this, void 0, void 0, function () {
115
- var packageJson, rnVersion, _a, selectedProject, authToken, sentryUrl, orgSlug, projectSlug, projectId, cliConfig, confirmedFirstException;
116
- return __generator(this, function (_b) {
117
- switch (_b.label) {
122
+ var packageJson, rnVersion, _a, selectedProject, authToken, sentryUrl, orgSlug, projectSlug, projectId, cliConfig, sdkVersion, _b, _c, confirmedFirstException;
123
+ return __generator(this, function (_d) {
124
+ switch (_d.label) {
118
125
  case 0:
119
126
  if (options.uninstall) {
120
127
  Sentry.setTag('uninstall', true);
@@ -127,13 +134,13 @@ function runReactNativeWizardWithTelemetry(options) {
127
134
  });
128
135
  return [4 /*yield*/, (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)()];
129
136
  case 1:
130
- _b.sent();
137
+ _d.sent();
131
138
  return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
132
139
  case 2:
133
- packageJson = _b.sent();
140
+ packageJson = _d.sent();
134
141
  return [4 /*yield*/, (0, clack_utils_1.ensurePackageIsInstalled)(packageJson, exports.RN_PACKAGE, exports.RN_HUMAN_NAME)];
135
142
  case 3:
136
- _b.sent();
143
+ _d.sent();
137
144
  rnVersion = (0, package_json_1.getPackageVersion)(exports.RN_PACKAGE, packageJson);
138
145
  if (!rnVersion) return [3 /*break*/, 5];
139
146
  return [4 /*yield*/, (0, clack_utils_1.confirmContinueIfPackageVersionNotSupported)({
@@ -143,11 +150,11 @@ function runReactNativeWizardWithTelemetry(options) {
143
150
  acceptableVersions: exports.SUPPORTED_RN_RANGE,
144
151
  })];
145
152
  case 4:
146
- _b.sent();
147
- _b.label = 5;
153
+ _d.sent();
154
+ _d.label = 5;
148
155
  case 5: return [4 /*yield*/, (0, clack_utils_1.getOrAskForProjectData)(options, 'react-native')];
149
156
  case 6:
150
- _a = _b.sent(), selectedProject = _a.selectedProject, authToken = _a.authToken, sentryUrl = _a.sentryUrl;
157
+ _a = _d.sent(), selectedProject = _a.selectedProject, authToken = _a.authToken, sentryUrl = _a.sentryUrl;
151
158
  orgSlug = selectedProject.organization.slug;
152
159
  projectSlug = selectedProject.slug;
153
160
  projectId = selectedProject.id;
@@ -162,28 +169,40 @@ function runReactNativeWizardWithTelemetry(options) {
162
169
  alreadyInstalled: (0, package_json_1.hasPackageInstalled)(exports.RN_SDK_PACKAGE, packageJson),
163
170
  })];
164
171
  case 7:
165
- _b.sent();
172
+ _d.sent();
173
+ _b = package_json_1.getPackageVersion;
174
+ _c = [exports.RN_SDK_PACKAGE];
175
+ return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
176
+ case 8:
177
+ sdkVersion = _b.apply(void 0, _c.concat([_d.sent()]));
166
178
  return [4 /*yield*/, (0, telemetry_1.traceStep)('patch-js', function () {
167
179
  return addSentryInit({ dsn: selectedProject.keys[0].dsn.public });
168
180
  })];
169
- case 8:
170
- _b.sent();
171
- if (!fs.existsSync('ios')) return [3 /*break*/, 10];
172
- Sentry.setTag('patch-ios', true);
173
- return [4 /*yield*/, (0, telemetry_1.traceStep)('patch-xcode-files', function () { return patchXcodeFiles(cliConfig); })];
174
181
  case 9:
175
- _b.sent();
176
- _b.label = 10;
182
+ _d.sent();
183
+ return [4 /*yield*/, (0, telemetry_1.traceStep)('patch-metro-config', function () {
184
+ return addSentryToMetroConfig({ sdkVersion: sdkVersion });
185
+ })];
177
186
  case 10:
178
- if (!fs.existsSync('android')) return [3 /*break*/, 12];
187
+ _d.sent();
188
+ if (!fs.existsSync('ios')) return [3 /*break*/, 12];
189
+ Sentry.setTag('patch-ios', true);
190
+ return [4 /*yield*/, (0, telemetry_1.traceStep)('patch-xcode-files', function () {
191
+ return patchXcodeFiles(cliConfig, { sdkVersion: sdkVersion });
192
+ })];
193
+ case 11:
194
+ _d.sent();
195
+ _d.label = 12;
196
+ case 12:
197
+ if (!fs.existsSync('android')) return [3 /*break*/, 14];
179
198
  Sentry.setTag('patch-android', true);
180
199
  return [4 /*yield*/, (0, telemetry_1.traceStep)('patch-android-files', function () { return patchAndroidFiles(cliConfig); })];
181
- case 11:
182
- _b.sent();
183
- _b.label = 12;
184
- case 12: return [4 /*yield*/, confirmFirstSentryException(sentryUrl, orgSlug, projectId)];
185
200
  case 13:
186
- confirmedFirstException = _b.sent();
201
+ _d.sent();
202
+ _d.label = 14;
203
+ case 14: return [4 /*yield*/, confirmFirstSentryException(sentryUrl, orgSlug, projectId)];
204
+ case 15:
205
+ confirmedFirstException = _d.sent();
187
206
  Sentry.setTag('user-confirmed-first-error', confirmedFirstException);
188
207
  if (confirmedFirstException) {
189
208
  prompts_1.default.outro("".concat(chalk_1.default.green('Everything is set up!'), "\n\n ").concat(chalk_1.default.dim('If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues')));
@@ -197,6 +216,28 @@ function runReactNativeWizardWithTelemetry(options) {
197
216
  });
198
217
  }
199
218
  exports.runReactNativeWizardWithTelemetry = runReactNativeWizardWithTelemetry;
219
+ function addSentryToMetroConfig(_a) {
220
+ var sdkVersion = _a.sdkVersion;
221
+ return __awaiter(this, void 0, void 0, function () {
222
+ return __generator(this, function (_b) {
223
+ switch (_b.label) {
224
+ case 0:
225
+ if (!sdkVersion ||
226
+ !(0, semver_1.fulfillsVersionRange)({
227
+ version: sdkVersion,
228
+ acceptableVersions: exports.SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE,
229
+ canBeLatest: true,
230
+ })) {
231
+ return [2 /*return*/];
232
+ }
233
+ return [4 /*yield*/, (0, metro_1.patchMetroConfig)()];
234
+ case 1:
235
+ _b.sent();
236
+ return [2 /*return*/];
237
+ }
238
+ });
239
+ });
240
+ }
200
241
  function addSentryInit(_a) {
201
242
  var dsn = _a.dsn;
202
243
  return __awaiter(this, void 0, void 0, function () {
@@ -258,21 +299,27 @@ function confirmFirstSentryException(url, orgSlug, projectId) {
258
299
  });
259
300
  });
260
301
  }
261
- function patchXcodeFiles(config) {
302
+ function patchXcodeFiles(config, context) {
262
303
  return __awaiter(this, void 0, void 0, function () {
263
- var xcodeProjectPath, _a, xcodeProject, buildPhasesMap;
264
- return __generator(this, function (_b) {
265
- switch (_b.label) {
304
+ var _a, xcodeProjectPath, _b, xcodeProject, buildPhasesMap;
305
+ return __generator(this, function (_c) {
306
+ switch (_c.label) {
266
307
  case 0: return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)(config, __assign(__assign({}, clack_utils_1.propertiesCliSetupConfig), { name: 'source maps and iOS debug files', filename: 'ios/sentry.properties', gitignore: false }))];
267
308
  case 1:
268
- _b.sent();
269
- if (!((0, os_1.platform)() === 'darwin')) return [3 /*break*/, 3];
270
- return [4 /*yield*/, (0, telemetry_1.traceStep)('pod-install', function () { return (0, cocoapod_1.podInstall)('ios'); })];
309
+ _c.sent();
310
+ _a = (0, os_1.platform)() === 'darwin';
311
+ if (!_a) return [3 /*break*/, 3];
312
+ return [4 /*yield*/, confirmPodInstall()];
271
313
  case 2:
272
- _b.sent();
273
- Sentry.setTag('pods-installed', true);
274
- _b.label = 3;
314
+ _a = (_c.sent());
315
+ _c.label = 3;
275
316
  case 3:
317
+ if (!_a) return [3 /*break*/, 5];
318
+ return [4 /*yield*/, (0, telemetry_1.traceStep)('pod-install', function () { return (0, cocoapod_1.podInstall)('ios'); })];
319
+ case 4:
320
+ _c.sent();
321
+ _c.label = 5;
322
+ case 5:
276
323
  xcodeProjectPath = (0, telemetry_1.traceStep)('find-xcode-project', function () {
277
324
  return (0, glob_1.getFirstMatchedPath)(glob_1.XCODE_PROJECT);
278
325
  });
@@ -281,25 +328,49 @@ function patchXcodeFiles(config) {
281
328
  prompts_1.default.log.warn("Could not find Xcode project file using ".concat(chalk_1.default.cyan(glob_1.XCODE_PROJECT), "."));
282
329
  return [2 /*return*/];
283
330
  }
284
- _a = (0, telemetry_1.traceStep)('parse-xcode-project', function () {
331
+ _b = (0, telemetry_1.traceStep)('parse-xcode-project', function () {
285
332
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
286
333
  var project = xcode.project(xcodeProjectPath);
287
334
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
288
335
  project.parseSync();
289
336
  var map = (0, xcode_1.getValidExistingBuildPhases)(project);
290
337
  return [project, map];
291
- }), xcodeProject = _a[0], buildPhasesMap = _a[1];
338
+ }), xcodeProject = _b[0], buildPhasesMap = _b[1];
292
339
  Sentry.setTag('xcode-project-status', 'parsed');
293
340
  (0, telemetry_1.traceStep)('patch-bundle-phase', function () {
294
341
  var bundlePhase = (0, xcode_1.findBundlePhase)(buildPhasesMap);
295
342
  Sentry.setTag('xcode-bundle-phase-status', bundlePhase ? 'found' : 'not-found');
296
- (0, xcode_1.patchBundlePhase)(bundlePhase);
343
+ if (context.sdkVersion &&
344
+ (0, semver_1.fulfillsVersionRange)({
345
+ version: context.sdkVersion,
346
+ acceptableVersions: exports.SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,
347
+ canBeLatest: true,
348
+ })) {
349
+ (0, xcode_1.patchBundlePhase)(bundlePhase, xcode_1.addSentryWithBundledScriptsToBundleShellScript);
350
+ }
351
+ else {
352
+ (0, xcode_1.patchBundlePhase)(bundlePhase, xcode_1.addSentryWithCliToBundleShellScript);
353
+ }
297
354
  Sentry.setTag('xcode-bundle-phase-status', 'patched');
298
355
  });
299
356
  (0, telemetry_1.traceStep)('add-debug-files-upload-phase', function () {
300
357
  var debugFilesUploadPhaseExists = !!(0, xcode_1.findDebugFilesUploadPhase)(buildPhasesMap);
301
358
  Sentry.setTag('xcode-debug-files-upload-phase-status', debugFilesUploadPhaseExists ? 'already-exists' : undefined);
302
- (0, xcode_1.addDebugFilesUploadPhase)(xcodeProject, { debugFilesUploadPhaseExists: debugFilesUploadPhaseExists });
359
+ if (context.sdkVersion &&
360
+ (0, semver_1.fulfillsVersionRange)({
361
+ version: context.sdkVersion,
362
+ acceptableVersions: exports.SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,
363
+ canBeLatest: true,
364
+ })) {
365
+ (0, xcode_1.addDebugFilesUploadPhaseWithBundledScripts)(xcodeProject, {
366
+ debugFilesUploadPhaseExists: debugFilesUploadPhaseExists,
367
+ });
368
+ }
369
+ else {
370
+ (0, xcode_1.addDebugFilesUploadPhaseWithCli)(xcodeProject, {
371
+ debugFilesUploadPhaseExists: debugFilesUploadPhaseExists,
372
+ });
373
+ }
303
374
  Sentry.setTag('xcode-debug-files-upload-phase-status', 'added');
304
375
  });
305
376
  (0, telemetry_1.traceStep)('write-xcode-project', function () {
@@ -355,4 +426,34 @@ function patchAndroidFiles(config) {
355
426
  });
356
427
  });
357
428
  }
429
+ function confirmPodInstall() {
430
+ return __awaiter(this, void 0, void 0, function () {
431
+ var _this = this;
432
+ return __generator(this, function (_a) {
433
+ return [2 /*return*/, (0, telemetry_1.traceStep)('confirm-pod-install', function () { return __awaiter(_this, void 0, void 0, function () {
434
+ var continueWithPodInstall;
435
+ return __generator(this, function (_a) {
436
+ switch (_a.label) {
437
+ case 0: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
438
+ message: 'Do you want to run `pod install` now?',
439
+ options: [
440
+ {
441
+ value: true,
442
+ label: 'Yes',
443
+ hint: 'Recommended for smaller projects, this might take several minutes',
444
+ },
445
+ { value: false, label: "No, I'll do it later" },
446
+ ],
447
+ initialValue: true,
448
+ }))];
449
+ case 1:
450
+ continueWithPodInstall = _a.sent();
451
+ Sentry.setTag('continue-with-pod-install', continueWithPodInstall);
452
+ return [2 /*return*/, continueWithPodInstall];
453
+ }
454
+ });
455
+ }); })];
456
+ });
457
+ });
458
+ }
358
459
  //# sourceMappingURL=react-native-wizard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-native-wizard.js","sourceRoot":"","sources":["../../../src/react-native/react-native-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qCAAyB;AACzB,yCAA6B;AAC7B,+CAAmC;AACnC,oDAY8B;AAC9B,sDAA+E;AAC/E,8CAA+C;AAC/C,yBAA8B;AAC9B,iCAOiB;AACjB,mCAIkB;AAClB,yCAAsD;AACtD,+BAA8E;AAE9E,2CAIsB;AACtB,0CAAwD;AACxD,mDAAuC;AACvC,oCAAiD;AAEjD,mEAAmE;AACnE,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,cAAc,GAAG,sBAAsB,CAAC;AAExC,QAAA,UAAU,GAAG,cAAc,CAAC;AAC5B,QAAA,aAAa,GAAG,cAAc,CAAC;AAE/B,QAAA,kBAAkB,GAAG,UAAU,CAAC;AAO7C,SAAsB,oBAAoB,CACxC,MAAgC;;;YAEhC,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,MAAM,CAAC,gBAAgB;oBAChC,WAAW,EAAE,cAAc;iBAC5B,EACD,cAAM,OAAA,iCAAiC,CAAC,MAAM,CAAC,EAAzC,CAAyC,CAChD,EAAC;;;CACH;AAVD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I,CACZ,mDAA4C,eAAK,CAAC,IAAI,CACpD,kBAAkB,CACnB,MAAG,CACL,CAAC;wBACF,sBAAO;qBACR;oBAED,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,+BAA+B,CAAC,CAAC;oBAC1E,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,2CAAoC,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAG,CACtE,CAAC;oBAEF,IAAA,qBAAS,EAAC,wBAAwB,EAAE;wBAClC,OAAA,IAAA,4BAAmB,EAAC,kBAAkB,EAAE,qBAAqB,CAAC;oBAA9D,CAA8D,CAC/D,CAAC;oBACF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,eAAK,CAAC,KAAK,CAAC,kBAAW,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAS,CAAC,CAChE,CAAC;;;;;CACH","sourcesContent":["/* eslint-disable max-lines */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as process from 'process';\nimport {\n CliSetupConfigContent,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n confirmContinueIfPackageVersionNotSupported,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n propertiesCliSetupConfig,\n showCopyPasteInstructions,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { podInstall } from '../apple/cocoapod';\nimport { platform } from 'os';\nimport {\n getValidExistingBuildPhases,\n findBundlePhase,\n patchBundlePhase,\n findDebugFilesUploadPhase,\n addDebugFilesUploadPhase,\n writeXcodeProject,\n} from './xcode';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n addRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { runReactNativeUninstall } from './uninstall';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport { ReactNativeWizardOptions } from './options';\nimport {\n addSentryInitWithSdkImport,\n doesJsCodeIncludeSdkSentryImport,\n getSentryInitColoredCodeSnippet,\n} from './javascript';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as Sentry from '@sentry/node';\nimport { getIssueStreamUrl } from '../utils/url';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst xcode = require('xcode');\n\nexport const RN_SDK_PACKAGE = '@sentry/react-native';\n\nexport const RN_PACKAGE = 'react-native';\nexport const RN_HUMAN_NAME = 'React Native';\n\nexport const SUPPORTED_RN_RANGE = '>=0.69.0';\n\nexport type RNCliSetupConfigContent = Pick<\n Required<CliSetupConfigContent>,\n 'authToken' | 'org' | 'project' | 'url'\n>;\n\nexport async function runReactNativeWizard(\n params: ReactNativeWizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: params.telemetryEnabled,\n integration: 'react-native',\n },\n () => runReactNativeWizardWithTelemetry(params),\n );\n}\n\nexport async function runReactNativeWizardWithTelemetry(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n if (options.uninstall) {\n Sentry.setTag('uninstall', true);\n return runReactNativeUninstall(options);\n }\n\n printWelcome({\n wizardName: 'Sentry React Native Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, RN_PACKAGE, RN_HUMAN_NAME);\n\n const rnVersion = getPackageVersion(RN_PACKAGE, packageJson);\n if (rnVersion) {\n await confirmContinueIfPackageVersionNotSupported({\n packageName: RN_HUMAN_NAME,\n packageVersion: rnVersion,\n packageId: RN_PACKAGE,\n acceptableVersions: SUPPORTED_RN_RANGE,\n });\n }\n\n const { selectedProject, authToken, sentryUrl } =\n await getOrAskForProjectData(options, 'react-native');\n const orgSlug = selectedProject.organization.slug;\n const projectSlug = selectedProject.slug;\n const projectId = selectedProject.id;\n const cliConfig: RNCliSetupConfigContent = {\n authToken,\n org: orgSlug,\n project: projectSlug,\n url: sentryUrl,\n };\n\n await installPackage({\n packageName: RN_SDK_PACKAGE,\n alreadyInstalled: hasPackageInstalled(RN_SDK_PACKAGE, packageJson),\n });\n\n await traceStep('patch-js', () =>\n addSentryInit({ dsn: selectedProject.keys[0].dsn.public }),\n );\n\n if (fs.existsSync('ios')) {\n Sentry.setTag('patch-ios', true);\n await traceStep('patch-xcode-files', () => patchXcodeFiles(cliConfig));\n }\n\n if (fs.existsSync('android')) {\n Sentry.setTag('patch-android', true);\n await traceStep('patch-android-files', () => patchAndroidFiles(cliConfig));\n }\n\n const confirmedFirstException = await confirmFirstSentryException(\n sentryUrl,\n orgSlug,\n projectId,\n );\n Sentry.setTag('user-confirmed-first-error', confirmedFirstException);\n\n if (confirmedFirstException) {\n clack.outro(\n `${chalk.green('Everything is set up!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n } else {\n clack.outro(\n `${chalk.dim(\n 'Let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n }\n}\n\nasync function addSentryInit({ dsn }: { dsn: string }) {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${universalGlob})`;\n const jsPath = traceStep('find-app-js-file', () =>\n getFirstMatchedPath(jsFileGlob),\n );\n Sentry.setTag('app-js-file-status', jsPath ? 'found' : 'not-found');\n if (!jsPath) {\n clack.log.warn(\n `Could not find main App file using ${chalk.cyan(jsFileGlob)}.`,\n );\n await showCopyPasteInstructions(\n 'App.js',\n getSentryInitColoredCodeSnippet(dsn),\n 'This ensures the Sentry SDK is ready to capture errors.',\n );\n return;\n }\n const jsRelativePath = path.relative(process.cwd(), jsPath);\n\n const js = fs.readFileSync(jsPath, 'utf-8');\n const includesSentry = doesJsCodeIncludeSdkSentryImport(js, {\n sdkPackageName: RN_SDK_PACKAGE,\n });\n if (includesSentry) {\n Sentry.setTag('app-js-file-status', 'already-includes-sentry');\n clack.log.warn(\n `${chalk.cyan(\n jsRelativePath,\n )} already includes Sentry. We wont't add it again.`,\n );\n return;\n }\n\n traceStep('add-sentry-init', () => {\n const newContent = addSentryInitWithSdkImport(js, { dsn });\n\n clack.log.success(\n `Added ${chalk.cyan('Sentry.init')} to ${chalk.cyan(jsRelativePath)}.`,\n );\n\n fs.writeFileSync(jsPath, newContent, 'utf-8');\n });\n\n Sentry.setTag('app-js-file-status', 'added-sentry-init');\n clack.log.success(\n chalk.green(`${chalk.cyan(jsRelativePath)} changes saved.`),\n );\n}\n\nasync function confirmFirstSentryException(\n url: string,\n orgSlug: string,\n projectId: string,\n) {\n const issuesStreamUrl = getIssueStreamUrl({ url, orgSlug, projectId });\n\n clack.log\n .step(`To make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n\nAfter that check your project issues:\n\n${chalk.cyan(issuesStreamUrl)}`);\n\n // We want the code snippet to be easily copy-pasteable, without any clack artifacts\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\n<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>\n`),\n );\n\n const firstErrorConfirmed = clack.confirm({\n message: `Have you successfully sent a test event?`,\n });\n\n return firstErrorConfirmed;\n}\n\nasync function patchXcodeFiles(config: RNCliSetupConfigContent) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'ios/sentry.properties',\n gitignore: false,\n });\n\n if (platform() === 'darwin') {\n await traceStep('pod-install', () => podInstall('ios'));\n Sentry.setTag('pods-installed', true);\n }\n\n const xcodeProjectPath = traceStep('find-xcode-project', () =>\n getFirstMatchedPath(XCODE_PROJECT),\n );\n Sentry.setTag(\n 'xcode-project-status',\n xcodeProjectPath ? 'found' : 'not-found',\n );\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.cyan(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const [xcodeProject, buildPhasesMap] = traceStep(\n 'parse-xcode-project',\n () => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const project = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n project.parseSync();\n\n const map = getValidExistingBuildPhases(project);\n return [project, map];\n },\n );\n Sentry.setTag('xcode-project-status', 'parsed');\n\n traceStep('patch-bundle-phase', () => {\n const bundlePhase = findBundlePhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-bundle-phase-status',\n bundlePhase ? 'found' : 'not-found',\n );\n patchBundlePhase(bundlePhase);\n Sentry.setTag('xcode-bundle-phase-status', 'patched');\n });\n\n traceStep('add-debug-files-upload-phase', () => {\n const debugFilesUploadPhaseExists =\n !!findDebugFilesUploadPhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-debug-files-upload-phase-status',\n debugFilesUploadPhaseExists ? 'already-exists' : undefined,\n );\n addDebugFilesUploadPhase(xcodeProject, { debugFilesUploadPhaseExists });\n Sentry.setTag('xcode-debug-files-upload-phase-status', 'added');\n });\n\n traceStep('write-xcode-project', () => {\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n });\n Sentry.setTag('xcode-project-status', 'patched');\n}\n\nasync function patchAndroidFiles(config: RNCliSetupConfigContent) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'android/sentry.properties',\n gitignore: false,\n });\n\n const appBuildGradlePath = traceStep('find-app-build-gradle', () =>\n getFirstMatchedPath(APP_BUILD_GRADLE),\n );\n Sentry.setTag(\n 'app-build-gradle-status',\n appBuildGradlePath ? 'found' : 'not-found',\n );\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android ${chalk.cyan(\n 'app/build.gradle',\n )} file using ${chalk.cyan(APP_BUILD_GRADLE)}.`,\n );\n return;\n }\n\n const appBuildGradle = traceStep('read-app-build-gradle', () =>\n fs.readFileSync(appBuildGradlePath, 'utf-8'),\n );\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (includesSentry) {\n Sentry.setTag('app-build-gradle-status', 'already-includes-sentry');\n clack.log.warn(\n `Android ${chalk.cyan('app/build.gradle')} file already includes Sentry.`,\n );\n return;\n }\n\n const patchedAppBuildGradle = traceStep('add-rn-sentry-gradle-plugin', () =>\n addRNSentryGradlePlugin(appBuildGradle),\n );\n if (!doesAppBuildGradleIncludeRNSentryGradlePlugin(patchedAppBuildGradle)) {\n Sentry.setTag(\n 'app-build-gradle-status',\n 'failed-to-add-rn-sentry-gradle-plugin',\n );\n clack.log.warn(\n `Could not add Sentry RN Gradle Plugin to ${chalk.cyan(\n 'app/build.gradle',\n )}.`,\n );\n return;\n }\n\n Sentry.setTag('app-build-gradle-status', 'added-rn-sentry-gradle-plugin');\n clack.log.success(\n `Added Sentry RN Gradle Plugin to ${chalk.bold('app/build.gradle')}.`,\n );\n\n traceStep('write-app-build-gradle', () =>\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle),\n );\n clack.log.success(\n chalk.green(`Android ${chalk.cyan('app/build.gradle')} saved.`),\n );\n}\n"]}
1
+ {"version":3,"file":"react-native-wizard.js","sourceRoot":"","sources":["../../../src/react-native/react-native-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qCAAyB;AACzB,yCAA6B;AAC7B,+CAAmC;AACnC,oDAa8B;AAC9B,sDAA+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CAAC,CAChE,CAAC;;;;;CACH;AAED,SAAe,iBAAiB;;;;YAC9B,sBAAO,IAAA,qBAAS,EAAC,qBAAqB,EAAE;;;;oCACP,qBAAM,IAAA,8BAAgB,EACnD,iBAAK,CAAC,MAAM,CAAC;oCACX,OAAO,EAAE,uCAAuC;oCAChD,OAAO,EAAE;wCACP;4CACE,KAAK,EAAE,IAAI;4CACX,KAAK,EAAE,KAAK;4CACZ,IAAI,EAAE,mEAAmE;yCAC1E;wCACD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE;qCAChD;oCACD,YAAY,EAAE,IAAI;iCACnB,CAAC,CACH,EAAA;;gCAbK,sBAAsB,GAAG,SAa9B;gCACD,MAAM,CAAC,MAAM,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAC;gCACnE,sBAAO,sBAAsB,EAAC;;;qBAC/B,CAAC,EAAC;;;CACJ","sourcesContent":["/* eslint-disable max-lines */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as process from 'process';\nimport {\n CliSetupConfigContent,\n abortIfCancelled,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n confirmContinueIfPackageVersionNotSupported,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n propertiesCliSetupConfig,\n showCopyPasteInstructions,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { podInstall } from '../apple/cocoapod';\nimport { platform } from 'os';\nimport {\n getValidExistingBuildPhases,\n findBundlePhase,\n patchBundlePhase,\n findDebugFilesUploadPhase,\n addDebugFilesUploadPhaseWithCli,\n writeXcodeProject,\n addSentryWithCliToBundleShellScript,\n addSentryWithBundledScriptsToBundleShellScript,\n addDebugFilesUploadPhaseWithBundledScripts,\n} from './xcode';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n addRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { runReactNativeUninstall } from './uninstall';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport { ReactNativeWizardOptions } from './options';\nimport {\n addSentryInitWithSdkImport,\n doesJsCodeIncludeSdkSentryImport,\n getSentryInitColoredCodeSnippet,\n} from './javascript';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as Sentry from '@sentry/node';\nimport { fulfillsVersionRange } from '../utils/semver';\nimport { getIssueStreamUrl } from '../utils/url';\nimport { patchMetroConfig } from './metro';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst xcode = require('xcode');\n\nexport const RN_SDK_PACKAGE = '@sentry/react-native';\n\nexport const RN_PACKAGE = 'react-native';\nexport const RN_HUMAN_NAME = 'React Native';\n\nexport const SUPPORTED_RN_RANGE = '>=0.69.0';\n\n// The following SDK version ship with bundled Xcode scripts\n// which simplifies the Xcode Build Phases setup.\nexport const SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = '>=5.11.0';\n\n// The following SDK version ship with Sentry Metro plugin\nexport const SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = '>=5.11.0';\n\nexport type RNCliSetupConfigContent = Pick<\n Required<CliSetupConfigContent>,\n 'authToken' | 'org' | 'project' | 'url'\n>;\n\nexport async function runReactNativeWizard(\n params: ReactNativeWizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: params.telemetryEnabled,\n integration: 'react-native',\n },\n () => runReactNativeWizardWithTelemetry(params),\n );\n}\n\nexport async function runReactNativeWizardWithTelemetry(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n if (options.uninstall) {\n Sentry.setTag('uninstall', true);\n return runReactNativeUninstall(options);\n }\n\n printWelcome({\n wizardName: 'Sentry React Native Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, RN_PACKAGE, RN_HUMAN_NAME);\n\n const rnVersion = getPackageVersion(RN_PACKAGE, packageJson);\n if (rnVersion) {\n await confirmContinueIfPackageVersionNotSupported({\n packageName: RN_HUMAN_NAME,\n packageVersion: rnVersion,\n packageId: RN_PACKAGE,\n acceptableVersions: SUPPORTED_RN_RANGE,\n });\n }\n\n const { selectedProject, authToken, sentryUrl } =\n await getOrAskForProjectData(options, 'react-native');\n const orgSlug = selectedProject.organization.slug;\n const projectSlug = selectedProject.slug;\n const projectId = selectedProject.id;\n const cliConfig: RNCliSetupConfigContent = {\n authToken,\n org: orgSlug,\n project: projectSlug,\n url: sentryUrl,\n };\n\n await installPackage({\n packageName: RN_SDK_PACKAGE,\n alreadyInstalled: hasPackageInstalled(RN_SDK_PACKAGE, packageJson),\n });\n const sdkVersion = getPackageVersion(\n RN_SDK_PACKAGE,\n await getPackageDotJson(),\n );\n\n await traceStep('patch-js', () =>\n addSentryInit({ dsn: selectedProject.keys[0].dsn.public }),\n );\n\n await traceStep('patch-metro-config', () =>\n addSentryToMetroConfig({ sdkVersion }),\n );\n\n if (fs.existsSync('ios')) {\n Sentry.setTag('patch-ios', true);\n await traceStep('patch-xcode-files', () =>\n patchXcodeFiles(cliConfig, { sdkVersion }),\n );\n }\n\n if (fs.existsSync('android')) {\n Sentry.setTag('patch-android', true);\n await traceStep('patch-android-files', () => patchAndroidFiles(cliConfig));\n }\n\n const confirmedFirstException = await confirmFirstSentryException(\n sentryUrl,\n orgSlug,\n projectId,\n );\n Sentry.setTag('user-confirmed-first-error', confirmedFirstException);\n\n if (confirmedFirstException) {\n clack.outro(\n `${chalk.green('Everything is set up!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n } else {\n clack.outro(\n `${chalk.dim(\n 'Let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n }\n}\n\nasync function addSentryToMetroConfig({\n sdkVersion,\n}: {\n sdkVersion: string | undefined;\n}) {\n if (\n !sdkVersion ||\n !fulfillsVersionRange({\n version: sdkVersion,\n acceptableVersions: SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n return;\n }\n\n await patchMetroConfig();\n}\n\nasync function addSentryInit({ dsn }: { dsn: string }) {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${universalGlob})`;\n const jsPath = traceStep('find-app-js-file', () =>\n getFirstMatchedPath(jsFileGlob),\n );\n Sentry.setTag('app-js-file-status', jsPath ? 'found' : 'not-found');\n if (!jsPath) {\n clack.log.warn(\n `Could not find main App file using ${chalk.cyan(jsFileGlob)}.`,\n );\n await showCopyPasteInstructions(\n 'App.js',\n getSentryInitColoredCodeSnippet(dsn),\n 'This ensures the Sentry SDK is ready to capture errors.',\n );\n return;\n }\n const jsRelativePath = path.relative(process.cwd(), jsPath);\n\n const js = fs.readFileSync(jsPath, 'utf-8');\n const includesSentry = doesJsCodeIncludeSdkSentryImport(js, {\n sdkPackageName: RN_SDK_PACKAGE,\n });\n if (includesSentry) {\n Sentry.setTag('app-js-file-status', 'already-includes-sentry');\n clack.log.warn(\n `${chalk.cyan(\n jsRelativePath,\n )} already includes Sentry. We wont't add it again.`,\n );\n return;\n }\n\n traceStep('add-sentry-init', () => {\n const newContent = addSentryInitWithSdkImport(js, { dsn });\n\n clack.log.success(\n `Added ${chalk.cyan('Sentry.init')} to ${chalk.cyan(jsRelativePath)}.`,\n );\n\n fs.writeFileSync(jsPath, newContent, 'utf-8');\n });\n\n Sentry.setTag('app-js-file-status', 'added-sentry-init');\n clack.log.success(\n chalk.green(`${chalk.cyan(jsRelativePath)} changes saved.`),\n );\n}\n\nasync function confirmFirstSentryException(\n url: string,\n orgSlug: string,\n projectId: string,\n) {\n const issuesStreamUrl = getIssueStreamUrl({ url, orgSlug, projectId });\n\n clack.log\n .step(`To make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n\nAfter that check your project issues:\n\n${chalk.cyan(issuesStreamUrl)}`);\n\n // We want the code snippet to be easily copy-pasteable, without any clack artifacts\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\n<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>\n`),\n );\n\n const firstErrorConfirmed = clack.confirm({\n message: `Have you successfully sent a test event?`,\n });\n\n return firstErrorConfirmed;\n}\n\nasync function patchXcodeFiles(\n config: RNCliSetupConfigContent,\n context: {\n sdkVersion: string | undefined;\n },\n) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'ios/sentry.properties',\n gitignore: false,\n });\n\n if (platform() === 'darwin' && (await confirmPodInstall())) {\n await traceStep('pod-install', () => podInstall('ios'));\n }\n\n const xcodeProjectPath = traceStep('find-xcode-project', () =>\n getFirstMatchedPath(XCODE_PROJECT),\n );\n Sentry.setTag(\n 'xcode-project-status',\n xcodeProjectPath ? 'found' : 'not-found',\n );\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.cyan(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const [xcodeProject, buildPhasesMap] = traceStep(\n 'parse-xcode-project',\n () => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const project = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n project.parseSync();\n\n const map = getValidExistingBuildPhases(project);\n return [project, map];\n },\n );\n Sentry.setTag('xcode-project-status', 'parsed');\n\n traceStep('patch-bundle-phase', () => {\n const bundlePhase = findBundlePhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-bundle-phase-status',\n bundlePhase ? 'found' : 'not-found',\n );\n if (\n context.sdkVersion &&\n fulfillsVersionRange({\n version: context.sdkVersion,\n acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n patchBundlePhase(\n bundlePhase,\n addSentryWithBundledScriptsToBundleShellScript,\n );\n } else {\n patchBundlePhase(bundlePhase, addSentryWithCliToBundleShellScript);\n }\n Sentry.setTag('xcode-bundle-phase-status', 'patched');\n });\n\n traceStep('add-debug-files-upload-phase', () => {\n const debugFilesUploadPhaseExists =\n !!findDebugFilesUploadPhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-debug-files-upload-phase-status',\n debugFilesUploadPhaseExists ? 'already-exists' : undefined,\n );\n if (\n context.sdkVersion &&\n fulfillsVersionRange({\n version: context.sdkVersion,\n acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n addDebugFilesUploadPhaseWithBundledScripts(xcodeProject, {\n debugFilesUploadPhaseExists,\n });\n } else {\n addDebugFilesUploadPhaseWithCli(xcodeProject, {\n debugFilesUploadPhaseExists,\n });\n }\n Sentry.setTag('xcode-debug-files-upload-phase-status', 'added');\n });\n\n traceStep('write-xcode-project', () => {\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n });\n Sentry.setTag('xcode-project-status', 'patched');\n}\n\nasync function patchAndroidFiles(config: RNCliSetupConfigContent) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'android/sentry.properties',\n gitignore: false,\n });\n\n const appBuildGradlePath = traceStep('find-app-build-gradle', () =>\n getFirstMatchedPath(APP_BUILD_GRADLE),\n );\n Sentry.setTag(\n 'app-build-gradle-status',\n appBuildGradlePath ? 'found' : 'not-found',\n );\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android ${chalk.cyan(\n 'app/build.gradle',\n )} file using ${chalk.cyan(APP_BUILD_GRADLE)}.`,\n );\n return;\n }\n\n const appBuildGradle = traceStep('read-app-build-gradle', () =>\n fs.readFileSync(appBuildGradlePath, 'utf-8'),\n );\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (includesSentry) {\n Sentry.setTag('app-build-gradle-status', 'already-includes-sentry');\n clack.log.warn(\n `Android ${chalk.cyan('app/build.gradle')} file already includes Sentry.`,\n );\n return;\n }\n\n const patchedAppBuildGradle = traceStep('add-rn-sentry-gradle-plugin', () =>\n addRNSentryGradlePlugin(appBuildGradle),\n );\n if (!doesAppBuildGradleIncludeRNSentryGradlePlugin(patchedAppBuildGradle)) {\n Sentry.setTag(\n 'app-build-gradle-status',\n 'failed-to-add-rn-sentry-gradle-plugin',\n );\n clack.log.warn(\n `Could not add Sentry RN Gradle Plugin to ${chalk.cyan(\n 'app/build.gradle',\n )}.`,\n );\n return;\n }\n\n Sentry.setTag('app-build-gradle-status', 'added-rn-sentry-gradle-plugin');\n clack.log.success(\n `Added Sentry RN Gradle Plugin to ${chalk.bold('app/build.gradle')}.`,\n );\n\n traceStep('write-app-build-gradle', () =>\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle),\n );\n clack.log.success(\n chalk.green(`Android ${chalk.cyan('app/build.gradle')} saved.`),\n );\n}\n\nasync function confirmPodInstall(): Promise<boolean> {\n return traceStep('confirm-pod-install', async () => {\n const continueWithPodInstall = await abortIfCancelled(\n clack.select({\n message: 'Do you want to run `pod install` now?',\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended for smaller projects, this might take several minutes',\n },\n { value: false, label: `No, I'll do it later` },\n ],\n initialValue: true,\n }),\n );\n Sentry.setTag('continue-with-pod-install', continueWithPodInstall);\n return continueWithPodInstall;\n });\n}\n"]}
@@ -71,6 +71,7 @@ var clack_utils_1 = require("../utils/clack-utils");
71
71
  var xcode_1 = require("./xcode");
72
72
  var glob_1 = require("./glob");
73
73
  var gradle_1 = require("./gradle");
74
+ var metro_1 = require("./metro");
74
75
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
75
76
  var xcode = require('xcode');
76
77
  function runReactNativeUninstall(options) {
@@ -85,6 +86,9 @@ function runReactNativeUninstall(options) {
85
86
  });
86
87
  return [4 /*yield*/, (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)()];
87
88
  case 1:
89
+ _a.sent();
90
+ return [4 /*yield*/, (0, metro_1.unPatchMetroConfig)()];
91
+ case 2:
88
92
  _a.sent();
89
93
  unPatchXcodeFiles();
90
94
  unPatchAndroidFiles();
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/react-native/uninstall.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAE1B,oDAG8B;AAC9B,iCAMiB;AACjB,+BAA8E;AAC9E,mCAIkB;AAGlB,mEAAmE;AACnE,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B,SAAsB,uBAAuB,CAC3C,OAAiC;;;;;oBAEjC,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,sCAAsC;wBAClD,OAAO,EAAE,gEAAgE;wBACzE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAE1C,iBAAiB,EAAE,CAAC;oBAEpB,mBAAmB,EAAE,CAAC;oBAEtB,iBAAK,CAAC,IAAI,CACR,mFAEC,eAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,kBAC9C,eAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,4CACT,eAAK,CAAC,IAAI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EAAC,cAAc,CAAC,CAAC;IAChE,IAAI,CAAC,cAAc,EAAE;QACnB,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAChE,OAAO;KACR;IAED,IAAM,qBAAqB,GAAG,IAAA,mCAA0B,EAAC,cAAc,CAAC,CAAC;IAEzE,IAAA,4BAAmB,EAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import * as fs from 'fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport {\n findBundlePhase,\n getValidExistingBuildPhases,\n unPatchBundlePhase,\n unPatchDebugFilesUploadPhase,\n writeXcodeProject,\n} from './xcode';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n removeRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { ReactNativeWizardOptions } from './options';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst xcode = require('xcode');\n\nexport async function runReactNativeUninstall(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry React Native Uninstall Wizard',\n message: 'This wizard will remove Sentry from your React Native project.',\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n unPatchXcodeFiles();\n\n unPatchAndroidFiles();\n\n clack.note(\n `To make sure your project builds after removing Sentry please run:\n\n1. ${chalk.bold('yarn remove @sentry/react-native')}\n2. ${chalk.bold('cd ios && pod install')}\n3. Remove all occurrences of ${chalk.bold(\n '@sentry/react-native',\n )} from your application code.`,\n );\n\n clack.outro(\n `${chalk.green('Uninstall is done!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n}\n\nfunction unPatchXcodeFiles() {\n const xcodeProjectPath = getFirstMatchedPath(XCODE_PROJECT);\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.bold(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const xcodeProject = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n xcodeProject.parseSync();\n const buildPhases = getValidExistingBuildPhases(xcodeProject);\n\n const bundlePhase = findBundlePhase(buildPhases);\n unPatchBundlePhase(bundlePhase);\n\n unPatchDebugFilesUploadPhase(xcodeProject);\n\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n}\n\nfunction unPatchAndroidFiles() {\n const appBuildGradlePath = getFirstMatchedPath(APP_BUILD_GRADLE);\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android app/build.gradle file using ${chalk.bold(\n APP_BUILD_GRADLE,\n )}.`,\n );\n return;\n }\n\n const appBuildGradle = fs.readFileSync(appBuildGradlePath, 'utf-8');\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (!includesSentry) {\n clack.log.warn(`Sentry not found in Android app/build.gradle.`);\n return;\n }\n\n const patchedAppBuildGradle = removeRNSentryGradlePlugin(appBuildGradle);\n\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle);\n}\n"]}
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/react-native/uninstall.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAE1B,oDAG8B;AAC9B,iCAMiB;AACjB,+BAA8E;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,mCAA2B,EAAC,YAAY,CAAC,CAAC;IAE9D,IAAM,WAAW,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IACjD,IAAA,0BAAkB,EAAC,WAAW,CAAC,CAAC;IAEhC,IAAA,oCAA4B,EAAC,YAAY,CAAC,CAAC;IAE3C,IAAA,yBAAiB,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,mBAAmB;IAC1B,IAAM,kBAAkB,GAAG,IAAA,0BAAmB,EAAC,uBAAgB,CAAC,CAAC;IACjE,IAAI,CAAC,kBAAkB,EAAE;QACvB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,6DAAsD,eAAK,CAAC,IAAI,CAC9D,uBAAgB,CACjB,MAAG,CACL,CAAC;QACF,OAAO;KACR;IAED,IAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACpE,IAAM,cAAc,GAClB,IAAA,sDAA6C,EAAC,cAAc,CAAC,CAAC;IAChE,IAAI,CAAC,cAAc,EAAE;QACnB,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAChE,OAAO;KACR;IAED,IAAM,qBAAqB,GAAG,IAAA,mCAA0B,EAAC,cAAc,CAAC,CAAC;IAEzE,IAAA,4BAAmB,EAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import * as fs from 'fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport {\n findBundlePhase,\n getValidExistingBuildPhases,\n unPatchBundlePhase,\n unPatchDebugFilesUploadPhase,\n writeXcodeProject,\n} from './xcode';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n removeRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { ReactNativeWizardOptions } from './options';\nimport { unPatchMetroConfig } from './metro';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst xcode = require('xcode');\n\nexport async function runReactNativeUninstall(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry React Native Uninstall Wizard',\n message: 'This wizard will remove Sentry from your React Native project.',\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n await unPatchMetroConfig();\n\n unPatchXcodeFiles();\n\n unPatchAndroidFiles();\n\n clack.note(\n `To make sure your project builds after removing Sentry please run:\n\n1. ${chalk.bold('yarn remove @sentry/react-native')}\n2. ${chalk.bold('cd ios && pod install')}\n3. Remove all occurrences of ${chalk.bold(\n '@sentry/react-native',\n )} from your application code.`,\n );\n\n clack.outro(\n `${chalk.green('Uninstall is done!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n}\n\nfunction unPatchXcodeFiles() {\n const xcodeProjectPath = getFirstMatchedPath(XCODE_PROJECT);\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.bold(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const xcodeProject = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n xcodeProject.parseSync();\n const buildPhases = getValidExistingBuildPhases(xcodeProject);\n\n const bundlePhase = findBundlePhase(buildPhases);\n unPatchBundlePhase(bundlePhase);\n\n unPatchDebugFilesUploadPhase(xcodeProject);\n\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n}\n\nfunction unPatchAndroidFiles() {\n const appBuildGradlePath = getFirstMatchedPath(APP_BUILD_GRADLE);\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android app/build.gradle file using ${chalk.bold(\n APP_BUILD_GRADLE,\n )}.`,\n );\n return;\n }\n\n const appBuildGradle = fs.readFileSync(appBuildGradlePath, 'utf-8');\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (!includesSentry) {\n clack.log.warn(`Sentry not found in Android app/build.gradle.`);\n return;\n }\n\n const patchedAppBuildGradle = removeRNSentryGradlePlugin(appBuildGradle);\n\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle);\n}\n"]}
@@ -3,13 +3,17 @@ type BuildPhase = {
3
3
  };
4
4
  type BuildPhaseMap = Record<string, BuildPhase>;
5
5
  export declare function getValidExistingBuildPhases(xcodeProject: any): BuildPhaseMap;
6
- export declare function patchBundlePhase(bundlePhase: BuildPhase | undefined): void;
6
+ export declare function patchBundlePhase(bundlePhase: BuildPhase | undefined, patch: (script: string) => string): void;
7
7
  export declare function unPatchBundlePhase(bundlePhase: BuildPhase | undefined): void;
8
8
  export declare function removeSentryFromBundleShellScript(script: string): string;
9
9
  export declare function findBundlePhase(buildPhases: BuildPhaseMap): BuildPhase | undefined;
10
10
  export declare function doesBundlePhaseIncludeSentry(buildPhase: BuildPhase): boolean;
11
- export declare function addSentryToBundleShellScript(script: string): string;
12
- export declare function addDebugFilesUploadPhase(xcodeProject: any, { debugFilesUploadPhaseExists }: {
11
+ export declare function addSentryWithBundledScriptsToBundleShellScript(script: string): string;
12
+ export declare function addSentryWithCliToBundleShellScript(script: string): string;
13
+ export declare function addDebugFilesUploadPhaseWithBundledScripts(xcodeProject: any, { debugFilesUploadPhaseExists }: {
14
+ debugFilesUploadPhaseExists: boolean;
15
+ }): void;
16
+ export declare function addDebugFilesUploadPhaseWithCli(xcodeProject: any, { debugFilesUploadPhaseExists }: {
13
17
  debugFilesUploadPhaseExists: boolean;
14
18
  }): void;
15
19
  export declare function unPatchDebugFilesUploadPhase(xcodeProject: any): void;
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.writeXcodeProject = exports.findDebugFilesUploadPhase = exports.unPatchDebugFilesUploadPhase = exports.addDebugFilesUploadPhase = exports.addSentryToBundleShellScript = exports.doesBundlePhaseIncludeSentry = exports.findBundlePhase = exports.removeSentryFromBundleShellScript = exports.unPatchBundlePhase = exports.patchBundlePhase = exports.getValidExistingBuildPhases = void 0;
29
+ exports.writeXcodeProject = exports.findDebugFilesUploadPhase = exports.unPatchDebugFilesUploadPhase = exports.addDebugFilesUploadPhaseWithCli = exports.addDebugFilesUploadPhaseWithBundledScripts = exports.addSentryWithCliToBundleShellScript = exports.addSentryWithBundledScriptsToBundleShellScript = exports.doesBundlePhaseIncludeSentry = exports.findBundlePhase = exports.removeSentryFromBundleShellScript = exports.unPatchBundlePhase = exports.patchBundlePhase = exports.getValidExistingBuildPhases = void 0;
30
30
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
31
31
  /* eslint-disable @typescript-eslint/no-unsafe-call */
32
32
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
@@ -45,7 +45,7 @@ function getValidExistingBuildPhases(xcodeProject) {
45
45
  return map;
46
46
  }
47
47
  exports.getValidExistingBuildPhases = getValidExistingBuildPhases;
48
- function patchBundlePhase(bundlePhase) {
48
+ function patchBundlePhase(bundlePhase, patch) {
49
49
  if (!bundlePhase) {
50
50
  prompts_1.default.log.warn("Could not find ".concat(chalk_1.default.cyan('Bundle React Native code and images'), " build phase."));
51
51
  return;
@@ -56,7 +56,7 @@ function patchBundlePhase(bundlePhase) {
56
56
  return;
57
57
  }
58
58
  var script = JSON.parse(bundlePhase.shellScript);
59
- bundlePhase.shellScript = JSON.stringify(addSentryToBundleShellScript(script));
59
+ bundlePhase.shellScript = JSON.stringify(patch(script));
60
60
  prompts_1.default.log.success("Patched Build phase ".concat(chalk_1.default.cyan('Bundle React Native code and images'), "."));
61
61
  }
62
62
  exports.patchBundlePhase = patchBundlePhase;
@@ -65,7 +65,8 @@ function unPatchBundlePhase(bundlePhase) {
65
65
  prompts_1.default.log.warn("Could not find ".concat(chalk_1.default.cyan('Bundle React Native code and images'), " build phase."));
66
66
  return;
67
67
  }
68
- if (!bundlePhase.shellScript.match(/sentry-cli\s+react-native\s+xcode/i)) {
68
+ if (!bundlePhase.shellScript.match(/sentry-cli\s+react-native\s+xcode/i) &&
69
+ !bundlePhase.shellScript.includes('sentry-xcode.sh')) {
69
70
  prompts_1.default.log.success("Build phase ".concat(chalk_1.default.cyan('Bundle React Native code and images'), " does not include Sentry."));
70
71
  return;
71
72
  }
@@ -81,7 +82,12 @@ function removeSentryFromBundleShellScript(script) {
81
82
  // unwrap react-native-xcode.sh command. In case someone replaced it
82
83
  // entirely with the sentry-cli command we need to put the original
83
84
  // version back in.
84
- .replace(/\.\.\/node_modules\/@sentry\/cli\/bin\/sentry-cli\s+react-native\s+xcode\s+\$REACT_NATIVE_XCODE/i, '$REACT_NATIVE_XCODE'));
85
+ .replace(/\.\.\/node_modules\/@sentry\/cli\/bin\/sentry-cli\s+react-native\s+xcode\s+\$REACT_NATIVE_XCODE/i, '$REACT_NATIVE_XCODE')
86
+ .replace(
87
+ // eslint-disable-next-line no-useless-escape
88
+ /\"\/bin\/sh.*?sentry-xcode.sh\s+\$REACT_NATIVE_XCODE/i,
89
+ // eslint-disable-next-line no-useless-escape
90
+ '"$REACT_NATIVE_XCODE'));
85
91
  }
86
92
  exports.removeSentryFromBundleShellScript = removeSentryFromBundleShellScript;
87
93
  function findBundlePhase(buildPhases) {
@@ -91,10 +97,18 @@ function findBundlePhase(buildPhases) {
91
97
  }
92
98
  exports.findBundlePhase = findBundlePhase;
93
99
  function doesBundlePhaseIncludeSentry(buildPhase) {
94
- return !!buildPhase.shellScript.match(/sentry-cli\s+react-native\s+xcode/i);
100
+ var containsSentryCliRNCommand = !!buildPhase.shellScript.match(/sentry-cli\s+react-native\s+xcode/i);
101
+ var containsBundledScript = buildPhase.shellScript.includes('sentry-xcode.sh');
102
+ return containsSentryCliRNCommand || containsBundledScript;
95
103
  }
96
104
  exports.doesBundlePhaseIncludeSentry = doesBundlePhaseIncludeSentry;
97
- function addSentryToBundleShellScript(script) {
105
+ function addSentryWithBundledScriptsToBundleShellScript(script) {
106
+ return script.replace('$REACT_NATIVE_XCODE',
107
+ // eslint-disable-next-line no-useless-escape
108
+ '\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\"');
109
+ }
110
+ exports.addSentryWithBundledScriptsToBundleShellScript = addSentryWithBundledScriptsToBundleShellScript;
111
+ function addSentryWithCliToBundleShellScript(script) {
98
112
  return ('export SENTRY_PROPERTIES=sentry.properties\n' +
99
113
  'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' +
100
114
  script.replace('$REACT_NATIVE_XCODE', function () {
@@ -103,8 +117,23 @@ function addSentryToBundleShellScript(script) {
103
117
  }) +
104
118
  '\n/bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"\n');
105
119
  }
106
- exports.addSentryToBundleShellScript = addSentryToBundleShellScript;
107
- function addDebugFilesUploadPhase(
120
+ exports.addSentryWithCliToBundleShellScript = addSentryWithCliToBundleShellScript;
121
+ function addDebugFilesUploadPhaseWithBundledScripts(
122
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
+ xcodeProject, _a) {
124
+ var debugFilesUploadPhaseExists = _a.debugFilesUploadPhaseExists;
125
+ if (debugFilesUploadPhaseExists) {
126
+ prompts_1.default.log.warn("Build phase ".concat(chalk_1.default.cyan('Upload Debug Symbols to Sentry'), " already exists."));
127
+ return;
128
+ }
129
+ xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
130
+ shellPath: '/bin/sh',
131
+ shellScript: "/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh",
132
+ });
133
+ prompts_1.default.log.success("Added Build phase ".concat(chalk_1.default.cyan('Upload Debug Symbols to Sentry'), "."));
134
+ }
135
+ exports.addDebugFilesUploadPhaseWithBundledScripts = addDebugFilesUploadPhaseWithBundledScripts;
136
+ function addDebugFilesUploadPhaseWithCli(
108
137
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
138
  xcodeProject, _a) {
110
139
  var debugFilesUploadPhaseExists = _a.debugFilesUploadPhaseExists;
@@ -118,7 +147,7 @@ xcodeProject, _a) {
118
147
  });
119
148
  prompts_1.default.log.success("Added Build phase ".concat(chalk_1.default.cyan('Upload Debug Symbols to Sentry'), "."));
120
149
  }
121
- exports.addDebugFilesUploadPhase = addDebugFilesUploadPhase;
150
+ exports.addDebugFilesUploadPhaseWithCli = addDebugFilesUploadPhaseWithCli;
122
151
  function unPatchDebugFilesUploadPhase(
123
152
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
153
  xcodeProject) {
@@ -151,8 +180,11 @@ exports.unPatchDebugFilesUploadPhase = unPatchDebugFilesUploadPhase;
151
180
  function findDebugFilesUploadPhase(buildPhasesMap) {
152
181
  return Object.entries(buildPhasesMap).find(function (_a) {
153
182
  var _ = _a[0], buildPhase = _a[1];
154
- return typeof buildPhase !== 'string' &&
183
+ var containsCliDebugUpload = typeof buildPhase !== 'string' &&
155
184
  !!buildPhase.shellScript.match(/sentry-cli\s+(upload-dsym|debug-files upload)\b/);
185
+ var containsBundledDebugUpload = typeof buildPhase !== 'string' &&
186
+ buildPhase.shellScript.includes('sentry-xcode-debug-files.sh');
187
+ return containsCliDebugUpload || containsBundledDebugUpload;
156
188
  });
157
189
  }
158
190
  exports.findDebugFilesUploadPhase = findDebugFilesUploadPhase;