Skip to content

Commit 40f62ce

Browse files
author
Luca Forstner
authored
feat(nextjs): Remove react component annotation prompt and insertion (#858)
1 parent b561268 commit 40f62ce

File tree

6 files changed

+4
-111
lines changed

6 files changed

+4
-111
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- feat(nextjs): Remove react component annotation prompt and insertion ([#858](https://github.com/getsentry/sentry-wizard/pull/858))
56
- Prevent addition of multiple `sentry:sourcemaps` commands ([#840](https://github.com/getsentry/sentry-wizard/pull/840))
67

78
## 4.4.0

e2e-tests/tests/nextjs-14.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,8 @@ describe('NextJS-14', () => {
4141
},
4242
));
4343

44-
const reactComponentAnnotationsPrompted =
45-
routeThroughNextJsPrompted &&
46-
(await wizardInstance.sendStdinAndWaitForOutput(
47-
[KEYS.ENTER],
48-
'Do you want to enable React component annotations',
49-
));
50-
5144
const tracingOptionPrompted =
52-
reactComponentAnnotationsPrompted &&
45+
routeThroughNextJsPrompted &&
5346
(await wizardInstance.sendStdinAndWaitForOutput(
5447
[KEYS.ENTER],
5548
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.

e2e-tests/tests/nextjs-15.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,8 @@ describe('NextJS-15', () => {
4141
},
4242
));
4343

44-
const reactComponentAnnotationsPrompted =
45-
routeThroughNextJsPrompted &&
46-
(await wizardInstance.sendStdinAndWaitForOutput(
47-
[KEYS.ENTER],
48-
'Do you want to enable React component annotations',
49-
));
50-
5144
const tracingOptionPrompted =
52-
reactComponentAnnotationsPrompted &&
45+
routeThroughNextJsPrompted &&
5346
(await wizardInstance.sendStdinAndWaitForOutput(
5447
[KEYS.ENTER],
5548
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.

src/nextjs/nextjs-wizard.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ export async function runNextjsWizardWithTelemetry(
103103

104104
await traceStep('configure-sdk', async () => {
105105
const tunnelRoute = await askShouldSetTunnelRoute();
106-
const reactComponentAnnotation =
107-
await askShouldEnableReactComponentAnnotation();
108106

109107
await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {
110108
tunnelRoute,
111-
reactComponentAnnotation,
112109
});
113110
});
114111

@@ -362,7 +359,6 @@ ${chalk.dim(
362359

363360
type SDKConfigOptions = {
364361
tunnelRoute: boolean;
365-
reactComponentAnnotation: boolean;
366362
};
367363

368364
async function createOrMergeNextJsFiles(
@@ -551,7 +547,6 @@ async function createOrMergeNextJsFiles(
551547
selfHosted,
552548
sentryUrl,
553549
tunnelRoute: sdkConfigOptions.tunnelRoute,
554-
reactComponentAnnotation: sdkConfigOptions.reactComponentAnnotation,
555550
});
556551

557552
const nextConfigPossibleFilesMap = {
@@ -964,32 +959,6 @@ async function askShouldSetTunnelRoute() {
964959
});
965960
}
966961

967-
async function askShouldEnableReactComponentAnnotation() {
968-
return await traceStep('ask-react-component-annotation-option', async () => {
969-
const shouldEnableReactComponentAnnotation = await abortIfCancelled(
970-
clack.select({
971-
message:
972-
'Do you want to enable React component annotations to make breadcrumbs and session replays more readable?',
973-
options: [
974-
{
975-
label: 'Yes',
976-
value: true,
977-
hint: 'Annotates React component names - increases bundle size',
978-
},
979-
{
980-
label: 'No',
981-
value: false,
982-
hint: 'Continue without React component annotations',
983-
},
984-
],
985-
initialValue: true,
986-
}),
987-
);
988-
989-
return shouldEnableReactComponentAnnotation;
990-
});
991-
}
992-
993962
/**
994963
* Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.
995964
*/

src/nextjs/templates.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ type WithSentryConfigOptions = {
77
selfHosted: boolean;
88
sentryUrl: string;
99
tunnelRoute: boolean;
10-
reactComponentAnnotation: boolean;
1110
};
1211

1312
export function getWithSentryConfigOptionsTemplate({
1413
orgSlug,
1514
projectSlug,
1615
selfHosted,
1716
tunnelRoute,
18-
reactComponentAnnotation,
1917
sentryUrl,
2018
}: WithSentryConfigOptions): string {
2119
return `{
@@ -34,15 +32,7 @@ export function getWithSentryConfigOptionsTemplate({
3432
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
3533
3634
// Upload a larger set of source maps for prettier stack traces (increases build time)
37-
widenClientFileUpload: true,${
38-
reactComponentAnnotation
39-
? `\n
40-
// Automatically annotate React components to show their full name in breadcrumbs and session replay
41-
reactComponentAnnotation: {
42-
enabled: true,
43-
},`
44-
: ''
45-
}
35+
widenClientFileUpload: true,
4636
4737
// ${
4838
tunnelRoute ? 'Route' : 'Uncomment to route'

test/nextjs/templates.test.ts

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ describe('Next.js code templates', () => {
247247
selfHosted: false,
248248
sentryUrl: 'https://dont-use-this-url.com',
249249
tunnelRoute: true,
250-
reactComponentAnnotation: false,
251250
});
252251

253252
expect(template).toMatchInlineSnapshot(`
@@ -292,7 +291,6 @@ describe('Next.js code templates', () => {
292291
selfHosted: true,
293292
sentryUrl: 'https://my-sentry.com',
294293
tunnelRoute: true,
295-
reactComponentAnnotation: false,
296294
});
297295

298296
expect(template).toMatchInlineSnapshot(`
@@ -338,7 +336,6 @@ describe('Next.js code templates', () => {
338336
selfHosted: false,
339337
sentryUrl: 'https://dont-use-this-url.com',
340338
tunnelRoute: false,
341-
reactComponentAnnotation: false,
342339
});
343340

344341
expect(template).toMatchInlineSnapshot(`
@@ -375,55 +372,5 @@ describe('Next.js code templates', () => {
375372
}"
376373
`);
377374
});
378-
379-
it('adds `reactComponentAnnotations` option if `reactComponentAnnotations` is enabled', () => {
380-
const template = getWithSentryConfigOptionsTemplate({
381-
orgSlug: 'my-org',
382-
projectSlug: 'my-project',
383-
selfHosted: false,
384-
sentryUrl: 'https://dont-use-this-url.com',
385-
tunnelRoute: true,
386-
reactComponentAnnotation: true,
387-
});
388-
389-
expect(template).toMatchInlineSnapshot(`
390-
"{
391-
// For all available options, see:
392-
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
393-
394-
org: "my-org",
395-
project: "my-project",
396-
397-
// Only print logs for uploading source maps in CI
398-
silent: !process.env.CI,
399-
400-
// For all available options, see:
401-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
402-
403-
// Upload a larger set of source maps for prettier stack traces (increases build time)
404-
widenClientFileUpload: true,
405-
406-
// Automatically annotate React components to show their full name in breadcrumbs and session replay
407-
reactComponentAnnotation: {
408-
enabled: true,
409-
},
410-
411-
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
412-
// This can increase your server load as well as your hosting bill.
413-
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
414-
// side errors will fail.
415-
tunnelRoute: "/monitoring",
416-
417-
// Automatically tree-shake Sentry logger statements to reduce bundle size
418-
disableLogger: true,
419-
420-
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
421-
// See the following for more information:
422-
// https://docs.sentry.io/product/crons/
423-
// https://vercel.com/docs/cron-jobs
424-
automaticVercelMonitors: true,
425-
}"
426-
`);
427-
});
428375
});
429376
});

0 commit comments

Comments
 (0)