@sentry/wizard 6.12.0 → 6.13.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.
- package/CHANGELOG.md +15 -0
- package/dist/bin.js +16 -1
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/angular-17.test.js +3 -4
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +3 -4
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +60 -0
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +8 -3
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -3
- package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +4 -4
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router.test.js +3 -6
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -4
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +6 -3
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +2 -2
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/android/android-wizard.js +3 -0
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +1 -1
- package/dist/src/angular/codemods/main.js +0 -1
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +2 -3
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -1
- package/dist/src/apple/check-installed-cli.js +13 -7
- package/dist/src/apple/check-installed-cli.js.map +1 -1
- package/dist/src/apple/configure-xcode-project.js +8 -1
- package/dist/src/apple/configure-xcode-project.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
- package/dist/src/apple/lookup-xcode-project.js +22 -17
- package/dist/src/apple/lookup-xcode-project.js.map +1 -1
- package/dist/src/apple/options.d.ts +5 -0
- package/dist/src/apple/options.js.map +1 -1
- package/dist/src/apple/sentry-swift-package.d.ts +4 -0
- package/dist/src/apple/sentry-swift-package.js +17 -0
- package/dist/src/apple/sentry-swift-package.js.map +1 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +59 -1
- package/dist/src/apple/xcode-manager.js +507 -106
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +3 -0
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +12 -6
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +12 -6
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
- package/dist/src/react-router/codemods/client.entry.js +93 -52
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/codemods/server-entry.js +8 -7
- package/dist/src/react-router/codemods/server-entry.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +13 -19
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +2 -2
- package/dist/src/react-router/sdk-setup.js +16 -15
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/react-router/templates.d.ts +1 -3
- package/dist/src/react-router/templates.js +24 -92
- package/dist/src/react-router/templates.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -2
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +4 -1
- package/dist/src/run.js +13 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/templates.js +12 -6
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +2 -1
- package/dist/src/utils/clack/index.js +17 -6
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/files.d.ts +2 -0
- package/dist/src/utils/files.js +58 -0
- package/dist/src/utils/files.js.map +1 -0
- package/dist/src/utils/git.d.ts +3 -1
- package/dist/src/utils/git.js +2 -1
- package/dist/src/utils/git.js.map +1 -1
- package/dist/src/utils/line-endings.d.ts +1 -0
- package/dist/src/utils/line-endings.js +76 -0
- package/dist/src/utils/line-endings.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +0 -5
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/lookup-xcode-project.test.js +167 -0
- package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
- package/dist/test/apple/xcode-manager.test.js +452 -43
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/constants.test.d.ts +1 -0
- package/dist/test/constants.test.js +12 -0
- package/dist/test/constants.test.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +66 -33
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +66 -36
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-router/codemods/client-entry.test.js +15 -11
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/server-entry.test.js +21 -8
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +46 -10
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/react-router/templates.test.js +26 -64
- package/dist/test/react-router/templates.test.js.map +1 -1
- package/dist/test/remix/build-script.test.d.ts +1 -0
- package/dist/test/remix/build-script.test.js +124 -0
- package/dist/test/remix/build-script.test.js.map +1 -0
- package/dist/test/remix/client-entry.test.js +4 -10
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/run.test.d.ts +1 -0
- package/dist/test/run.test.js +137 -0
- package/dist/test/run.test.js.map +1 -0
- package/dist/test/sveltekit/templates.test.js +78 -27
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +101 -0
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/git.test.js +10 -0
- package/dist/test/utils/git.test.js.map +1 -1
- package/dist/test/utils/line-endings.test.d.ts +1 -0
- package/dist/test/utils/line-endings.test.js +103 -0
- package/dist/test/utils/line-endings.test.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/react-router/codemods/root.d.ts +0 -1
- package/dist/src/react-router/codemods/root.js +0 -170
- package/dist/src/react-router/codemods/root.js.map +0 -1
- package/dist/test/react-router/codemods/root.test.js +0 -182
- package/dist/test/react-router/codemods/root.test.js.map +0 -1
- /package/dist/test/{react-router/codemods/root.test.d.ts → apple/lookup-xcode-project.test.d.ts} +0 -0
|
@@ -1,45 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getManualViteConfigContent = exports.getManualReactRouterConfigContent = exports.getManualServerInstrumentContent = exports.
|
|
3
|
+
exports.getManualViteConfigContent = exports.getManualReactRouterConfigContent = exports.getManualServerInstrumentContent = exports.getManualHandleRequestContent = exports.getManualServerEntryContent = exports.getManualClientEntryContent = exports.getSentryInstrumentationServerContent = exports.EXAMPLE_PAGE_TEMPLATE_JSX = exports.EXAMPLE_PAGE_TEMPLATE_TSX = void 0;
|
|
4
4
|
const clack_1 = require("../utils/clack");
|
|
5
|
-
function generateErrorBoundaryTemplate(isTypeScript, forManualInstructions = false) {
|
|
6
|
-
const typeAnnotations = isTypeScript
|
|
7
|
-
? { stack: ': string | undefined', props: ': Route.ErrorBoundaryProps' }
|
|
8
|
-
: { stack: '', props: '' };
|
|
9
|
-
const commentLine = forManualInstructions
|
|
10
|
-
? '// you only want to capture non 404-errors that reach the boundary\n '
|
|
11
|
-
: '// Only capture non-404 errors (all errors here are already non-RouteErrorResponse)\n ';
|
|
12
|
-
return `function ErrorBoundary({ error }${typeAnnotations.props}) {
|
|
13
|
-
let message = "Oops!";
|
|
14
|
-
let details = "An unexpected error occurred.";
|
|
15
|
-
let stack${typeAnnotations.stack};
|
|
16
|
-
|
|
17
|
-
if (isRouteErrorResponse(error)) {
|
|
18
|
-
message = error.status === 404 ? "404" : "Error";
|
|
19
|
-
details =
|
|
20
|
-
error.status === 404
|
|
21
|
-
? "The requested page could not be found."
|
|
22
|
-
: error.statusText || details;
|
|
23
|
-
} else if (error && error instanceof Error) {
|
|
24
|
-
${commentLine}Sentry.captureException(error);
|
|
25
|
-
details = error.message;
|
|
26
|
-
stack = error.stack;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<main>
|
|
31
|
-
<h1>{message}</h1>
|
|
32
|
-
<p>{details}</p>
|
|
33
|
-
{stack && (
|
|
34
|
-
<pre>
|
|
35
|
-
<code>{stack}</code>
|
|
36
|
-
</pre>
|
|
37
|
-
)}
|
|
38
|
-
</main>
|
|
39
|
-
);
|
|
40
|
-
}`;
|
|
41
|
-
}
|
|
42
|
-
exports.ERROR_BOUNDARY_TEMPLATE = generateErrorBoundaryTemplate(false);
|
|
43
5
|
exports.EXAMPLE_PAGE_TEMPLATE_TSX = `import type { Route } from "./+types/sentry-example-page";
|
|
44
6
|
|
|
45
7
|
export async function loader() {
|
|
@@ -64,9 +26,12 @@ function generateServerInstrumentationCode(dsn, enableTracing, enableProfiling,
|
|
|
64
26
|
Sentry.init({
|
|
65
27
|
dsn: "${dsn}",
|
|
66
28
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
29
|
+
dataCollection: {
|
|
30
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
31
|
+
// https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection
|
|
32
|
+
// userInfo: false,
|
|
33
|
+
// httpBodies: [],
|
|
34
|
+
},${enableLogs
|
|
70
35
|
? '\n\n // Enable logs to be sent to Sentry\n enableLogs: true,'
|
|
71
36
|
: ''}${enableProfiling ? '\n\n integrations: [nodeProfilingIntegration()],' : ''}
|
|
72
37
|
tracesSampleRate: ${enableTracing ? '1.0' : '0'}, ${enableTracing ? '// Capture 100% of the transactions' : ''}${enableProfiling
|
|
@@ -92,7 +57,7 @@ const getSentryInstrumentationServerContent = (dsn, enableTracing, enableProfili
|
|
|
92
57
|
return generateServerInstrumentationCode(dsn, enableTracing, enableProfiling, enableLogs);
|
|
93
58
|
};
|
|
94
59
|
exports.getSentryInstrumentationServerContent = getSentryInstrumentationServerContent;
|
|
95
|
-
const getManualClientEntryContent = (dsn, enableTracing, enableReplay, enableLogs, useInstrumentationAPI = false) => {
|
|
60
|
+
const getManualClientEntryContent = (dsn, enableTracing, enableReplay, enableLogs, useInstrumentationAPI = false, useOnError = false) => {
|
|
96
61
|
if (useInstrumentationAPI && enableTracing) {
|
|
97
62
|
const integrations = ['tracing'];
|
|
98
63
|
if (enableReplay) {
|
|
@@ -104,14 +69,17 @@ import { startTransition, StrictMode } from 'react';
|
|
|
104
69
|
import { hydrateRoot } from 'react-dom/client';
|
|
105
70
|
import { HydratedRouter } from 'react-router/dom';
|
|
106
71
|
|
|
107
|
-
${plus(`const tracing = Sentry.reactRouterTracingIntegration(
|
|
72
|
+
${plus(`const tracing = Sentry.reactRouterTracingIntegration();`)}
|
|
108
73
|
|
|
109
74
|
${plus(`Sentry.init({
|
|
110
75
|
dsn: "${dsn}",
|
|
111
76
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
77
|
+
dataCollection: {
|
|
78
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
79
|
+
// https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection
|
|
80
|
+
// userInfo: false,
|
|
81
|
+
// httpBodies: [],
|
|
82
|
+
},
|
|
115
83
|
|
|
116
84
|
integrations: [
|
|
117
85
|
${integrationsStr}
|
|
@@ -132,7 +100,7 @@ startTransition(() => {
|
|
|
132
100
|
hydrateRoot(
|
|
133
101
|
document,
|
|
134
102
|
<StrictMode>
|
|
135
|
-
${plus(
|
|
103
|
+
${plus(`<HydratedRouter${useOnError ? ' onError={Sentry.sentryOnError}' : ''} instrumentations={[tracing.clientInstrumentation]} />`)}
|
|
136
104
|
</StrictMode>
|
|
137
105
|
);
|
|
138
106
|
});`));
|
|
@@ -153,9 +121,12 @@ import { HydratedRouter } from 'react-router/dom';
|
|
|
153
121
|
${plus(`Sentry.init({
|
|
154
122
|
dsn: "${dsn}",
|
|
155
123
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
124
|
+
dataCollection: {
|
|
125
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
126
|
+
// https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection
|
|
127
|
+
// userInfo: false,
|
|
128
|
+
// httpBodies: [],
|
|
129
|
+
},
|
|
159
130
|
|
|
160
131
|
integrations: [
|
|
161
132
|
${integrationsStr}
|
|
@@ -174,7 +145,7 @@ startTransition(() => {
|
|
|
174
145
|
hydrateRoot(
|
|
175
146
|
document,
|
|
176
147
|
<StrictMode>
|
|
177
|
-
|
|
148
|
+
${plus(`<HydratedRouter${useOnError ? ' onError={Sentry.sentryOnError}' : ''} />`)}
|
|
178
149
|
</StrictMode>
|
|
179
150
|
);
|
|
180
151
|
});`));
|
|
@@ -200,7 +171,7 @@ ${plus(`export const handleError = Sentry.createSentryHandleError({
|
|
|
200
171
|
});`)}
|
|
201
172
|
|
|
202
173
|
${plus(`// Enable automatic server-side instrumentation for loaders, actions, middleware
|
|
203
|
-
export const
|
|
174
|
+
export const instrumentations = [Sentry.createSentryServerInstrumentation()];`)}
|
|
204
175
|
|
|
205
176
|
// ... rest of your server entry`));
|
|
206
177
|
}
|
|
@@ -243,45 +214,6 @@ ${plus(`// If you have a custom handleRequest implementation, wrap it like this:
|
|
|
243
214
|
export default handleRequest;`));
|
|
244
215
|
};
|
|
245
216
|
exports.getManualHandleRequestContent = getManualHandleRequestContent;
|
|
246
|
-
const getManualRootContent = (isTs) => {
|
|
247
|
-
const typeAnnotations = isTs
|
|
248
|
-
? { stack: ': string | undefined', props: ': Route.ErrorBoundaryProps' }
|
|
249
|
-
: { stack: '', props: '' };
|
|
250
|
-
return (0, clack_1.makeCodeSnippet)(true, (unchanged, plus) => unchanged(`${plus("import * as Sentry from '@sentry/react-router';")}
|
|
251
|
-
|
|
252
|
-
export function ErrorBoundary({ error }${typeAnnotations.props}) {
|
|
253
|
-
let message = "Oops!";
|
|
254
|
-
let details = "An unexpected error occurred.";
|
|
255
|
-
let stack${typeAnnotations.stack};
|
|
256
|
-
|
|
257
|
-
if (isRouteErrorResponse(error)) {
|
|
258
|
-
message = error.status === 404 ? "404" : "Error";
|
|
259
|
-
details =
|
|
260
|
-
error.status === 404
|
|
261
|
-
? "The requested page could not be found."
|
|
262
|
-
: error.statusText || details;
|
|
263
|
-
} else if (error && error instanceof Error) {
|
|
264
|
-
// you only want to capture non 404-errors that reach the boundary
|
|
265
|
-
${plus('Sentry.captureException(error);')}
|
|
266
|
-
details = error.message;
|
|
267
|
-
stack = error.stack;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return (
|
|
271
|
-
<main>
|
|
272
|
-
<h1>{message}</h1>
|
|
273
|
-
<p>{details}</p>
|
|
274
|
-
{stack && (
|
|
275
|
-
<pre>
|
|
276
|
-
<code>{stack}</code>
|
|
277
|
-
</pre>
|
|
278
|
-
)}
|
|
279
|
-
</main>
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
// ...`));
|
|
283
|
-
};
|
|
284
|
-
exports.getManualRootContent = getManualRootContent;
|
|
285
217
|
const getManualServerInstrumentContent = (dsn, enableTracing, enableProfiling, enableLogs = false) => {
|
|
286
218
|
return (0, clack_1.makeCodeSnippet)(true, (unchanged, plus) => plus(generateServerInstrumentationCode(dsn, enableTracing, enableProfiling, enableLogs)));
|
|
287
219
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/react-router/templates.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;A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,CAAC,CAAC;AAhBW,QAAA,gCAAgC,oCAgB3C;AAEK,MAAM,iCAAiC,GAAG,CAAC,IAAI,GAAG,IAAI,EAAE,EAAE;IAC/D,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAC/C,IAAI;QACF,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CACf,yDAAyD,CAC1D;EACP,IAAI,CAAC,0DAA0D,CAAC;;;IAG9D,IAAI,CAAC,YAAY,CAAC;IAClB,IAAI,CAAC;;KAEJ,CAAC;;;;;;;KAOD,CAAC;QACA,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CACf,0DAA0D,CAC3D;;;IAGL,IAAI,CAAC,YAAY,CAAC;IAClB,IAAI,CAAC;;KAEJ,CAAC;;;;;;;KAOD,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,iCAAiC,qCAqC5C;AAEK,MAAM,0BAA0B,GAAG,CACxC,OAAe,EACf,WAAmB,EACnB,EAAE;IACF,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAC/C,SAAS,CAAC,GAAG,IAAI,CACf,2DAA2D,CAC5D;;;;;;;QAOG,IAAI,CAAC;gBACG,OAAO;oBACH,WAAW;;kBAEb,CAAC;;MAEb,IAAI,CAAC;;OAEJ,CAAC;;IAEJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,0BAA0B,8BA0BrC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack';\n\nfunction generateErrorBoundaryTemplate(\n isTypeScript: boolean,\n forManualInstructions = false,\n): string {\n const typeAnnotations = isTypeScript\n ? { stack: ': string | undefined', props: ': Route.ErrorBoundaryProps' }\n : { stack: '', props: '' };\n\n const commentLine = forManualInstructions\n ? '// you only want to capture non 404-errors that reach the boundary\\n '\n : '// Only capture non-404 errors (all errors here are already non-RouteErrorResponse)\\n ';\n\n return `function ErrorBoundary({ error }${typeAnnotations.props}) {\n let message = \"Oops!\";\n let details = \"An unexpected error occurred.\";\n let stack${typeAnnotations.stack};\n\n if (isRouteErrorResponse(error)) {\n message = error.status === 404 ? \"404\" : \"Error\";\n details =\n error.status === 404\n ? \"The requested page could not be found.\"\n : error.statusText || details;\n } else if (error && error instanceof Error) {\n ${commentLine}Sentry.captureException(error);\n details = error.message;\n stack = error.stack;\n }\n\n return (\n <main>\n <h1>{message}</h1>\n <p>{details}</p>\n {stack && (\n <pre>\n <code>{stack}</code>\n </pre>\n )}\n </main>\n );\n}`;\n}\n\nexport const ERROR_BOUNDARY_TEMPLATE = generateErrorBoundaryTemplate(false);\n\nexport const EXAMPLE_PAGE_TEMPLATE_TSX = `import type { Route } from \"./+types/sentry-example-page\";\n\nexport async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nexport const EXAMPLE_PAGE_TEMPLATE_JSX = `export async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nfunction generateServerInstrumentationCode(\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs: boolean,\n): string {\n return `import * as Sentry from '@sentry/react-router';${\n enableProfiling\n ? `\\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';`\n : ''\n }\n\nSentry.init({\n dsn: \"${dsn}\",\n\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#sendDefaultPii\n sendDefaultPii: true,${\n enableLogs\n ? '\\n\\n // Enable logs to be sent to Sentry\\n enableLogs: true,'\n : ''\n }${enableProfiling ? '\\n\\n integrations: [nodeProfilingIntegration()],' : ''}\n tracesSampleRate: ${enableTracing ? '1.0' : '0'}, ${\n enableTracing ? '// Capture 100% of the transactions' : ''\n }${\n enableProfiling\n ? '\\n profilesSampleRate: 1.0, // profile every transaction'\n : ''\n }${\n enableTracing\n ? `\n\n // Set up performance monitoring\n beforeSend(event) {\n // Filter out 404s from error reporting\n if (event.exception) {\n const error = event.exception.values?.[0];\n if (error?.type === \"NotFoundException\" || error?.value?.includes(\"404\")) {\n return null;\n }\n }\n return event;\n },`\n : ''\n }\n});`;\n}\n\nexport const getSentryInstrumentationServerContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling = false,\n enableLogs = false,\n) => {\n return generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n};\n\nexport const getManualClientEntryContent = (\n dsn: string,\n enableTracing: boolean,\n enableReplay: boolean,\n enableLogs: boolean,\n useInstrumentationAPI = false,\n) => {\n if (useInstrumentationAPI && enableTracing) {\n const integrations = ['tracing'];\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr = integrations.join(',\\n ');\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(\n `const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });`,\n)}\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: 1.0, // Capture 100% of the transactions\n\n // Set \\`tracePropagationTargets\\` to declare which URL(s) should have trace propagation enabled\n // In production, replace \"yourserver.io\" with your actual backend domain\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n }\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n ${plus(\n '<HydratedRouter unstable_instrumentations={[tracing.clientInstrumentation]} />',\n )}\n </StrictMode>\n );\n});`),\n );\n }\n\n const integrations = [];\n\n if (enableTracing) {\n integrations.push('Sentry.reactRouterTracingIntegration()');\n }\n\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr =\n integrations.length > 0 ? integrations.join(',\\n ') : '';\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: ${enableTracing ? '1.0' : '0'},${\n enableTracing ? ' // Capture 100% of the transactions' : ''\n}${\n enableTracing\n ? '\\n\\n // Set `tracePropagationTargets` to declare which URL(s) should have trace propagation enabled\\n // In production, replace \"yourserver.io\" with your actual backend domain\\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],'\n : ''\n}${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n}\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n <HydratedRouter />\n </StrictMode>\n );\n});`),\n );\n};\n\nexport const getManualServerEntryContent = (useInstrumentationAPI = false) => {\n if (useInstrumentationAPI) {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n${plus(`// Enable automatic server-side instrumentation for loaders, actions, middleware\nexport const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];`)}\n\n// ... rest of your server entry`),\n );\n }\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n// ... rest of your server entry`),\n );\n};\n\nexport const getManualHandleRequestContent = () => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`// Replace your existing handleRequest function with this Sentry-wrapped version:\nconst handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\n${plus(`// If you have a custom handleRequest implementation, wrap it like this:\n// export default Sentry.wrapSentryHandleRequest(yourCustomHandleRequest);`)}\n\nexport default handleRequest;`),\n );\n};\n\nexport const getManualRootContent = (isTs: boolean) => {\n const typeAnnotations = isTs\n ? { stack: ': string | undefined', props: ': Route.ErrorBoundaryProps' }\n : { stack: '', props: '' };\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\n\nexport function ErrorBoundary({ error }${typeAnnotations.props}) {\n let message = \"Oops!\";\n let details = \"An unexpected error occurred.\";\n let stack${typeAnnotations.stack};\n\n if (isRouteErrorResponse(error)) {\n message = error.status === 404 ? \"404\" : \"Error\";\n details =\n error.status === 404\n ? \"The requested page could not be found.\"\n : error.statusText || details;\n } else if (error && error instanceof Error) {\n // you only want to capture non 404-errors that reach the boundary\n ${plus('Sentry.captureException(error);')}\n details = error.message;\n stack = error.stack;\n }\n\n return (\n <main>\n <h1>{message}</h1>\n <p>{details}</p>\n {stack && (\n <pre>\n <code>{stack}</code>\n </pre>\n )}\n </main>\n );\n}\n// ...`),\n );\n};\n\nexport const getManualServerInstrumentContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs = false,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n plus(\n generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n ),\n ),\n );\n};\n\nexport const getManualReactRouterConfigContent = (isTS = true) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n isTS\n ? unchanged(`${plus(\n 'import type { Config } from \"@react-router/dev/config\";',\n )}\n${plus(\"import { sentryOnBuildEnd } from '@sentry/react-router';\")}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n} satisfies Config;\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`)\n : unchanged(`${plus(\n \"import { sentryOnBuildEnd } from '@sentry/react-router';\",\n )}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n};\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`),\n );\n};\n\nexport const getManualViteConfigContent = (\n orgSlug: string,\n projectSlug: string,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\n \"import { sentryReactRouter } from '@sentry/react-router';\",\n )}\nimport { defineConfig } from 'vite';\n\nexport default defineConfig(config => {\n return {\n plugins: [\n // ... your existing plugins\n ${plus(`sentryReactRouter({\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",\n authToken: process.env.SENTRY_AUTH_TOKEN,\n }, config),`)}\n ],\n ${plus(`optimizeDeps: {\n exclude: ['@sentry/react-router'],\n },`)}\n };\n});`),\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/react-router/templates.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEpC,QAAA,yBAAyB,GAAG;;;;;;;;EAQvC,CAAC;AAEU,QAAA,yBAAyB,GAAG;;;;;;EAMvC,CAAC;AAEH,SAAS,iCAAiC,CACxC,GAAW,EACX,aAAsB,EACtB,eAAwB,EACxB,UAAmB;IAEnB,OAAO,kDACL,eAAe;QACb,CAAC,CAAC,sEAAsE;QACxE,CAAC,CAAC,EACN;;;UAGQ,GAAG;;;;;;;MAQT,UAAU;QACR,CAAC,CAAC,gEAAgE;QAClE,CAAC,CAAC,EACN,GAAG,eAAe,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC,CAAC,EAAE;sBACzD,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAC7C,a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Ae,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAC/C,IAAI;QACF,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CACf,yDAAyD,CAC1D;EACP,IAAI,CAAC,0DAA0D,CAAC;;;IAG9D,IAAI,CAAC,YAAY,CAAC;IAClB,IAAI,CAAC;;KAEJ,CAAC;;;;;;;KAOD,CAAC;QACA,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CACf,0DAA0D,CAC3D;;;IAGL,IAAI,CAAC,YAAY,CAAC;IAClB,IAAI,CAAC;;KAEJ,CAAC;;;;;;;KAOD,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,iCAAiC,qCAqC5C;AAEK,MAAM,0BAA0B,GAAG,CACxC,OAAe,EACf,WAAmB,EACnB,EAAE;IACF,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAC/C,SAAS,CAAC,GAAG,IAAI,CACf,2DAA2D,CAC5D;;;;;;;QAOG,IAAI,CAAC;gBACG,OAAO;oBACH,WAAW;;kBAEb,CAAC;;MAEb,IAAI,CAAC;;OAEJ,CAAC;;IAEJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,0BAA0B,8BA0BrC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack';\n\nexport const EXAMPLE_PAGE_TEMPLATE_TSX = `import type { Route } from \"./+types/sentry-example-page\";\n\nexport async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nexport const EXAMPLE_PAGE_TEMPLATE_JSX = `export async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nfunction generateServerInstrumentationCode(\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs: boolean,\n): string {\n return `import * as Sentry from '@sentry/react-router';${\n enableProfiling\n ? `\\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';`\n : ''\n }\n\nSentry.init({\n dsn: \"${dsn}\",\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },${\n enableLogs\n ? '\\n\\n // Enable logs to be sent to Sentry\\n enableLogs: true,'\n : ''\n }${enableProfiling ? '\\n\\n integrations: [nodeProfilingIntegration()],' : ''}\n tracesSampleRate: ${enableTracing ? '1.0' : '0'}, ${\n enableTracing ? '// Capture 100% of the transactions' : ''\n }${\n enableProfiling\n ? '\\n profilesSampleRate: 1.0, // profile every transaction'\n : ''\n }${\n enableTracing\n ? `\n\n // Set up performance monitoring\n beforeSend(event) {\n // Filter out 404s from error reporting\n if (event.exception) {\n const error = event.exception.values?.[0];\n if (error?.type === \"NotFoundException\" || error?.value?.includes(\"404\")) {\n return null;\n }\n }\n return event;\n },`\n : ''\n }\n});`;\n}\n\nexport const getSentryInstrumentationServerContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling = false,\n enableLogs = false,\n) => {\n return generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n};\n\nexport const getManualClientEntryContent = (\n dsn: string,\n enableTracing: boolean,\n enableReplay: boolean,\n enableLogs: boolean,\n useInstrumentationAPI = false,\n useOnError = false,\n) => {\n if (useInstrumentationAPI && enableTracing) {\n const integrations = ['tracing'];\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr = integrations.join(',\\n ');\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(`const tracing = Sentry.reactRouterTracingIntegration();`)}\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: 1.0, // Capture 100% of the transactions\n\n // Set \\`tracePropagationTargets\\` to declare which URL(s) should have trace propagation enabled\n // In production, replace \"yourserver.io\" with your actual backend domain\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n }\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n ${plus(\n `<HydratedRouter${\n useOnError ? ' onError={Sentry.sentryOnError}' : ''\n } instrumentations={[tracing.clientInstrumentation]} />`,\n )}\n </StrictMode>\n );\n});`),\n );\n }\n\n const integrations = [];\n\n if (enableTracing) {\n integrations.push('Sentry.reactRouterTracingIntegration()');\n }\n\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr =\n integrations.length > 0 ? integrations.join(',\\n ') : '';\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: ${enableTracing ? '1.0' : '0'},${\n enableTracing ? ' // Capture 100% of the transactions' : ''\n}${\n enableTracing\n ? '\\n\\n // Set `tracePropagationTargets` to declare which URL(s) should have trace propagation enabled\\n // In production, replace \"yourserver.io\" with your actual backend domain\\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],'\n : ''\n}${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n}\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n ${plus(\n `<HydratedRouter${\n useOnError ? ' onError={Sentry.sentryOnError}' : ''\n } />`,\n )}\n </StrictMode>\n );\n});`),\n );\n};\n\nexport const getManualServerEntryContent = (useInstrumentationAPI = false) => {\n if (useInstrumentationAPI) {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n${plus(`// Enable automatic server-side instrumentation for loaders, actions, middleware\nexport const instrumentations = [Sentry.createSentryServerInstrumentation()];`)}\n\n// ... rest of your server entry`),\n );\n }\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n// ... rest of your server entry`),\n );\n};\n\nexport const getManualHandleRequestContent = () => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`// Replace your existing handleRequest function with this Sentry-wrapped version:\nconst handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\n${plus(`// If you have a custom handleRequest implementation, wrap it like this:\n// export default Sentry.wrapSentryHandleRequest(yourCustomHandleRequest);`)}\n\nexport default handleRequest;`),\n );\n};\n\nexport const getManualServerInstrumentContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs = false,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n plus(\n generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n ),\n ),\n );\n};\n\nexport const getManualReactRouterConfigContent = (isTS = true) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n isTS\n ? unchanged(`${plus(\n 'import type { Config } from \"@react-router/dev/config\";',\n )}\n${plus(\"import { sentryOnBuildEnd } from '@sentry/react-router';\")}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n} satisfies Config;\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`)\n : unchanged(`${plus(\n \"import { sentryOnBuildEnd } from '@sentry/react-router';\",\n )}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n};\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`),\n );\n};\n\nexport const getManualViteConfigContent = (\n orgSlug: string,\n projectSlug: string,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\n \"import { sentryReactRouter } from '@sentry/react-router';\",\n )}\nimport { defineConfig } from 'vite';\n\nexport default defineConfig(config => {\n return {\n plugins: [\n // ... your existing plugins\n ${plus(`sentryReactRouter({\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",\n authToken: process.env.SENTRY_AUTH_TOKEN,\n }, config),`)}\n ],\n ${plus(`optimizeDeps: {\n exclude: ['@sentry/react-router'],\n },`)}\n };\n});`),\n );\n};\n"]}
|
|
@@ -87,7 +87,6 @@ function getInitCallArgs(dsn, type, selectedFeatures) {
|
|
|
87
87
|
initCallArgs.replaysSessionSampleRate = 0.1;
|
|
88
88
|
initCallArgs.replaysOnErrorSampleRate = 1.0;
|
|
89
89
|
}
|
|
90
|
-
initCallArgs.sendDefaultPii = true;
|
|
91
90
|
}
|
|
92
91
|
return initCallArgs;
|
|
93
92
|
}
|
|
@@ -195,7 +194,7 @@ async function updateBuildScript(args) {
|
|
|
195
194
|
const buildCommand = args.isHydrogen
|
|
196
195
|
? 'shopify hydrogen build'
|
|
197
196
|
: 'remix build';
|
|
198
|
-
const instrumentedBuildCommand = `${buildCommand} --sourcemap && sentry
|
|
197
|
+
const instrumentedBuildCommand = `${buildCommand} --sourcemap && npx @sentry/remix --upload-sourcemaps --org ${args.org} --project ${args.project}` +
|
|
199
198
|
(args.url ? ` --url ${args.url}` : '') +
|
|
200
199
|
(args.isHydrogen ? ' --buildPath ./dist' : '');
|
|
201
200
|
if (!packageJson.scripts.build) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/remix/sdk-setup.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO5D,uCAAyB;AACzB,2CAA6B;AAC7B,yCAA2B;AAC3B,4DAA8C;AAE9C,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,mCAAyC;AAEzC,uCAOkB;AAElB,wDAA0D;AAC1D,mCAIiB;AACjB,0CAAiD;AACjD,0DAAgE;AAChE,0CAAmD;AACnD,8DAAkF;AAMlF,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,SAAgB,cAAc,CAAC,IAAa;IAC1C,qCAAqC;IACrC,MAAM,mBAAmB,GAAG,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IACnE,MAAM,mBAAmB,GAAG,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAEnE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAC7E,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAE7E,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;QACpE,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,qBAAqB,eAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,e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AAmB,CACpB,GAAG,CACL,CAAC;AACJ,CAAC;AA9CD,sEA8CC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport type { Program } from '@babel/types';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { Proxified, ProxifiedModule } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as url from 'url';\nimport * as childProcess from 'child_process';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { gte, minVersion } from 'semver';\n\nimport {\n builders,\n generateCode,\n loadFile,\n parseModule,\n writeFile,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { getPackageVersion } from '../utils/package-json';\nimport {\n getAfterImportsInsertionIndex,\n hasSentryContent,\n serverHasInstrumentationImport,\n} from './utils';\nimport { instrumentRoot } from './codemods/root';\nimport { instrumentHandleError } from './codemods/handle-error';\nimport { getPackageDotJson } from '../utils/clack';\nimport { findCustomExpressServerImplementation } from './codemods/express-server';\n\nexport type PartialRemixConfig = {\n unstable_dev?: boolean;\n};\n\nconst REMIX_CONFIG_FILE = 'remix.config.js';\nconst REMIX_REVEAL_COMMAND = 'npx remix reveal';\n\nexport function runRemixReveal(isTS: boolean): void {\n // Check if entry files already exist\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const clientEntryPath = path.join(process.cwd(), 'app', clientEntryFilename);\n const serverEntryPath = path.join(process.cwd(), 'app', serverEntryFilename);\n\n if (fs.existsSync(clientEntryPath) && fs.existsSync(serverEntryPath)) {\n clack.log.info(\n `Found entry files ${chalk.cyan(clientEntryFilename)} and ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n } else {\n clack.log.info(\n `Couldn't find entry files in your project. Trying to run ${chalk.cyan(\n REMIX_REVEAL_COMMAND,\n )}...`,\n );\n\n clack.log.info(childProcess.execSync(REMIX_REVEAL_COMMAND).toString());\n }\n}\n\ninterface SdkAstOptions {\n dsn: string;\n tracesSampleRate?: number;\n replaysSessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n integrations?: Array<Proxified>;\n enableLogs?: boolean;\n sendDefaultPii?: boolean;\n}\n\nfunction getInitCallArgs(\n dsn: string,\n type: 'client' | 'server',\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const initCallArgs: SdkAstOptions = {\n dsn,\n };\n\n // Adding tracing sample rate for both client and server\n if (selectedFeatures.performance) {\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n // Adding logs for both client and server\n if (selectedFeatures.logs) {\n initCallArgs.enableLogs = true;\n }\n\n // Adding integrations and replay options only for client\n if (\n type === 'client' &&\n (selectedFeatures.performance || selectedFeatures.replay)\n ) {\n initCallArgs.integrations = [] as Array<Proxified>;\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall(\n 'browserTracingIntegration',\n builders.raw('{ useEffect, useLocation, useMatches }'),\n ),\n );\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('replayIntegration', {\n maskAllText: true,\n blockAllMedia: true,\n }),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n\n initCallArgs.sendDefaultPii = true;\n }\n\n return initCallArgs;\n}\n\nfunction insertClientInitCall(\n dsn: string,\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalHooksMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, 'client', selectedFeatures);\n const initCall = builders.functionCall('init', initCallArgs);\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n const initCallInsertionIndex =\n getAfterImportsInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n}\n\nexport function generateServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n // create an empty file named `instrument.server.mjs`\n const instrumentationFile = 'instrumentation.server.mjs';\n const instrumentationFileMod = parseModule('');\n\n instrumentationFileMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const initCallArgs = getInitCallArgs(dsn, 'server', selectedFeatures);\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n\n const instrumentationFileModAST = instrumentationFileMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n instrumentationFileModAST,\n );\n\n instrumentationFileModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n\n return { instrumentationFile, instrumentationFileMod };\n}\n\nexport async function createServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const { instrumentationFile, instrumentationFileMod } =\n generateServerInstrumentationFile(dsn, selectedFeatures);\n\n await writeFile(instrumentationFileMod.$ast, instrumentationFile);\n\n return instrumentationFile;\n}\n\nexport async function insertServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n\n const expressServerPath = await findCustomExpressServerImplementation();\n\n if (!expressServerPath) {\n return false;\n }\n\n const originalExpressServerMod = await loadFile(expressServerPath);\n\n if (\n serverHasInstrumentationImport(\n expressServerPath,\n originalExpressServerMod.$code,\n )\n ) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(expressServerPath),\n )} already contains instrumentation import.\nSkipping adding instrumentation functionality to ${chalk.cyan(\n path.basename(expressServerPath),\n )}.`,\n );\n\n return true;\n }\n\n originalExpressServerMod.$code = `import './${instrumentationFile}';\\n${originalExpressServerMod.$code}`;\n\n fs.writeFileSync(expressServerPath, originalExpressServerMod.$code);\n\n return true;\n}\n\nexport function isRemixV2(packageJson: PackageDotJson): boolean {\n const remixVersion = getPackageVersion('@remix-run/react', packageJson);\n if (!remixVersion) {\n return false;\n }\n\n const minVer = minVersion(remixVersion);\n\n if (!minVer) {\n return false;\n }\n\n return gte(minVer, '2.0.0');\n}\n\nexport async function loadRemixConfig(): Promise<PartialRemixConfig> {\n const configFilePath = path.join(process.cwd(), REMIX_CONFIG_FILE);\n\n try {\n if (!fs.existsSync(configFilePath)) {\n return {};\n }\n\n const configUrl = url.pathToFileURL(configFilePath).href;\n const remixConfigModule = (await import(configUrl)) as {\n default: PartialRemixConfig;\n };\n\n return remixConfigModule?.default || {};\n } catch (e: unknown) {\n clack.log.error(`Couldn't load ${REMIX_CONFIG_FILE}.`);\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n\n return {};\n }\n}\n\nexport async function instrumentRootRoute(isTS?: boolean): Promise<void> {\n const rootFilename = `root.${isTS ? 'tsx' : 'jsx'}`;\n\n await instrumentRoot(rootFilename);\n\n clack.log.success(\n `Successfully instrumented root route ${chalk.cyan(rootFilename)}.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function updateBuildScript(args: {\n org: string;\n project: string;\n url?: string;\n isHydrogen: boolean;\n}): Promise<void> {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n const buildCommand = args.isHydrogen\n ? 'shopify hydrogen build'\n : 'remix build';\n\n const instrumentedBuildCommand =\n `${buildCommand} --sourcemap && sentry-upload-sourcemaps --org ${args.org} --project ${args.project}` +\n (args.url ? ` --url ${args.url}` : '') +\n (args.isHydrogen ? ' --buildPath ./dist' : '');\n\n if (!packageJson.scripts.build) {\n packageJson.scripts.build = instrumentedBuildCommand;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n } else if (packageJson.scripts.build.includes(buildCommand)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n packageJson.scripts.build = packageJson.scripts.build.replace(\n buildCommand,\n instrumentedBuildCommand,\n );\n } else {\n throw new Error(\n \"`build` script doesn't contain a known build command. Please update it manually.\",\n );\n }\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('build')} script in ${chalk.cyan(\n 'package.json',\n )} to generate and upload sourcemaps.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport function updateEntryClientMod(\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalEntryClientMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n const imports = ['init'];\n if (selectedFeatures.replay) {\n imports.push('replayIntegration');\n }\n if (selectedFeatures.performance) {\n imports.push('browserTracingIntegration');\n }\n originalEntryClientMod.imports.$add({\n from: '@sentry/remix',\n imported: `${imports.join(', ')}`,\n });\n\n if (selectedFeatures.performance) {\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useLocation',\n local: 'useLocation',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useMatches',\n local: 'useMatches',\n });\n\n originalEntryClientMod.imports.$add({\n from: 'react',\n imported: 'useEffect',\n local: 'useEffect',\n });\n }\n\n insertClientInitCall(dsn, originalEntryClientMod, selectedFeatures);\n\n return originalEntryClientMod;\n}\n\nexport async function initializeSentryOnEntryClient(\n dsn: string,\n isTS: boolean,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryClient = path.join(\n process.cwd(),\n 'app',\n clientEntryFilename,\n );\n\n const originalEntryClientMod = await loadFile(originalEntryClient);\n\n if (hasSentryContent(originalEntryClient, originalEntryClientMod.$code)) {\n return;\n }\n\n const updatedEntryClientMod = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n await writeFile(\n updatedEntryClientMod.$ast,\n path.join(process.cwd(), 'app', clientEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on client entry point ${chalk.cyan(\n clientEntryFilename,\n )}`,\n );\n}\n\nexport async function updateStartScript(instrumentationFile: string) {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts || !packageJson.scripts.start) {\n throw new Error(\n \"Couldn't find a `start` script in your package.json. Please add one manually.\",\n );\n }\n\n if (packageJson.scripts.start.includes('NODE_OPTIONS')) {\n clack.log.warn(\n `Found existing NODE_OPTIONS in ${chalk.cyan(\n 'start',\n )} script. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n if (\n !packageJson.scripts.start.includes('remix-serve') &&\n // Adding a following empty space not to match a path that includes `node`\n !packageJson.scripts.start.includes('node ')\n ) {\n clack.log.warn(\n `Found a ${chalk.cyan('start')} script that doesn't use ${chalk.cyan(\n 'remix-serve',\n )} or ${chalk.cyan('node')}. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n const startCommand = packageJson.scripts.start;\n\n packageJson.scripts.start = `NODE_OPTIONS='--import ./${instrumentationFile}' ${startCommand}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('start')} script in ${chalk.cyan(\n 'package.json',\n )} to include Sentry initialization on start.`,\n );\n}\n\nexport async function instrumentSentryOnEntryServer(\n isTS: boolean,\n): Promise<void> {\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryServer = path.join(\n process.cwd(),\n 'app',\n serverEntryFilename,\n );\n\n const originalEntryServerMod = await loadFile(originalEntryServer);\n\n if (hasSentryContent(originalEntryServer, originalEntryServerMod.$code)) {\n return;\n }\n\n originalEntryServerMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const handleErrorInstrumented = instrumentHandleError(\n originalEntryServerMod,\n serverEntryFilename,\n );\n\n if (handleErrorInstrumented) {\n clack.log.success(\n `Instrumented ${chalk.cyan('handleError')} in ${chalk.cyan(\n `${serverEntryFilename}`,\n )}`,\n );\n }\n\n await writeFile(\n originalEntryServerMod.$ast,\n path.join(process.cwd(), 'app', serverEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on server entry point ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/remix/sdk-setup.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO5D,uCAAyB;AACzB,2CAA6B;AAC7B,yCAA2B;AAC3B,4DAA8C;AAE9C,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,mCAAyC;AAEzC,uCAOkB;AAElB,wDAA0D;AAC1D,mCAIiB;AACjB,0CAAiD;AACjD,0DAAgE;AAChE,0CAAmD;AACnD,8DAAkF;AAMlF,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,SAAgB,cAAc,CAAC,IAAa;IAC1C,qCAAqC;IACrC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eAAe;QACrB,QAAQ,EAAE,GAAG;QACb,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,MAAM,uBAAuB,GAAG,IAAA,oCAAqB,EACnD,sBAAsB,EACtB,mBAAmB,CACpB,CAAC;IAEF,IAAI,uBAAuB,EAAE;QAC3B,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,gBAAgB,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,eAAK,CAAC,IAAI,CACxD,GAAG,mBAAmB,EAAE,CACzB,EAAE,CACJ,CAAC;KACH;IAED,MAAM,IAAA,oBAAS,EACb,sBAAsB,CAAC,IAAI,EAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CACrD,CAAC;IAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,yDAAyD,eAAK,CAAC,IAAI,CACjE,mBAAmB,CACpB,GAAG,CACL,CAAC;AACJ,CAAC;AA9CD,sEA8CC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport type { Program } from '@babel/types';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { Proxified, ProxifiedModule } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as url from 'url';\nimport * as childProcess from 'child_process';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { gte, minVersion } from 'semver';\n\nimport {\n builders,\n generateCode,\n loadFile,\n parseModule,\n writeFile,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { getPackageVersion } from '../utils/package-json';\nimport {\n getAfterImportsInsertionIndex,\n hasSentryContent,\n serverHasInstrumentationImport,\n} from './utils';\nimport { instrumentRoot } from './codemods/root';\nimport { instrumentHandleError } from './codemods/handle-error';\nimport { getPackageDotJson } from '../utils/clack';\nimport { findCustomExpressServerImplementation } from './codemods/express-server';\n\nexport type PartialRemixConfig = {\n unstable_dev?: boolean;\n};\n\nconst REMIX_CONFIG_FILE = 'remix.config.js';\nconst REMIX_REVEAL_COMMAND = 'npx remix reveal';\n\nexport function runRemixReveal(isTS: boolean): void {\n // Check if entry files already exist\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const clientEntryPath = path.join(process.cwd(), 'app', clientEntryFilename);\n const serverEntryPath = path.join(process.cwd(), 'app', serverEntryFilename);\n\n if (fs.existsSync(clientEntryPath) && fs.existsSync(serverEntryPath)) {\n clack.log.info(\n `Found entry files ${chalk.cyan(clientEntryFilename)} and ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n } else {\n clack.log.info(\n `Couldn't find entry files in your project. Trying to run ${chalk.cyan(\n REMIX_REVEAL_COMMAND,\n )}...`,\n );\n\n clack.log.info(childProcess.execSync(REMIX_REVEAL_COMMAND).toString());\n }\n}\n\ninterface SdkAstOptions {\n dsn: string;\n tracesSampleRate?: number;\n replaysSessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n integrations?: Array<Proxified>;\n enableLogs?: boolean;\n}\n\nfunction getInitCallArgs(\n dsn: string,\n type: 'client' | 'server',\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const initCallArgs: SdkAstOptions = {\n dsn,\n };\n\n // Adding tracing sample rate for both client and server\n if (selectedFeatures.performance) {\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n // Adding logs for both client and server\n if (selectedFeatures.logs) {\n initCallArgs.enableLogs = true;\n }\n\n // Adding integrations and replay options only for client\n if (\n type === 'client' &&\n (selectedFeatures.performance || selectedFeatures.replay)\n ) {\n initCallArgs.integrations = [] as Array<Proxified>;\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall(\n 'browserTracingIntegration',\n builders.raw('{ useEffect, useLocation, useMatches }'),\n ),\n );\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('replayIntegration', {\n maskAllText: true,\n blockAllMedia: true,\n }),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n }\n\n return initCallArgs;\n}\n\nfunction insertClientInitCall(\n dsn: string,\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalHooksMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, 'client', selectedFeatures);\n const initCall = builders.functionCall('init', initCallArgs);\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n const initCallInsertionIndex =\n getAfterImportsInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n}\n\nexport function generateServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n // create an empty file named `instrument.server.mjs`\n const instrumentationFile = 'instrumentation.server.mjs';\n const instrumentationFileMod = parseModule('');\n\n instrumentationFileMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const initCallArgs = getInitCallArgs(dsn, 'server', selectedFeatures);\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n\n const instrumentationFileModAST = instrumentationFileMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n instrumentationFileModAST,\n );\n\n instrumentationFileModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n\n return { instrumentationFile, instrumentationFileMod };\n}\n\nexport async function createServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const { instrumentationFile, instrumentationFileMod } =\n generateServerInstrumentationFile(dsn, selectedFeatures);\n\n await writeFile(instrumentationFileMod.$ast, instrumentationFile);\n\n return instrumentationFile;\n}\n\nexport async function insertServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n\n const expressServerPath = await findCustomExpressServerImplementation();\n\n if (!expressServerPath) {\n return false;\n }\n\n const originalExpressServerMod = await loadFile(expressServerPath);\n\n if (\n serverHasInstrumentationImport(\n expressServerPath,\n originalExpressServerMod.$code,\n )\n ) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(expressServerPath),\n )} already contains instrumentation import.\nSkipping adding instrumentation functionality to ${chalk.cyan(\n path.basename(expressServerPath),\n )}.`,\n );\n\n return true;\n }\n\n originalExpressServerMod.$code = `import './${instrumentationFile}';\\n${originalExpressServerMod.$code}`;\n\n fs.writeFileSync(expressServerPath, originalExpressServerMod.$code);\n\n return true;\n}\n\nexport function isRemixV2(packageJson: PackageDotJson): boolean {\n const remixVersion = getPackageVersion('@remix-run/react', packageJson);\n if (!remixVersion) {\n return false;\n }\n\n const minVer = minVersion(remixVersion);\n\n if (!minVer) {\n return false;\n }\n\n return gte(minVer, '2.0.0');\n}\n\nexport async function loadRemixConfig(): Promise<PartialRemixConfig> {\n const configFilePath = path.join(process.cwd(), REMIX_CONFIG_FILE);\n\n try {\n if (!fs.existsSync(configFilePath)) {\n return {};\n }\n\n const configUrl = url.pathToFileURL(configFilePath).href;\n const remixConfigModule = (await import(configUrl)) as {\n default: PartialRemixConfig;\n };\n\n return remixConfigModule?.default || {};\n } catch (e: unknown) {\n clack.log.error(`Couldn't load ${REMIX_CONFIG_FILE}.`);\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n\n return {};\n }\n}\n\nexport async function instrumentRootRoute(isTS?: boolean): Promise<void> {\n const rootFilename = `root.${isTS ? 'tsx' : 'jsx'}`;\n\n await instrumentRoot(rootFilename);\n\n clack.log.success(\n `Successfully instrumented root route ${chalk.cyan(rootFilename)}.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function updateBuildScript(args: {\n org: string;\n project: string;\n url?: string;\n isHydrogen: boolean;\n}): Promise<void> {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n const buildCommand = args.isHydrogen\n ? 'shopify hydrogen build'\n : 'remix build';\n\n const instrumentedBuildCommand =\n `${buildCommand} --sourcemap && npx @sentry/remix --upload-sourcemaps --org ${args.org} --project ${args.project}` +\n (args.url ? ` --url ${args.url}` : '') +\n (args.isHydrogen ? ' --buildPath ./dist' : '');\n\n if (!packageJson.scripts.build) {\n packageJson.scripts.build = instrumentedBuildCommand;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n } else if (packageJson.scripts.build.includes(buildCommand)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n packageJson.scripts.build = packageJson.scripts.build.replace(\n buildCommand,\n instrumentedBuildCommand,\n );\n } else {\n throw new Error(\n \"`build` script doesn't contain a known build command. Please update it manually.\",\n );\n }\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('build')} script in ${chalk.cyan(\n 'package.json',\n )} to generate and upload sourcemaps.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport function updateEntryClientMod(\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalEntryClientMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n const imports = ['init'];\n if (selectedFeatures.replay) {\n imports.push('replayIntegration');\n }\n if (selectedFeatures.performance) {\n imports.push('browserTracingIntegration');\n }\n originalEntryClientMod.imports.$add({\n from: '@sentry/remix',\n imported: `${imports.join(', ')}`,\n });\n\n if (selectedFeatures.performance) {\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useLocation',\n local: 'useLocation',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useMatches',\n local: 'useMatches',\n });\n\n originalEntryClientMod.imports.$add({\n from: 'react',\n imported: 'useEffect',\n local: 'useEffect',\n });\n }\n\n insertClientInitCall(dsn, originalEntryClientMod, selectedFeatures);\n\n return originalEntryClientMod;\n}\n\nexport async function initializeSentryOnEntryClient(\n dsn: string,\n isTS: boolean,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryClient = path.join(\n process.cwd(),\n 'app',\n clientEntryFilename,\n );\n\n const originalEntryClientMod = await loadFile(originalEntryClient);\n\n if (hasSentryContent(originalEntryClient, originalEntryClientMod.$code)) {\n return;\n }\n\n const updatedEntryClientMod = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n await writeFile(\n updatedEntryClientMod.$ast,\n path.join(process.cwd(), 'app', clientEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on client entry point ${chalk.cyan(\n clientEntryFilename,\n )}`,\n );\n}\n\nexport async function updateStartScript(instrumentationFile: string) {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts || !packageJson.scripts.start) {\n throw new Error(\n \"Couldn't find a `start` script in your package.json. Please add one manually.\",\n );\n }\n\n if (packageJson.scripts.start.includes('NODE_OPTIONS')) {\n clack.log.warn(\n `Found existing NODE_OPTIONS in ${chalk.cyan(\n 'start',\n )} script. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n if (\n !packageJson.scripts.start.includes('remix-serve') &&\n // Adding a following empty space not to match a path that includes `node`\n !packageJson.scripts.start.includes('node ')\n ) {\n clack.log.warn(\n `Found a ${chalk.cyan('start')} script that doesn't use ${chalk.cyan(\n 'remix-serve',\n )} or ${chalk.cyan('node')}. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n const startCommand = packageJson.scripts.start;\n\n packageJson.scripts.start = `NODE_OPTIONS='--import ./${instrumentationFile}' ${startCommand}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('start')} script in ${chalk.cyan(\n 'package.json',\n )} to include Sentry initialization on start.`,\n );\n}\n\nexport async function instrumentSentryOnEntryServer(\n isTS: boolean,\n): Promise<void> {\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryServer = path.join(\n process.cwd(),\n 'app',\n serverEntryFilename,\n );\n\n const originalEntryServerMod = await loadFile(originalEntryServer);\n\n if (hasSentryContent(originalEntryServer, originalEntryServerMod.$code)) {\n return;\n }\n\n originalEntryServerMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const handleErrorInstrumented = instrumentHandleError(\n originalEntryServerMod,\n serverEntryFilename,\n );\n\n if (handleErrorInstrumented) {\n clack.log.success(\n `Instrumented ${chalk.cyan('handleError')} in ${chalk.cyan(\n `${serverEntryFilename}`,\n )}`,\n );\n }\n\n await writeFile(\n originalEntryServerMod.$ast,\n path.join(process.cwd(), 'app', serverEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on server entry point ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n}\n"]}
|
package/dist/src/run.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Platform } from '../lib/Constants';
|
|
2
|
-
type WizardIntegration = 'angular' | 'reactNative' | 'flutter' | 'ios' | 'android' | 'cordova' | 'electron' | 'nextjs' | 'nuxt' | 'remix' | 'reactRouter' | 'sveltekit' | 'cloudflare' | 'sourcemaps';
|
|
2
|
+
type WizardIntegration = 'angular' | 'reactNative' | 'flutter' | 'ios' | 'appleSnapshots' | 'android' | 'cordova' | 'electron' | 'nextjs' | 'nuxt' | 'remix' | 'reactRouter' | 'sveltekit' | 'cloudflare' | 'sourcemaps';
|
|
3
3
|
type Args = {
|
|
4
4
|
integration?: WizardIntegration;
|
|
5
5
|
uninstall: boolean;
|
|
@@ -7,6 +7,7 @@ type Args = {
|
|
|
7
7
|
skipConnect: boolean;
|
|
8
8
|
debug: boolean;
|
|
9
9
|
quiet: boolean;
|
|
10
|
+
nonInteractive?: boolean;
|
|
10
11
|
disableTelemetry: boolean;
|
|
11
12
|
spotlight?: boolean;
|
|
12
13
|
promoCode?: string;
|
|
@@ -30,6 +31,8 @@ type Args = {
|
|
|
30
31
|
comingFrom?: string;
|
|
31
32
|
ignoreGitChanges?: boolean;
|
|
32
33
|
xcodeProjectDir?: string;
|
|
34
|
+
appTarget?: string;
|
|
35
|
+
hostedTestTarget?: string;
|
|
33
36
|
};
|
|
34
37
|
export declare function run(argv: Args): Promise<void>;
|
|
35
38
|
export {};
|
package/dist/src/run.js
CHANGED
|
@@ -34,6 +34,7 @@ const Setup_1 = require("../lib/Setup");
|
|
|
34
34
|
const android_wizard_1 = require("./android/android-wizard");
|
|
35
35
|
const angular_wizard_1 = require("./angular/angular-wizard");
|
|
36
36
|
const apple_wizard_1 = require("./apple/apple-wizard");
|
|
37
|
+
const apple_snapshots_wizard_1 = require("./apple/snapshots/apple-snapshots-wizard");
|
|
37
38
|
const flutter_wizard_1 = require("./flutter/flutter-wizard");
|
|
38
39
|
const nextjs_wizard_1 = require("./nextjs/nextjs-wizard");
|
|
39
40
|
const nuxt_wizard_1 = require("./nuxt/nuxt-wizard");
|
|
@@ -87,6 +88,7 @@ async function run(argv) {
|
|
|
87
88
|
{ value: 'reactNative', label: 'React Native' },
|
|
88
89
|
{ value: 'flutter', label: 'Flutter' },
|
|
89
90
|
{ value: 'ios', label: 'iOS' },
|
|
91
|
+
{ value: 'appleSnapshots', label: 'Apple Snapshots' },
|
|
90
92
|
{ value: 'angular', label: 'Angular' },
|
|
91
93
|
{ value: 'android', label: 'Android' },
|
|
92
94
|
{ value: 'cordova', label: 'Cordova' },
|
|
@@ -132,6 +134,15 @@ async function run(argv) {
|
|
|
132
134
|
projectDir: finalArgs.xcodeProjectDir,
|
|
133
135
|
});
|
|
134
136
|
break;
|
|
137
|
+
case 'appleSnapshots':
|
|
138
|
+
await (0, apple_snapshots_wizard_1.runAppleSnapshotsWizard)({
|
|
139
|
+
...wizardOptions,
|
|
140
|
+
projectDir: finalArgs.xcodeProjectDir,
|
|
141
|
+
appTarget: finalArgs.appTarget,
|
|
142
|
+
hostedTestTarget: finalArgs.hostedTestTarget,
|
|
143
|
+
nonInteractive: finalArgs.nonInteractive ?? false,
|
|
144
|
+
});
|
|
145
|
+
break;
|
|
135
146
|
case 'android':
|
|
136
147
|
await (0, android_wizard_1.runAndroidWizard)(wizardOptions);
|
|
137
148
|
break;
|
|
@@ -163,6 +174,7 @@ async function run(argv) {
|
|
|
163
174
|
argv.integration = 'cordova';
|
|
164
175
|
void (0, Setup_1.run)({
|
|
165
176
|
...argv,
|
|
177
|
+
quiet: finalArgs.quiet,
|
|
166
178
|
url: argv.url ?? '',
|
|
167
179
|
integration: Constants_1.Integration.cordova,
|
|
168
180
|
platform: argv.platform ?? [],
|
|
@@ -172,6 +184,7 @@ async function run(argv) {
|
|
|
172
184
|
argv.integration = 'electron';
|
|
173
185
|
void (0, Setup_1.run)({
|
|
174
186
|
...argv,
|
|
187
|
+
quiet: finalArgs.quiet,
|
|
175
188
|
url: argv.url ?? '',
|
|
176
189
|
integration: Constants_1.Integration.electron,
|
|
177
190
|
platform: argv.platform ?? [],
|
package/dist/src/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,4EAA0E;AAC1E,yCAAiD;AAEjD,gDAA8D;AAC9D,2CAAoD;AACpD,wCAAgD;AAChD,6DAA4D;AAC5D,6DAA4D;AAC5D,uDAAsD;AACtD,6DAA4D;AAC5D,0DAAyD;AACzD,oDAAmD;AACnD,uDAAsD;AACtD,sEAAqE;AACrE,mEAAkE;AAClE,4EAA0E;AAC1E,sEAAqE;AACrE,yCAAgD;AAEhD,uCAA2C;AAmD3C,SAAS,8BAA8B,CACrC,IAAU;IAEV,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;QAC5B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;QAC5C,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU;QAC9C,OAAO,EAAE;YACP,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;YACrC,IAAI,EAAE;gBACJ;oBACE,GAAG,EAAE;wBACH,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,GAAG;qBACpC;iBACF;aACF;YACD,YAAY,EAAE;gBACZ,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;gBACjC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO;gBACrC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO;aACtC;YACD,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,WAAW;SAC1C;KACF,CAAC;AACJ,CAAC;AAEM,KAAK,UA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@ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { runReactNativeWizard } from './react-native/react-native-wizard';\nimport { abortIfCancelled } from './utils/clack';\n\nimport { Integration, type Platform } from '../lib/Constants';\nimport { readEnvironment } from '../lib/Helper/Env';\nimport { run as legacyRun } from '../lib/Setup';\nimport { runAndroidWizard } from './android/android-wizard';\nimport { runAngularWizard } from './angular/angular-wizard';\nimport { runAppleWizard } from './apple/apple-wizard';\nimport { runFlutterWizard } from './flutter/flutter-wizard';\nimport { runNextjsWizard } from './nextjs/nextjs-wizard';\nimport { runNuxtWizard } from './nuxt/nuxt-wizard';\nimport { runRemixWizard } from './remix/remix-wizard';\nimport { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';\nimport { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';\nimport { runReactRouterWizard } from './react-router/react-router-wizard';\nimport { runCloudflareWizard } from './cloudflare/cloudflare-wizard';\nimport { enableDebugLogs } from './utils/debug';\nimport type { PreselectedProject, WizardOptions } from './utils/types';\nimport { WIZARD_VERSION } from './version';\n\ntype WizardIntegration =\n | 'angular'\n | 'reactNative'\n | 'flutter'\n | 'ios'\n | 'android'\n | 'cordova'\n | 'electron'\n | 'nextjs'\n | 'nuxt'\n | 'remix'\n | 'reactRouter'\n | 'sveltekit'\n | 'cloudflare'\n | 'sourcemaps';\n\ntype Args = {\n integration?: WizardIntegration;\n\n uninstall: boolean; // used in Cordova\n signup: boolean;\n skipConnect: boolean;\n debug: boolean;\n quiet: boolean;\n disableTelemetry: boolean;\n spotlight?: boolean;\n promoCode?: string;\n preSelectedProject?: {\n authToken: string;\n selfHosted: boolean;\n dsn: string;\n projectId: string;\n projectSlug: string;\n projectName: string;\n orgId: string;\n orgName: string;\n orgSlug: string;\n };\n url?: string;\n platform?: Platform[];\n org?: string;\n project?: string;\n saas?: boolean;\n forceInstall?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n};\n\nfunction preSelectedProjectArgsToObject(\n args: Args,\n): PreselectedProject | undefined {\n if (!args.preSelectedProject) {\n return undefined;\n }\n\n return {\n authToken: args.preSelectedProject.authToken,\n selfHosted: args.preSelectedProject.selfHosted,\n project: {\n id: args.preSelectedProject.projectId,\n keys: [\n {\n dsn: {\n public: args.preSelectedProject.dsn,\n },\n },\n ],\n organization: {\n id: args.preSelectedProject.orgId,\n name: args.preSelectedProject.orgName,\n slug: args.preSelectedProject.orgSlug,\n },\n slug: args.preSelectedProject.projectSlug,\n },\n };\n}\n\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n // Enable debug logs if the user has passed the --debug flag\n if (finalArgs.debug) {\n enableDebugLogs();\n }\n\n let integration = finalArgs.integration;\n if (!integration) {\n clack.intro(`Sentry Wizard ${WIZARD_VERSION}`);\n\n integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [\n { value: 'reactNative', label: 'React Native' },\n { value: 'flutter', label: 'Flutter' },\n { value: 'ios', label: 'iOS' },\n { value: 'angular', label: 'Angular' },\n { value: 'android', label: 'Android' },\n { value: 'cordova', label: 'Cordova' },\n { value: 'electron', label: 'Electron' },\n { value: 'nextjs', label: 'Next.js' },\n { value: 'nuxt', label: 'Nuxt' },\n { value: 'remix', label: 'Remix' },\n { value: 'reactRouter', label: 'React Router' },\n { value: 'sveltekit', label: 'SvelteKit' },\n { value: 'cloudflare', label: 'Cloudflare' },\n { value: 'sourcemaps', label: 'Configure Source Maps Upload' },\n ],\n }),\n );\n\n if (!integration) {\n clack.log.error('No integration selected. Exiting.');\n return;\n }\n\n clack.outro(`Starting ${integration} setup`);\n }\n\n const wizardOptions: WizardOptions = {\n telemetryEnabled: !finalArgs.disableTelemetry,\n promoCode: finalArgs.promoCode,\n url: finalArgs.url,\n orgSlug: finalArgs.org,\n projectSlug: finalArgs.project,\n saas: finalArgs.saas,\n preSelectedProject: preSelectedProjectArgsToObject(finalArgs),\n forceInstall: finalArgs.forceInstall,\n comingFrom: finalArgs.comingFrom,\n ignoreGitChanges: finalArgs.ignoreGitChanges,\n spotlight: finalArgs.spotlight,\n };\n\n switch (integration) {\n case 'reactNative':\n await runReactNativeWizard(wizardOptions);\n break;\n\n case 'flutter':\n await runFlutterWizard(wizardOptions);\n break;\n\n case 'ios':\n await runAppleWizard({\n ...wizardOptions,\n projectDir: finalArgs.xcodeProjectDir,\n });\n break;\n\n case 'android':\n await runAndroidWizard(wizardOptions);\n break;\n\n case 'angular':\n await runAngularWizard(wizardOptions);\n break;\n\n case 'nextjs':\n await runNextjsWizard(wizardOptions);\n break;\n\n case 'nuxt':\n await runNuxtWizard(wizardOptions);\n break;\n\n case 'remix':\n await runRemixWizard(wizardOptions);\n break;\n\n case 'reactRouter':\n await runReactRouterWizard(wizardOptions);\n break;\n\n case 'sveltekit':\n await runSvelteKitWizard(wizardOptions);\n break;\n\n case 'cloudflare':\n await runCloudflareWizard(wizardOptions);\n break;\n\n case 'sourcemaps':\n await runSourcemapsWizard(wizardOptions);\n break;\n\n case 'cordova':\n argv.integration = 'cordova';\n void legacyRun(\n {\n ...argv,\n url: argv.url ?? '',\n integration: Integration.cordova,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n case 'electron':\n argv.integration = 'electron';\n void legacyRun(\n {\n ...argv,\n url: argv.url ?? '',\n integration: Integration.electron,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,4EAA0E;AAC1E,yCAAiD;AAEjD,gDAA8D;AAC9D,2CAAoD;AACpD,wCAAgD;AAChD,6DAA4D;AAC5D,6DAA4D;AAC5D,uDAAsD;AACtD,qFAAmF;AACnF,6DAA4D;AAC5D,0DAAy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. It works though\nimport * as clack from '@clack/prompts';\nimport { runReactNativeWizard } from './react-native/react-native-wizard';\nimport { abortIfCancelled } from './utils/clack';\n\nimport { Integration, type Platform } from '../lib/Constants';\nimport { readEnvironment } from '../lib/Helper/Env';\nimport { run as legacyRun } from '../lib/Setup';\nimport { runAndroidWizard } from './android/android-wizard';\nimport { runAngularWizard } from './angular/angular-wizard';\nimport { runAppleWizard } from './apple/apple-wizard';\nimport { runAppleSnapshotsWizard } from './apple/snapshots/apple-snapshots-wizard';\nimport { runFlutterWizard } from './flutter/flutter-wizard';\nimport { runNextjsWizard } from './nextjs/nextjs-wizard';\nimport { runNuxtWizard } from './nuxt/nuxt-wizard';\nimport { runRemixWizard } from './remix/remix-wizard';\nimport { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';\nimport { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';\nimport { runReactRouterWizard } from './react-router/react-router-wizard';\nimport { runCloudflareWizard } from './cloudflare/cloudflare-wizard';\nimport { enableDebugLogs } from './utils/debug';\nimport type { PreselectedProject, WizardOptions } from './utils/types';\nimport { WIZARD_VERSION } from './version';\n\ntype WizardIntegration =\n | 'angular'\n | 'reactNative'\n | 'flutter'\n | 'ios'\n | 'appleSnapshots'\n | 'android'\n | 'cordova'\n | 'electron'\n | 'nextjs'\n | 'nuxt'\n | 'remix'\n | 'reactRouter'\n | 'sveltekit'\n | 'cloudflare'\n | 'sourcemaps';\n\ntype Args = {\n integration?: WizardIntegration;\n\n uninstall: boolean; // used in Cordova\n signup: boolean;\n skipConnect: boolean;\n debug: boolean;\n quiet: boolean;\n nonInteractive?: boolean;\n disableTelemetry: boolean;\n spotlight?: boolean;\n promoCode?: string;\n preSelectedProject?: {\n authToken: string;\n selfHosted: boolean;\n dsn: string;\n projectId: string;\n projectSlug: string;\n projectName: string;\n orgId: string;\n orgName: string;\n orgSlug: string;\n };\n url?: string;\n platform?: Platform[];\n org?: string;\n project?: string;\n saas?: boolean;\n forceInstall?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n appTarget?: string;\n hostedTestTarget?: string;\n};\n\nfunction preSelectedProjectArgsToObject(\n args: Args,\n): PreselectedProject | undefined {\n if (!args.preSelectedProject) {\n return undefined;\n }\n\n return {\n authToken: args.preSelectedProject.authToken,\n selfHosted: args.preSelectedProject.selfHosted,\n project: {\n id: args.preSelectedProject.projectId,\n keys: [\n {\n dsn: {\n public: args.preSelectedProject.dsn,\n },\n },\n ],\n organization: {\n id: args.preSelectedProject.orgId,\n name: args.preSelectedProject.orgName,\n slug: args.preSelectedProject.orgSlug,\n },\n slug: args.preSelectedProject.projectSlug,\n },\n };\n}\n\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n // Enable debug logs if the user has passed the --debug flag\n if (finalArgs.debug) {\n enableDebugLogs();\n }\n\n let integration = finalArgs.integration;\n if (!integration) {\n clack.intro(`Sentry Wizard ${WIZARD_VERSION}`);\n\n integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [\n { value: 'reactNative', label: 'React Native' },\n { value: 'flutter', label: 'Flutter' },\n { value: 'ios', label: 'iOS' },\n { value: 'appleSnapshots', label: 'Apple Snapshots' },\n { value: 'angular', label: 'Angular' },\n { value: 'android', label: 'Android' },\n { value: 'cordova', label: 'Cordova' },\n { value: 'electron', label: 'Electron' },\n { value: 'nextjs', label: 'Next.js' },\n { value: 'nuxt', label: 'Nuxt' },\n { value: 'remix', label: 'Remix' },\n { value: 'reactRouter', label: 'React Router' },\n { value: 'sveltekit', label: 'SvelteKit' },\n { value: 'cloudflare', label: 'Cloudflare' },\n { value: 'sourcemaps', label: 'Configure Source Maps Upload' },\n ],\n }),\n );\n\n if (!integration) {\n clack.log.error('No integration selected. Exiting.');\n return;\n }\n\n clack.outro(`Starting ${integration} setup`);\n }\n\n const wizardOptions: WizardOptions = {\n telemetryEnabled: !finalArgs.disableTelemetry,\n promoCode: finalArgs.promoCode,\n url: finalArgs.url,\n orgSlug: finalArgs.org,\n projectSlug: finalArgs.project,\n saas: finalArgs.saas,\n preSelectedProject: preSelectedProjectArgsToObject(finalArgs),\n forceInstall: finalArgs.forceInstall,\n comingFrom: finalArgs.comingFrom,\n ignoreGitChanges: finalArgs.ignoreGitChanges,\n spotlight: finalArgs.spotlight,\n };\n\n switch (integration) {\n case 'reactNative':\n await runReactNativeWizard(wizardOptions);\n break;\n\n case 'flutter':\n await runFlutterWizard(wizardOptions);\n break;\n\n case 'ios':\n await runAppleWizard({\n ...wizardOptions,\n projectDir: finalArgs.xcodeProjectDir,\n });\n break;\n\n case 'appleSnapshots':\n await runAppleSnapshotsWizard({\n ...wizardOptions,\n projectDir: finalArgs.xcodeProjectDir,\n appTarget: finalArgs.appTarget,\n hostedTestTarget: finalArgs.hostedTestTarget,\n nonInteractive: finalArgs.nonInteractive ?? false,\n });\n break;\n\n case 'android':\n await runAndroidWizard(wizardOptions);\n break;\n\n case 'angular':\n await runAngularWizard(wizardOptions);\n break;\n\n case 'nextjs':\n await runNextjsWizard(wizardOptions);\n break;\n\n case 'nuxt':\n await runNuxtWizard(wizardOptions);\n break;\n\n case 'remix':\n await runRemixWizard(wizardOptions);\n break;\n\n case 'reactRouter':\n await runReactRouterWizard(wizardOptions);\n break;\n\n case 'sveltekit':\n await runSvelteKitWizard(wizardOptions);\n break;\n\n case 'cloudflare':\n await runCloudflareWizard(wizardOptions);\n break;\n\n case 'sourcemaps':\n await runSourcemapsWizard(wizardOptions);\n break;\n\n case 'cordova':\n argv.integration = 'cordova';\n void legacyRun(\n {\n ...argv,\n quiet: finalArgs.quiet,\n url: argv.url ?? '',\n integration: Integration.cordova,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n case 'electron':\n argv.integration = 'electron';\n void legacyRun(\n {\n ...argv,\n quiet: finalArgs.quiet,\n url: argv.url ?? '',\n integration: Integration.electron,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n"]}
|
|
@@ -60,14 +60,14 @@ In case you already tried the wizard, we can also show you how to configure your
|
|
|
60
60
|
clack.log.info("Welcome back to the Source Maps wizard - we're almost done ;)");
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
clack.log.step(`Build your app with ${chalk_1.default.cyan('remix build --sourcemap')}, then upload your source maps using ${chalk_1.default.cyan('sentry
|
|
64
|
-
clack.log.step(`You can add ${chalk_1.default.cyan('sentry
|
|
63
|
+
clack.log.step(`Build your app with ${chalk_1.default.cyan('remix build --sourcemap')}, then upload your source maps using ${chalk_1.default.cyan('npx @sentry/remix --upload-sourcemaps')} cli tool.`);
|
|
64
|
+
clack.log.step(`You can add ${chalk_1.default.cyan('npx @sentry/remix --upload-sourcemaps')} to your build script in ${chalk_1.default.cyan('package.json')} like this:`);
|
|
65
65
|
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
66
66
|
// eslint-disable-next-line no-console
|
|
67
67
|
console.log(codeSnippet);
|
|
68
68
|
clack.log.step(`or run it manually after building your app.
|
|
69
69
|
|
|
70
|
-
To see all available options
|
|
70
|
+
To see all available options, run ${chalk_1.default.cyan('npx @sentry/remix --upload-sourcemaps --help')}
|
|
71
71
|
`);
|
|
72
72
|
await (0, clack_1.abortIfCancelled)(clack.select({
|
|
73
73
|
message: 'Did you finish configuring your build and prod scripts?',
|
|
@@ -79,7 +79,7 @@ To see all available options for ${chalk_1.default.cyan('sentry-upload-sourcemap
|
|
|
79
79
|
exports.configureRemixSourceMapsUpload = configureRemixSourceMapsUpload;
|
|
80
80
|
const codeSnippet = chalk_1.default.gray(`
|
|
81
81
|
"scripts": {
|
|
82
|
-
${chalk_1.default.greenBright('"build": "remix build --sourcemap && sentry
|
|
82
|
+
${chalk_1.default.greenBright('"build": "remix build --sourcemap && npx @sentry/remix --upload-sourcemaps"')};
|
|
83
83
|
}
|
|
84
84
|
`);
|
|
85
85
|
//# sourceMappingURL=remix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remix.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/remix.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,kDAA0B;AAC1B,2DAA0D;AAC1D,+CAA4C;AAC5C,6CAAqD;AAIrD,qDAAuC;AAEhC,MAAM,8BAA8B,GAAG,KAAK,EACjD,OAAgD,EAChD,aAA4B,EAC5B,EAAE;IACF,KAAK,CAAC,GAAG;SACN,IAAI,CAAC;;mFAEyE,eAAK,CAAC,IAAI,CACzF,iBAAiB,CAClB,yBAAyB,CAAC,CAAC;IAE5B,MAAM,cAAc,GAAY,MAAM,IAAA,wBAAgB,EACpD,KAAK,CAAC,MAAM,CAAC;QACX,OAAO,EAAE,qDAAqD;QAC9D,OAAO,EAAE;YACP;gBACE,KAAK,EAAE,sBAAsB;gBAC7B,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,8CAA8C;aACrD;YACD;gBACE,KAAK,EAAE,0CAA0C;gBACjD,KAAK,EAAE,KAAK;aACb;SACF;KACF,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,MAAM,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC;IAEvD,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,qBAAS,EAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAA,6BAAc,EAAC,aAAa,CAAC,CAAC,CAAC;QACzE,KAAK,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC9D,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,+DAA+D,CAChE,CAAC;KACH;SAAM;QACL,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,uBAAuB,eAAK,CAAC,IAAI,CAC/B,yBAAyB,CAC1B,wCAAwC,eAAK,CAAC,IAAI,CACjD,
|
|
1
|
+
{"version":3,"file":"remix.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools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AAC,cAAc,CAAC,aAAa,CACrE,CAAC;QAEF,8FAA8F;QAC9F,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAEzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;;oCAEiB,eAAK,CAAC,IAAI,CACxC,8CAA8C,CAC/C;CACJ,CAAC,CAAC;QAEC,MAAM,IAAA,wBAAgB,EACpB,KAAK,CAAC,MAAM,CAAC;YACX,OAAO,EAAE,yDAAyD;YAClE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACnD,YAAY,EAAE,IAAI;SACnB,CAAC,CACH,CAAC;KACH;AACH,CAAC,CAAC;AAtEW,QAAA,8BAA8B,kCAsEzC;AAEF,MAAM,WAAW,GAAG,eAAK,CAAC,IAAI,CAAC;;IAE3B,eAAK,CAAC,WAAW,CACjB,6EAA6E,CAC9E;;CAEF,CAAC,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { runRemixWizard } from '../../remix/remix-wizard';\nimport { traceStep } from '../../telemetry';\nimport { abortIfCancelled } from '../../utils/clack';\nimport type { WizardOptions } from '../../utils/types';\nimport type { SourceMapUploadToolConfigurationOptions } from './types';\n\nimport * as Sentry from '@sentry/node';\n\nexport const configureRemixSourceMapsUpload = async (\n options: SourceMapUploadToolConfigurationOptions,\n wizardOptions: WizardOptions,\n) => {\n clack.log\n .info(`Source Maps upload for Remix is configured automatically by default if you run the Sentry Wizard for Remix.\nBut don't worry, we can redirect you to the wizard now!\nIn case you already tried the wizard, we can also show you how to configure your ${chalk.cyan(\n 'remix.config.js',\n )} file manually instead.`);\n\n const shouldRedirect: boolean = await abortIfCancelled(\n clack.select({\n message: 'Do you want to run the Sentry Wizard for Remix now?',\n options: [\n {\n label: 'Yes, run the wizard!',\n value: true,\n hint: 'The wizard can also configure your SDK setup',\n },\n {\n label: 'No, show me how to configure it manually',\n value: false,\n },\n ],\n }),\n );\n\n Sentry.setTag('redirect-remix-wizard', shouldRedirect);\n\n if (shouldRedirect) {\n await traceStep('run-remix-wizard', () => runRemixWizard(wizardOptions));\n clack.intro('Sentry Source Maps Upload Configuration Wizard');\n clack.log.info(\n \"Welcome back to the Source Maps wizard - we're almost done ;)\",\n );\n } else {\n clack.log.step(\n `Build your app with ${chalk.cyan(\n 'remix build --sourcemap',\n )}, then upload your source maps using ${chalk.cyan(\n 'npx @sentry/remix --upload-sourcemaps',\n )} cli tool.`,\n );\n\n clack.log.step(\n `You can add ${chalk.cyan(\n 'npx @sentry/remix --upload-sourcemaps',\n )} to your build script in ${chalk.cyan('package.json')} like this:`,\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(codeSnippet);\n\n clack.log.step(`or run it manually after building your app.\n\nTo see all available options, run ${chalk.cyan(\n 'npx @sentry/remix --upload-sourcemaps --help',\n )}\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you finish configuring your build and prod scripts?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n }\n};\n\nconst codeSnippet = chalk.gray(`\n\"scripts\": {\n ${chalk.greenBright(\n '\"build\": \"remix build --sourcemap && npx @sentry/remix --upload-sourcemaps\"',\n )};\n}\n`);\n"]}
|