@sentry/wizard 3.37.0 → 3.39.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 (57) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/dist/e2e-tests/tests/nextjs.test.js +1 -1
  4. package/dist/e2e-tests/tests/nextjs.test.js.map +1 -1
  5. package/dist/e2e-tests/tests/nuxt-3.test.js +1 -1
  6. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  7. package/dist/e2e-tests/tests/nuxt-4.test.js +1 -1
  8. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  9. package/dist/e2e-tests/tests/remix.test.js +1 -2
  10. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  11. package/dist/e2e-tests/tests/sveltekit.test.js +17 -5
  12. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  13. package/dist/e2e-tests/utils/index.d.ts +12 -2
  14. package/dist/e2e-tests/utils/index.js +23 -3
  15. package/dist/e2e-tests/utils/index.js.map +1 -1
  16. package/dist/package.json +2 -2
  17. package/dist/src/nextjs/nextjs-wizard.js +3 -1
  18. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  19. package/dist/src/nuxt/nuxt-wizard.js +1 -0
  20. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  21. package/dist/src/nuxt/sdk-setup.js +1 -0
  22. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  23. package/dist/src/react-native/javascript.js +1 -1
  24. package/dist/src/react-native/javascript.js.map +1 -1
  25. package/dist/src/react-native/react-native-wizard.d.ts +5 -4
  26. package/dist/src/react-native/react-native-wizard.js +65 -41
  27. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  28. package/dist/src/sourcemaps/sourcemaps-wizard.js +2 -3
  29. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  30. package/dist/src/telemetry.d.ts +2 -1
  31. package/dist/src/telemetry.js +1 -1
  32. package/dist/src/telemetry.js.map +1 -1
  33. package/dist/src/utils/clack-utils.js +3 -3
  34. package/dist/src/utils/clack-utils.js.map +1 -1
  35. package/dist/src/utils/package-manager.d.ts +0 -1
  36. package/dist/src/utils/package-manager.js +9 -10
  37. package/dist/src/utils/package-manager.js.map +1 -1
  38. package/dist/test/react-native/javascript.test.js +1 -1
  39. package/dist/test/react-native/javascript.test.js.map +1 -1
  40. package/e2e-tests/test-applications/nextjs-test-app/package.json +1 -1
  41. package/e2e-tests/tests/nextjs.test.ts +1 -1
  42. package/e2e-tests/tests/nuxt-3.test.ts +1 -1
  43. package/e2e-tests/tests/nuxt-4.test.ts +1 -1
  44. package/e2e-tests/tests/remix.test.ts +30 -19
  45. package/e2e-tests/tests/sveltekit.test.ts +79 -50
  46. package/e2e-tests/utils/index.ts +33 -6
  47. package/package.json +2 -2
  48. package/src/nextjs/nextjs-wizard.ts +4 -1
  49. package/src/nuxt/nuxt-wizard.ts +1 -0
  50. package/src/nuxt/sdk-setup.ts +2 -0
  51. package/src/react-native/javascript.ts +1 -1
  52. package/src/react-native/react-native-wizard.ts +32 -12
  53. package/src/sourcemaps/sourcemaps-wizard.ts +3 -7
  54. package/src/telemetry.ts +6 -2
  55. package/src/utils/clack-utils.ts +4 -3
  56. package/src/utils/package-manager.ts +8 -11
  57. package/test/react-native/javascript.test.ts +1 -1
@@ -61,24 +61,27 @@ app.all(
61
61
  app.listen(0, () => console.log('Express server listening'));
62
62
  `;
63
63
 
64
-
65
- async function runWizardOnRemixProject(projectDir: string, integration: Integration, fileModificationFn?: (projectDir: string, integration: Integration) => unknown) {
64
+ async function runWizardOnRemixProject(
65
+ projectDir: string,
66
+ integration: Integration,
67
+ fileModificationFn?: (
68
+ projectDir: string,
69
+ integration: Integration,
70
+ ) => unknown,
71
+ ) {
66
72
  const wizardInstance = startWizardInstance(integration, projectDir);
67
73
  let packageManagerPrompted = false;
68
74
 
69
75
  if (fileModificationFn) {
70
76
  fileModificationFn(projectDir, integration);
71
77
 
72
- await wizardInstance.waitForOutput(
73
- 'Do you want to continue anyway?',
74
- );
78
+ await wizardInstance.waitForOutput('Do you want to continue anyway?');
75
79
 
76
80
  packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(
77
81
  [KEYS.ENTER],
78
82
  'Please select your package manager.',
79
83
  );
80
84
  } else {
81
-
82
85
  packageManagerPrompted = await wizardInstance.waitForOutput(
83
86
  'Please select your package manager.',
84
87
  );
@@ -119,12 +122,16 @@ async function runWizardOnRemixProject(projectDir: string, integration: Integrat
119
122
  );
120
123
 
121
124
  wizardInstance.kill();
122
- };
125
+ }
123
126
 
124
- function checkRemixProject(projectDir: string, integration: Integration, options?: {
125
- devModeExpectedOutput?: string;
126
- prodModeExpectedOutput?: string;
127
- }) {
127
+ function checkRemixProject(
128
+ projectDir: string,
129
+ integration: Integration,
130
+ options?: {
131
+ devModeExpectedOutput?: string;
132
+ prodModeExpectedOutput?: string;
133
+ },
134
+ ) {
128
135
  test('package.json is updated correctly', () => {
129
136
  checkPackageJson(projectDir, integration);
130
137
  });
@@ -195,15 +202,21 @@ function checkRemixProject(projectDir: string, integration: Integration, options
195
202
  });
196
203
 
197
204
  test('builds successfully', async () => {
198
- await checkIfBuilds(projectDir, 'built');
205
+ await checkIfBuilds(projectDir);
199
206
  });
200
207
 
201
208
  test('runs on dev mode correctly', async () => {
202
- await checkIfRunsOnDevMode(projectDir, options?.devModeExpectedOutput || 'to expose');
209
+ await checkIfRunsOnDevMode(
210
+ projectDir,
211
+ options?.devModeExpectedOutput || 'to expose',
212
+ );
203
213
  });
204
214
 
205
215
  test('runs on prod mode correctly', async () => {
206
- await checkIfRunsOnProdMode(projectDir, options?.prodModeExpectedOutput || '[remix-serve]');
216
+ await checkIfRunsOnProdMode(
217
+ projectDir,
218
+ options?.prodModeExpectedOutput || '[remix-serve]',
219
+ );
207
220
  });
208
221
  }
209
222
 
@@ -236,13 +249,11 @@ describe('Remix', () => {
236
249
 
237
250
  beforeAll(async () => {
238
251
  await runWizardOnRemixProject(projectDir, integration, (projectDir) => {
239
- createFile(
240
- `${projectDir}/server.mjs`,
241
- SERVER_TEMPLATE,
242
- );
252
+ createFile(`${projectDir}/server.mjs`, SERVER_TEMPLATE);
243
253
 
244
254
  modifyFile(`${projectDir}/package.json`, {
245
- '"start": "remix-serve ./build/server/index.js"': '"start": "node ./server.mjs"',
255
+ '"start": "remix-serve ./build/server/index.js"':
256
+ '"start": "node ./server.mjs"',
246
257
  '"dev": "remix vite:dev"': '"dev": "node ./server.mjs"',
247
258
  });
248
259
  });
@@ -41,7 +41,14 @@ export async function handleError({ error, event }) {
41
41
  }
42
42
  `;
43
43
 
44
- async function runWizardOnSvelteKitProject(projectDir: string, integration: Integration, fileModificationFn?: (projectDir: string, integration: Integration) => unknown) {
44
+ async function runWizardOnSvelteKitProject(
45
+ projectDir: string,
46
+ integration: Integration,
47
+ fileModificationFn?: (
48
+ projectDir: string,
49
+ integration: Integration,
50
+ ) => unknown,
51
+ ) {
45
52
  const wizardInstance = startWizardInstance(integration, projectDir);
46
53
  let packageManagerPrompted = false;
47
54
 
@@ -49,9 +56,7 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
49
56
  fileModificationFn(projectDir, integration);
50
57
 
51
58
  // As we modified project, we have a warning prompt before we get the package manager prompt
52
- await wizardInstance.waitForOutput(
53
- 'Do you want to continue anyway?',
54
- );
59
+ await wizardInstance.waitForOutput('Do you want to continue anyway?');
55
60
 
56
61
  packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(
57
62
  [KEYS.ENTER],
@@ -59,7 +64,7 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
59
64
  );
60
65
  } else {
61
66
  packageManagerPrompted = await wizardInstance.waitForOutput(
62
- 'Please select your package manager'
67
+ 'Please select your package manager',
63
68
  );
64
69
  }
65
70
 
@@ -72,7 +77,7 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
72
77
  'to track the performance of your application?',
73
78
  {
74
79
  timeout: 240_000,
75
- }
80
+ },
76
81
  ));
77
82
 
78
83
  const replayOptionPrompted =
@@ -100,10 +105,14 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
100
105
  wizardInstance.kill();
101
106
  }
102
107
 
103
- function checkSvelteKitProject(projectDir: string, integration: Integration, options?: {
104
- devModeExpectedOutput: string;
105
- prodModeExpectedOutput: string;
106
- }) {
108
+ function checkSvelteKitProject(
109
+ projectDir: string,
110
+ integration: Integration,
111
+ options?: {
112
+ devModeExpectedOutput: string;
113
+ prodModeExpectedOutput: string;
114
+ },
115
+ ) {
107
116
  test('should have the correct package.json', () => {
108
117
  checkPackageJson(projectDir, integration);
109
118
  });
@@ -113,14 +122,21 @@ function checkSvelteKitProject(projectDir: string, integration: Integration, opt
113
122
  });
114
123
 
115
124
  test('example page exists', () => {
116
- checkFileExists(path.resolve(projectDir, 'src/routes/sentry-example/+page.svelte'));
117
- checkFileExists(path.resolve(projectDir, 'src/routes/sentry-example/+server.js'));
125
+ checkFileExists(
126
+ path.resolve(projectDir, 'src/routes/sentry-example/+page.svelte'),
127
+ );
128
+ checkFileExists(
129
+ path.resolve(projectDir, 'src/routes/sentry-example/+server.js'),
130
+ );
118
131
  });
119
132
 
120
133
  test('vite.config contains sentry plugin', () => {
121
- checkFileContents(path.resolve(projectDir, 'vite.config.ts'), `plugins: [sentrySvelteKit({
134
+ checkFileContents(
135
+ path.resolve(projectDir, 'vite.config.ts'),
136
+ `plugins: [sentrySvelteKit({
122
137
  sourceMapsUploadOptions: {
123
- `);
138
+ `,
139
+ );
124
140
  });
125
141
 
126
142
  test('hook files created', () => {
@@ -129,15 +145,22 @@ function checkSvelteKitProject(projectDir: string, integration: Integration, opt
129
145
  });
130
146
 
131
147
  test('builds successfully', async () => {
132
- await checkIfBuilds(projectDir, 'Successfully uploaded source maps to Sentry');
148
+ await checkIfBuilds(projectDir);
133
149
  });
134
150
 
135
151
  test('runs on dev mode correctly', async () => {
136
- await checkIfRunsOnDevMode(projectDir, options?.devModeExpectedOutput || 'ready in');
152
+ await checkIfRunsOnDevMode(
153
+ projectDir,
154
+ options?.devModeExpectedOutput || 'ready in',
155
+ );
137
156
  });
138
157
 
139
158
  test('runs on prod mode correctly', async () => {
140
- await checkIfRunsOnProdMode(projectDir, options?.prodModeExpectedOutput || 'to expose', 'preview');
159
+ await checkIfRunsOnProdMode(
160
+ projectDir,
161
+ options?.prodModeExpectedOutput || 'to expose',
162
+ 'preview',
163
+ );
141
164
  });
142
165
  }
143
166
 
@@ -161,10 +184,9 @@ describe('Sveltekit', () => {
161
184
  checkSvelteKitProject(projectDir, integration);
162
185
 
163
186
  test('hooks.client.ts contains sentry', () => {
164
- checkFileContents(
165
- path.resolve(projectDir, 'src/hooks.client.ts'),
166
- [`import * as Sentry from '@sentry/sveltekit';`,
167
- `Sentry.init({
187
+ checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [
188
+ `import * as Sentry from '@sentry/sveltekit';`,
189
+ `Sentry.init({
168
190
  dsn: '${TEST_ARGS.PROJECT_DSN}',
169
191
 
170
192
  tracesSampleRate: 1.0,
@@ -179,22 +201,24 @@ describe('Sveltekit', () => {
179
201
 
180
202
  // If you don't want to use Session Replay, just remove the line below:
181
203
  integrations: [replayIntegration()],
182
- });`, 'export const handleError = handleErrorWithSentry(']);
204
+ });`,
205
+ 'export const handleError = handleErrorWithSentry(',
206
+ ]);
183
207
  });
184
208
 
185
209
  test('hooks.server.ts contains sentry', () => {
186
- checkFileContents(
187
- path.resolve(projectDir, 'src/hooks.server.ts'),
188
- [
189
- `import * as Sentry from '@sentry/sveltekit';`,
190
- `Sentry.init({
210
+ checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [
211
+ `import * as Sentry from '@sentry/sveltekit';`,
212
+ `Sentry.init({
191
213
  dsn: '${TEST_ARGS.PROJECT_DSN}',
192
214
 
193
215
  tracesSampleRate: 1.0,
194
216
 
195
217
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
196
218
  // spotlight: import.meta.env.DEV,
197
- });`, 'export const handleError = handleErrorWithSentry();']);
219
+ });`,
220
+ 'export const handleError = handleErrorWithSentry();',
221
+ ]);
198
222
  });
199
223
  });
200
224
 
@@ -206,17 +230,21 @@ describe('Sveltekit', () => {
206
230
  );
207
231
 
208
232
  beforeAll(async () => {
209
- await runWizardOnSvelteKitProject(projectDir, integration, (projectDir) => {
210
- createFile(
211
- path.resolve(projectDir, 'src/hooks.server.ts'),
212
- SERVER_HOOK_TEMPLATE,
213
- )
214
-
215
- createFile(
216
- path.resolve(projectDir, 'src/hooks.client.ts'),
217
- CLIENT_HOOK_TEMPLATE,
218
- )
219
- });
233
+ await runWizardOnSvelteKitProject(
234
+ projectDir,
235
+ integration,
236
+ (projectDir) => {
237
+ createFile(
238
+ path.resolve(projectDir, 'src/hooks.server.ts'),
239
+ SERVER_HOOK_TEMPLATE,
240
+ );
241
+
242
+ createFile(
243
+ path.resolve(projectDir, 'src/hooks.client.ts'),
244
+ CLIENT_HOOK_TEMPLATE,
245
+ );
246
+ },
247
+ );
220
248
  });
221
249
 
222
250
  afterAll(() => {
@@ -229,27 +257,28 @@ describe('Sveltekit', () => {
229
257
  // These are removed from the common tests as the content is different
230
258
  // when the hooks are merged instead of created from the template
231
259
  test('hooks.client.ts contains sentry instrumentation', () => {
232
- checkFileContents(
233
- path.resolve(projectDir, 'src/hooks.client.ts'),
234
- [`import * as Sentry from '@sentry/sveltekit';`,
235
- `Sentry.init({
260
+ checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [
261
+ `import * as Sentry from '@sentry/sveltekit';`,
262
+ `Sentry.init({
236
263
  dsn: "${TEST_ARGS.PROJECT_DSN}",
237
264
  tracesSampleRate: 1,
238
265
  replaysSessionSampleRate: 0.1,
239
266
  replaysOnErrorSampleRate: 1,
240
267
  integrations: [Sentry.replayIntegration()]
241
- })`, 'export const handleError = Sentry.handleErrorWithSentry(']);
268
+ })`,
269
+ 'export const handleError = Sentry.handleErrorWithSentry(',
270
+ ]);
242
271
  });
243
272
 
244
273
  test('hooks.server.ts contains sentry init', () => {
245
- checkFileContents(
246
- path.resolve(projectDir, 'src/hooks.server.ts'),
247
- [`import * as Sentry from '@sentry/sveltekit';`,
248
- `Sentry.init({
274
+ checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [
275
+ `import * as Sentry from '@sentry/sveltekit';`,
276
+ `Sentry.init({
249
277
  dsn: "${TEST_ARGS.PROJECT_DSN}",
250
278
  tracesSampleRate: 1
251
- })`, 'export const handleError = Sentry.handleErrorWithSentry();']);
279
+ })`,
280
+ 'export const handleError = Sentry.handleErrorWithSentry();',
281
+ ]);
252
282
  });
253
283
  });
254
284
  });
255
-
@@ -80,6 +80,36 @@ export class WizardTestEnv {
80
80
  return outputPromise;
81
81
  }
82
82
 
83
+ /**
84
+ * Waits for the task to exit with a given `statusCode`.
85
+ *
86
+ * @returns a promise that resolves to `true` if the run ends with the status
87
+ * code, or it rejects when the `timeout` was reached.
88
+ */
89
+ waitForStatusCode(
90
+ statusCode: number | null,
91
+ options: {
92
+ /** Timeout in ms */
93
+ timeout?: number;
94
+ } = {},
95
+ ) {
96
+ const { timeout } = {
97
+ timeout: 60_000,
98
+ ...options,
99
+ };
100
+
101
+ return new Promise<boolean>((resolve, reject) => {
102
+ const timeoutId = setTimeout(() => {
103
+ reject(new Error(`Timeout waiting for status code: ${statusCode}`));
104
+ }, timeout);
105
+
106
+ this.taskHandle.on('exit', (code: number | null) => {
107
+ clearTimeout(timeoutId);
108
+ resolve(code === statusCode);
109
+ });
110
+ });
111
+ }
112
+
83
113
  /**
84
114
  * Waits for the provided output with `.includes()` logic.
85
115
  *
@@ -318,19 +348,16 @@ export function checkEnvBuildPlugin(projectDir: string) {
318
348
  }
319
349
 
320
350
  /**
321
- * Check if the project builds
351
+ * Check if the project builds and ends with status code 0.
322
352
  * @param projectDir
323
353
  */
324
- export async function checkIfBuilds(
325
- projectDir: string,
326
- expectedOutput: string,
327
- ) {
354
+ export async function checkIfBuilds(projectDir: string) {
328
355
  const testEnv = new WizardTestEnv('npm', ['run', 'build'], {
329
356
  cwd: projectDir,
330
357
  });
331
358
 
332
359
  await expect(
333
- testEnv.waitForOutput(expectedOutput, {
360
+ testEnv.waitForStatusCode(0, {
334
361
  timeout: 120_000,
335
362
  }),
336
363
  ).resolves.toBe(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.37.0",
3
+ "version": "3.39.0",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",
@@ -29,7 +29,7 @@
29
29
  "@sentry/node": "^7.119.2",
30
30
  "axios": "1.7.4",
31
31
  "chalk": "^2.4.1",
32
- "glob": "^8.1.0",
32
+ "glob": "9.3.5",
33
33
  "inquirer": "^6.2.0",
34
34
  "lodash": "^4.17.15",
35
35
  "magicast": "^0.2.10",
@@ -926,7 +926,7 @@ async function createExamplePage(
926
926
  * It's valuable enough to for users to justify asking the additional question.
927
927
  */
928
928
  async function askShouldSetTunnelRoute() {
929
- return await traceStep('ask-tunnelRoute-option', async () => {
929
+ return await traceStep('ask-tunnelRoute-option', async (span) => {
930
930
  const shouldSetTunnelRoute = await abortIfCancelled(
931
931
  clack.select({
932
932
  message:
@@ -953,6 +953,9 @@ async function askShouldSetTunnelRoute() {
953
953
  );
954
954
  }
955
955
 
956
+ span?.setAttribute('tunnelRoute', shouldSetTunnelRoute);
957
+ Sentry.setTag('tunnelRoute', shouldSetTunnelRoute);
958
+
956
959
  return shouldSetTunnelRoute;
957
960
  });
958
961
  }
@@ -119,6 +119,7 @@ export async function runNuxtWizardWithTelemetry(
119
119
  };
120
120
 
121
121
  const deploymentPlatform = await askDeploymentPlatform();
122
+ Sentry.setTag('deployment-platform', deploymentPlatform);
122
123
 
123
124
  await traceStep('configure-sdk', async () => {
124
125
  await addSDKModule(nuxtConfig, projectData, deploymentPlatform);
@@ -337,6 +337,8 @@ export async function confirmReadImportDocs(
337
337
  clack.confirm({ message: 'Do you want to open the docs?' }),
338
338
  );
339
339
 
340
+ Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);
341
+
340
342
  if (shouldOpenDocs) {
341
343
  opn(docsUrl, { wait: false }).catch(() => {
342
344
  // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
@@ -98,6 +98,6 @@ Sentry.init({
98
98
  dsn: '${dsn}',
99
99
 
100
100
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
101
- // enableSpotlight: __DEV__,
101
+ // spotlight: __DEV__,
102
102
  });`;
103
103
  }
@@ -17,6 +17,7 @@ import {
17
17
  printWelcome,
18
18
  propertiesCliSetupConfig,
19
19
  runPrettierIfInstalled,
20
+ abort,
20
21
  } from '../utils/clack-utils';
21
22
  import { getPackageVersion, hasPackageInstalled } from '../utils/package-json';
22
23
  import { podInstall } from '../apple/cocoapod';
@@ -57,6 +58,7 @@ import { addExpoEnvLocal } from './expo-env-file';
57
58
  const xcode = require('xcode');
58
59
 
59
60
  export const RN_SDK_PACKAGE = '@sentry/react-native';
61
+ export const RN_SDK_SUPPORTED_RANGE = '>=5.0.0';
60
62
 
61
63
  export const RN_PACKAGE = 'react-native';
62
64
  export const RN_HUMAN_NAME = 'React Native';
@@ -68,21 +70,20 @@ export const SUPPORTED_EXPO_RANGE = '>=50.0.0';
68
70
  * The following SDK version ship with bundled Xcode scripts
69
71
  * which simplifies the Xcode Build Phases setup.
70
72
  */
71
- export const SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = '>=5.11.0';
73
+ export const XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = '>=5.11.0';
72
74
 
73
75
  /**
74
76
  * The following SDK version ship with Sentry Metro plugin
75
77
  */
76
- export const SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = '>=5.11.0';
78
+ export const SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = '>=5.11.0';
77
79
 
78
80
  /**
79
81
  * The following SDK version ship with bundled Expo plugin
80
82
  */
81
- export const SDK_EXPO_SUPPORTED_SDK_RANGE = `>=5.16.0`;
83
+ export const EXPO_SUPPORTED_SDK_RANGE = `>=5.16.0`;
82
84
 
83
85
  // The following SDK version shipped `withSentryConfig`
84
- export const SDK_SENTRY_METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE =
85
- '>=5.17.0';
86
+ export const METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE = '>=5.17.0';
86
87
 
87
88
  export type RNCliSetupConfigContent = Pick<
88
89
  Required<CliSetupConfigContent>,
@@ -151,6 +152,26 @@ Or setup using ${chalk.cyan(
151
152
  RN_SDK_PACKAGE,
152
153
  await getPackageDotJson(),
153
154
  );
155
+ if (sdkVersion) {
156
+ await confirmContinueIfPackageVersionNotSupported({
157
+ packageName: 'Sentry React Native SDK',
158
+ packageVersion: sdkVersion,
159
+ packageId: RN_SDK_PACKAGE,
160
+ acceptableVersions: RN_SDK_SUPPORTED_RANGE,
161
+ note: `Please upgrade to ${RN_SDK_SUPPORTED_RANGE} to continue with the wizard in this project.`,
162
+ });
163
+ } else {
164
+ const continueWithoutSdk = await abortIfCancelled(
165
+ clack.confirm({
166
+ message:
167
+ 'Could not detect Sentry React Native SDK version. Do you want to continue anyway?',
168
+ }),
169
+ );
170
+ if (!continueWithoutSdk) {
171
+ await abort(undefined, 0);
172
+ }
173
+ }
174
+ Sentry.setTag(`detected-sentry-react-native-sdk-version`, sdkVersion);
154
175
 
155
176
  const expoVersion = getPackageVersion('expo', packageJson);
156
177
  const isExpo = !!expoVersion;
@@ -159,8 +180,8 @@ Or setup using ${chalk.cyan(
159
180
  packageName: 'Sentry React Native SDK',
160
181
  packageVersion: sdkVersion,
161
182
  packageId: RN_SDK_PACKAGE,
162
- acceptableVersions: SDK_EXPO_SUPPORTED_SDK_RANGE,
163
- note: `Please upgrade to ${SDK_EXPO_SUPPORTED_SDK_RANGE} to continue with the wizard in this Expo project.`,
183
+ acceptableVersions: EXPO_SUPPORTED_SDK_RANGE,
184
+ note: `Please upgrade to ${EXPO_SUPPORTED_SDK_RANGE} to continue with the wizard in this Expo project.`,
164
185
  });
165
186
  await confirmContinueIfPackageVersionNotSupported({
166
187
  packageName: 'Expo SDK',
@@ -250,8 +271,7 @@ function addSentryToMetroConfig({
250
271
  sdkVersion &&
251
272
  fulfillsVersionRange({
252
273
  version: sdkVersion,
253
- acceptableVersions:
254
- SDK_SENTRY_METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE,
274
+ acceptableVersions: METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE,
255
275
  canBeLatest: true,
256
276
  })
257
277
  ) {
@@ -262,7 +282,7 @@ function addSentryToMetroConfig({
262
282
  sdkVersion &&
263
283
  fulfillsVersionRange({
264
284
  version: sdkVersion,
265
- acceptableVersions: SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE,
285
+ acceptableVersions: SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE,
266
286
  canBeLatest: true,
267
287
  })
268
288
  ) {
@@ -356,7 +376,7 @@ async function patchXcodeFiles(
356
376
  context.sdkVersion &&
357
377
  fulfillsVersionRange({
358
378
  version: context.sdkVersion,
359
- acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,
379
+ acceptableVersions: XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,
360
380
  canBeLatest: true,
361
381
  })
362
382
  ) {
@@ -381,7 +401,7 @@ async function patchXcodeFiles(
381
401
  context.sdkVersion &&
382
402
  fulfillsVersionRange({
383
403
  version: context.sdkVersion,
384
- acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,
404
+ acceptableVersions: XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,
385
405
  canBeLatest: true,
386
406
  })
387
407
  ) {
@@ -267,13 +267,9 @@ export async function configureCI(
267
267
  'create-react-app',
268
268
  ].includes(selectedTool);
269
269
 
270
- // some non-cli-based flows also use the .sentryclirc file
271
- const usesSentryCliRc = selectedTool === 'nextjs';
272
-
273
- const authTokenFile =
274
- isCliBasedFlowTool || usesSentryCliRc
275
- ? SENTRY_CLI_RC_FILE
276
- : SENTRY_DOT_ENV_FILE;
270
+ const authTokenFile = isCliBasedFlowTool
271
+ ? SENTRY_CLI_RC_FILE
272
+ : SENTRY_DOT_ENV_FILE;
277
273
 
278
274
  if (!isUsingCI) {
279
275
  clack.log.info(
package/src/telemetry.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  setTag,
10
10
  startSpan,
11
11
  flush,
12
+ Span,
12
13
  } from '@sentry/node';
13
14
  import packageJson from '../package.json';
14
15
  import { WizardOptions } from './utils/types';
@@ -110,9 +111,12 @@ function createSentryInstance(enabled: boolean, integration: string) {
110
111
  return { sentryHub: hub, sentryClient: client };
111
112
  }
112
113
 
113
- export function traceStep<T>(step: string, callback: () => T): T {
114
+ export function traceStep<T>(
115
+ step: string,
116
+ callback: (span: Span | undefined) => T,
117
+ ): T {
114
118
  updateProgress(step);
115
- return startSpan({ name: step, op: 'wizard.step' }, () => callback());
119
+ return startSpan({ name: step, op: 'wizard.step' }, (span) => callback(span));
116
120
  }
117
121
 
118
122
  export function updateProgress(step: string) {
@@ -1096,9 +1096,10 @@ async function askForWizardLogin(options: {
1096
1096
 
1097
1097
  if (!hasSentryAccount) {
1098
1098
  loginUrl.searchParams.set('signup', '1');
1099
- if (options.platform) {
1100
- loginUrl.searchParams.set('project_platform', options.platform);
1101
- }
1099
+ }
1100
+
1101
+ if (options.platform) {
1102
+ loginUrl.searchParams.set('project_platform', options.platform);
1102
1103
  }
1103
1104
 
1104
1105
  if (options.promoCode) {