@sentry/wizard 3.18.1 → 3.20.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 +12 -0
- package/dist/package.json +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +29 -15
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/remix/codemods/express-server.d.ts +6 -0
- package/dist/src/remix/codemods/express-server.js +216 -0
- package/dist/src/remix/codemods/express-server.js.map +1 -0
- package/dist/src/remix/remix-wizard.js +25 -0
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-setup.d.ts +1 -0
- package/dist/src/remix/sdk-setup.js +23 -1
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +2 -0
- package/dist/src/sourcemaps/sourcemaps-wizard.js +3 -2
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +24 -9
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +3 -2
- package/dist/src/utils/clack-utils.js +25 -3
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/nextjs/nextjs-wizard.ts +35 -27
- package/src/remix/codemods/express-server.ts +197 -0
- package/src/remix/remix-wizard.ts +20 -0
- package/src/remix/sdk-setup.ts +17 -0
- package/src/sourcemaps/sourcemaps-wizard.ts +2 -2
- package/src/sveltekit/sveltekit-wizard.ts +49 -33
- package/src/utils/clack-utils.ts +23 -2
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
isRemixV2,
|
|
24
24
|
loadRemixConfig,
|
|
25
25
|
runRemixReveal,
|
|
26
|
+
instrumentExpressServer,
|
|
26
27
|
} from './sdk-setup';
|
|
27
28
|
import { debug } from '../utils/debug';
|
|
28
29
|
import { traceStep, withTelemetry } from '../telemetry';
|
|
@@ -152,6 +153,25 @@ async function runRemixWizardWithTelemetry(
|
|
|
152
153
|
}
|
|
153
154
|
});
|
|
154
155
|
|
|
156
|
+
await traceStep('Instrument custom Express server', async () => {
|
|
157
|
+
try {
|
|
158
|
+
const hasExpressAdapter = hasPackageInstalled(
|
|
159
|
+
'@remix-run/express',
|
|
160
|
+
packageJson,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
if (!hasExpressAdapter) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
await instrumentExpressServer();
|
|
168
|
+
} catch (e) {
|
|
169
|
+
clack.log.warn(`Could not instrument custom Express server.
|
|
170
|
+
Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#custom-express-server`);
|
|
171
|
+
debug(e);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
155
175
|
clack.outro(`
|
|
156
176
|
${chalk.green(
|
|
157
177
|
'Sentry has been successfully configured for your Remix project.',
|
package/src/remix/sdk-setup.ts
CHANGED
|
@@ -22,6 +22,10 @@ import { getInitCallInsertionIndex, hasSentryContent } from './utils';
|
|
|
22
22
|
import { instrumentRootRouteV1 } from './codemods/root-v1';
|
|
23
23
|
import { instrumentRootRouteV2 } from './codemods/root-v2';
|
|
24
24
|
import { instrumentHandleError } from './codemods/handle-error';
|
|
25
|
+
import {
|
|
26
|
+
findCustomExpressServerImplementation,
|
|
27
|
+
instrumentExpressCreateRequestHandler,
|
|
28
|
+
} from './codemods/express-server';
|
|
25
29
|
import { getPackageDotJson } from '../utils/clack-utils';
|
|
26
30
|
|
|
27
31
|
export type PartialRemixConfig = {
|
|
@@ -347,3 +351,16 @@ export async function initializeSentryOnEntryServer(
|
|
|
347
351
|
)}.`,
|
|
348
352
|
);
|
|
349
353
|
}
|
|
354
|
+
|
|
355
|
+
export async function instrumentExpressServer() {
|
|
356
|
+
const expressServerPath = await findCustomExpressServerImplementation();
|
|
357
|
+
|
|
358
|
+
if (!expressServerPath) {
|
|
359
|
+
clack.log.warn(
|
|
360
|
+
`Could not find custom Express server implementation. Please instrument it manually.`,
|
|
361
|
+
);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
await instrumentExpressCreateRequestHandler(expressServerPath);
|
|
366
|
+
}
|
|
@@ -233,7 +233,7 @@ async function startToolSetupFlow(
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
async function configureCI(
|
|
236
|
+
export async function configureCI(
|
|
237
237
|
selectedTool: SupportedTools,
|
|
238
238
|
authToken: string,
|
|
239
239
|
): Promise<void> {
|
|
@@ -243,7 +243,7 @@ async function configureCI(
|
|
|
243
243
|
options: [
|
|
244
244
|
{
|
|
245
245
|
label: 'Yes',
|
|
246
|
-
hint: 'I use a tool like Github Actions, Gitlab, CircleCI, TravisCI, Jenkins, ...',
|
|
246
|
+
hint: 'I use a tool like Github Actions, Gitlab, CircleCI, TravisCI, Jenkins, Vercel, ...',
|
|
247
247
|
value: true,
|
|
248
248
|
},
|
|
249
249
|
{
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
abort,
|
|
9
9
|
abortIfCancelled,
|
|
10
10
|
addSentryCliConfig,
|
|
11
|
+
askShouldCreateExamplePage,
|
|
11
12
|
confirmContinueIfNoOrDirtyGitRepo,
|
|
12
13
|
ensurePackageIsInstalled,
|
|
13
14
|
getOrAskForProjectData,
|
|
@@ -21,6 +22,7 @@ import { createExamplePage } from './sdk-example';
|
|
|
21
22
|
import { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';
|
|
22
23
|
import { traceStep, withTelemetry } from '../telemetry';
|
|
23
24
|
import { getKitVersionBucket, getSvelteVersionBucket } from './utils';
|
|
25
|
+
import { NPM, detectPackageManger } from '../utils/package-manager';
|
|
24
26
|
|
|
25
27
|
export async function runSvelteKitWizard(
|
|
26
28
|
options: WizardOptions,
|
|
@@ -128,41 +130,55 @@ export async function runSvelteKitWizardWithTelemetry(
|
|
|
128
130
|
return;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
133
|
+
const shouldCreateExamplePage = await askShouldCreateExamplePage(
|
|
134
|
+
'sentry-example',
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
if (shouldCreateExamplePage) {
|
|
138
|
+
try {
|
|
139
|
+
await traceStep('create-example-page', () =>
|
|
140
|
+
createExamplePage(svelteConfig, {
|
|
141
|
+
selfHosted,
|
|
142
|
+
url: sentryUrl,
|
|
143
|
+
orgSlug: selectedProject.organization.slug,
|
|
144
|
+
projectId: selectedProject.id,
|
|
145
|
+
}),
|
|
146
|
+
);
|
|
147
|
+
} catch (e: unknown) {
|
|
148
|
+
clack.log.error('Error while creating an example page to test Sentry:');
|
|
149
|
+
clack.log.info(
|
|
150
|
+
chalk.dim(
|
|
151
|
+
typeof e === 'object' && e != null && 'toString' in e
|
|
152
|
+
? e.toString()
|
|
153
|
+
: typeof e === 'string'
|
|
154
|
+
? e
|
|
155
|
+
: 'Unknown error',
|
|
156
|
+
),
|
|
157
|
+
);
|
|
158
|
+
Sentry.captureException(
|
|
159
|
+
'Error while creating an example Svelte page to test Sentry',
|
|
160
|
+
);
|
|
161
|
+
await abort('Exiting Wizard');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
156
164
|
}
|
|
157
165
|
|
|
158
|
-
clack.outro(
|
|
159
|
-
|
|
166
|
+
clack.outro(buildOutroMessage(shouldCreateExamplePage));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function buildOutroMessage(shouldCreateExamplePage: boolean): string {
|
|
170
|
+
const packageManager = detectPackageManger() || NPM;
|
|
171
|
+
|
|
172
|
+
let msg = chalk.green('\nSuccessfully installed the Sentry SvelteKit SDK!');
|
|
173
|
+
|
|
174
|
+
if (shouldCreateExamplePage) {
|
|
175
|
+
msg += `\n\nYou can validate your setup by starting your dev environment (${chalk.cyan(
|
|
176
|
+
`\`${packageManager.runScriptCommand} dev\``,
|
|
177
|
+
)}) and visiting ${chalk.cyan('"/sentry-example"')}.`;
|
|
178
|
+
}
|
|
160
179
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
)}
|
|
180
|
+
msg += `\n\nCheck out the SDK documentation for further configuration:
|
|
181
|
+
https://docs.sentry.io/platforms/javascript/guides/sveltekit/`;
|
|
164
182
|
|
|
165
|
-
|
|
166
|
-
https://docs.sentry.io/platforms/javascript/guides/sveltekit/
|
|
167
|
-
`);
|
|
183
|
+
return msg;
|
|
168
184
|
}
|
package/src/utils/clack-utils.ts
CHANGED
|
@@ -1126,7 +1126,7 @@ type CodeSnippetFormatter = (
|
|
|
1126
1126
|
* This is useful for printing the snippet to the console as part of copy/paste instructions.
|
|
1127
1127
|
*
|
|
1128
1128
|
* @param callback the callback that returns the formatted code snippet.
|
|
1129
|
-
* It exposes takes the helper functions for marking code as
|
|
1129
|
+
* It exposes takes the helper functions for marking code as unchanged, new or removed.
|
|
1130
1130
|
* These functions no-op if no special formatting should be applied
|
|
1131
1131
|
* and otherwise apply the appropriate formatting/coloring.
|
|
1132
1132
|
* (@see {@link CodeSnippetFormatter})
|
|
@@ -1161,7 +1161,7 @@ export function makeCodeSnippet(
|
|
|
1161
1161
|
* @param moreInformation (optional) the message to be printed after the file was created
|
|
1162
1162
|
* For example, this can be a link to more information about configuring the tool.
|
|
1163
1163
|
*
|
|
1164
|
-
* @returns true on
|
|
1164
|
+
* @returns true on success, false otherwise
|
|
1165
1165
|
*/
|
|
1166
1166
|
export async function createNewConfigFile(
|
|
1167
1167
|
filepath: string,
|
|
@@ -1194,3 +1194,24 @@ export async function createNewConfigFile(
|
|
|
1194
1194
|
|
|
1195
1195
|
return false;
|
|
1196
1196
|
}
|
|
1197
|
+
|
|
1198
|
+
export async function askShouldCreateExamplePage(
|
|
1199
|
+
customRoute?: string,
|
|
1200
|
+
): Promise<boolean> {
|
|
1201
|
+
const route = chalk.cyan(customRoute ?? '/sentry-example-page');
|
|
1202
|
+
return traceStep('ask-create-example-page', () =>
|
|
1203
|
+
abortIfCancelled(
|
|
1204
|
+
clack.select({
|
|
1205
|
+
message: `Do you want to create an example page ("${route}") to test your Sentry setup?`,
|
|
1206
|
+
options: [
|
|
1207
|
+
{
|
|
1208
|
+
value: true,
|
|
1209
|
+
label: 'Yes',
|
|
1210
|
+
hint: 'Recommended - Check your git status before committing!',
|
|
1211
|
+
},
|
|
1212
|
+
{ value: false, label: 'No' },
|
|
1213
|
+
],
|
|
1214
|
+
}),
|
|
1215
|
+
),
|
|
1216
|
+
);
|
|
1217
|
+
}
|