@sentry/wizard 3.3.2 → 3.5.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 +18 -0
- package/bin.ts +29 -19
- package/dist/bin.js +23 -18
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +0 -9
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +26 -10
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.d.ts → NextJsShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.js → NextJsShim.js} +13 -10
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +1 -0
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +4 -1
- package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.d.ts → SvelteKitShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.js → SvelteKitShim.js} +13 -10
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +1 -0
- package/dist/package.json +3 -3
- package/dist/src/nextjs/nextjs-wizard.d.ts +2 -5
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +2 -5
- package/dist/src/sourcemaps/sourcemaps-wizard.js +68 -31
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.d.ts +1 -0
- package/dist/src/sourcemaps/tools/create-react-app.js +69 -0
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -0
- package/dist/src/sourcemaps/tools/esbuild.d.ts +2 -0
- package/dist/src/sourcemaps/tools/esbuild.js +109 -0
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -0
- package/dist/src/sourcemaps/tools/rollup.d.ts +2 -0
- package/dist/src/sourcemaps/tools/rollup.js +109 -0
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -0
- package/dist/src/sourcemaps/tools/sentry-cli.d.ts +2 -2
- package/dist/src/sourcemaps/tools/sentry-cli.js +111 -91
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.d.ts +1 -0
- package/dist/src/sourcemaps/tools/tsc.js +93 -0
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -0
- package/dist/src/sourcemaps/utils/sdk-version.d.ts +14 -0
- package/dist/src/sourcemaps/utils/sdk-version.js +275 -0
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -0
- package/dist/src/sveltekit/sveltekit-wizard.d.ts +2 -5
- package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +13 -2
- package/dist/src/utils/clack-utils.js +78 -45
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +12 -0
- package/dist/src/utils/types.js +3 -0
- package/dist/src/utils/types.js.map +1 -0
- package/lib/Helper/Wizard.ts +0 -9
- package/lib/Setup.ts +1 -0
- package/lib/Steps/ChooseIntegration.ts +35 -11
- package/lib/Steps/Integrations/{NextJs.ts → NextJsShim.ts} +5 -2
- package/lib/Steps/Integrations/SourceMapsShim.ts +4 -1
- package/lib/Steps/Integrations/{SvelteKit.ts → SvelteKitShim.ts} +5 -2
- package/package.json +3 -3
- package/src/nextjs/nextjs-wizard.ts +3 -8
- package/src/sourcemaps/sourcemaps-wizard.ts +67 -38
- package/src/sourcemaps/tools/create-react-app.ts +19 -0
- package/src/sourcemaps/tools/esbuild.ts +65 -0
- package/src/sourcemaps/tools/rollup.ts +69 -0
- package/src/sourcemaps/tools/sentry-cli.ts +114 -105
- package/src/sourcemaps/tools/tsc.ts +39 -0
- package/src/sourcemaps/utils/sdk-version.ts +264 -0
- package/src/sveltekit/sveltekit-wizard.ts +3 -6
- package/src/utils/clack-utils.ts +71 -29
- package/src/utils/types.ts +13 -0
- package/dist/lib/Steps/Integrations/NextJs.js.map +0 -1
- package/dist/lib/Steps/Integrations/SvelteKit.js.map +0 -1
package/src/utils/clack-utils.ts
CHANGED
|
@@ -11,6 +11,10 @@ import { promisify } from 'util';
|
|
|
11
11
|
import * as Sentry from '@sentry/node';
|
|
12
12
|
import { windowedSelect } from './vendor/clack-custom-select';
|
|
13
13
|
|
|
14
|
+
const opn = require('opn') as (
|
|
15
|
+
url: string,
|
|
16
|
+
) => Promise<childProcess.ChildProcess>;
|
|
17
|
+
|
|
14
18
|
const SAAS_URL = 'https://sentry.io/';
|
|
15
19
|
|
|
16
20
|
interface WizardProjectData {
|
|
@@ -92,7 +96,7 @@ export function printWelcome(options: {
|
|
|
92
96
|
|
|
93
97
|
let welcomeText =
|
|
94
98
|
options.message ||
|
|
95
|
-
'This Wizard will help you
|
|
99
|
+
'This Wizard will help you set up Sentry for your application.\nThank you for using Sentry :)';
|
|
96
100
|
|
|
97
101
|
if (options.promoCode) {
|
|
98
102
|
welcomeText += `\n\nUsing promo-code: ${options.promoCode}`;
|
|
@@ -179,18 +183,23 @@ export async function askForWizardLogin(options: {
|
|
|
179
183
|
loginUrl.searchParams.set('code', options.promoCode);
|
|
180
184
|
}
|
|
181
185
|
|
|
186
|
+
const urlToOpen = loginUrl.toString();
|
|
182
187
|
clack.log.info(
|
|
183
188
|
`${chalk.bold(
|
|
184
|
-
`
|
|
189
|
+
`If the browser window didn't open automatically, please open the following link to ${
|
|
185
190
|
hasSentryAccount ? 'log' : 'sign'
|
|
186
191
|
} into Sentry:`,
|
|
187
|
-
)}\n\n${chalk.cyan(
|
|
192
|
+
)}\n\n${chalk.cyan(urlToOpen)}`,
|
|
188
193
|
);
|
|
189
194
|
|
|
195
|
+
opn(urlToOpen).catch(() => {
|
|
196
|
+
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
197
|
+
});
|
|
198
|
+
|
|
190
199
|
const loginSpinner = clack.spinner();
|
|
191
200
|
|
|
192
201
|
loginSpinner.start(
|
|
193
|
-
|
|
202
|
+
"Waiting for you to log in using the link above. Once you're logged in, return to this wizard.",
|
|
194
203
|
);
|
|
195
204
|
|
|
196
205
|
const data = await new Promise<WizardProjectData>((resolve) => {
|
|
@@ -250,11 +259,13 @@ export async function askForProjectSelection(
|
|
|
250
259
|
export async function installPackage({
|
|
251
260
|
packageName,
|
|
252
261
|
alreadyInstalled,
|
|
262
|
+
askBeforeUpdating = true,
|
|
253
263
|
}: {
|
|
254
264
|
packageName: string;
|
|
255
265
|
alreadyInstalled: boolean;
|
|
266
|
+
askBeforeUpdating?: boolean;
|
|
256
267
|
}): Promise<void> {
|
|
257
|
-
if (alreadyInstalled) {
|
|
268
|
+
if (alreadyInstalled && askBeforeUpdating) {
|
|
258
269
|
const shouldUpdatePackage = await abortIfCancelled(
|
|
259
270
|
clack.confirm({
|
|
260
271
|
message: `The ${chalk.bold.cyan(
|
|
@@ -306,34 +317,55 @@ export async function installPackage({
|
|
|
306
317
|
);
|
|
307
318
|
}
|
|
308
319
|
|
|
309
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.
|
|
322
|
+
*
|
|
323
|
+
* If users started the wizard with a --url arg, that URL is used as the default and we skip
|
|
324
|
+
* the self-hosted question. However, the passed url is still validated and in case it's
|
|
325
|
+
* invalid, users are asked to enter a new one until it is valid.
|
|
326
|
+
*
|
|
327
|
+
* @param urlFromArgs the url passed via the --url arg
|
|
328
|
+
*/
|
|
329
|
+
export async function askForSelfHosted(urlFromArgs?: string): Promise<{
|
|
310
330
|
url: string;
|
|
311
331
|
selfHosted: boolean;
|
|
312
332
|
}> {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
333
|
+
if (!urlFromArgs) {
|
|
334
|
+
const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(
|
|
335
|
+
clack.select({
|
|
336
|
+
message: 'Are you using Sentry SaaS or self-hosted Sentry?',
|
|
337
|
+
options: [
|
|
338
|
+
{ value: 'saas', label: 'Sentry SaaS (sentry.io)' },
|
|
339
|
+
{
|
|
340
|
+
value: 'self-hosted',
|
|
341
|
+
label: 'Self-hosted/on-premise/single-tenant',
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
}),
|
|
345
|
+
);
|
|
322
346
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
347
|
+
if (choice === 'saas') {
|
|
348
|
+
Sentry.setTag('url', SAAS_URL);
|
|
349
|
+
Sentry.setTag('self-hosted', false);
|
|
350
|
+
return { url: SAAS_URL, selfHosted: false };
|
|
351
|
+
}
|
|
327
352
|
}
|
|
328
353
|
|
|
329
354
|
let validUrl: string | undefined;
|
|
355
|
+
let tmpUrlFromArgs = urlFromArgs;
|
|
356
|
+
|
|
330
357
|
while (validUrl === undefined) {
|
|
331
|
-
const url =
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
358
|
+
const url =
|
|
359
|
+
tmpUrlFromArgs ||
|
|
360
|
+
(await abortIfCancelled(
|
|
361
|
+
clack.text({
|
|
362
|
+
message: `Please enter the URL of your ${
|
|
363
|
+
urlFromArgs ? '' : 'self-hosted '
|
|
364
|
+
}Sentry instance.`,
|
|
365
|
+
placeholder: 'https://sentry.io/',
|
|
366
|
+
}),
|
|
367
|
+
));
|
|
368
|
+
tmpUrlFromArgs = undefined;
|
|
337
369
|
|
|
338
370
|
try {
|
|
339
371
|
validUrl = new URL(url).toString();
|
|
@@ -344,13 +376,16 @@ export async function askForSelfHosted(): Promise<{
|
|
|
344
376
|
}
|
|
345
377
|
} catch {
|
|
346
378
|
clack.log.error(
|
|
347
|
-
'Please enter a valid URL. (It should look something like "
|
|
379
|
+
'Please enter a valid URL. (It should look something like "https://sentry.mydomain.com/")',
|
|
348
380
|
);
|
|
349
381
|
}
|
|
350
382
|
}
|
|
351
383
|
|
|
384
|
+
const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;
|
|
385
|
+
|
|
352
386
|
Sentry.setTag('url', validUrl);
|
|
353
|
-
Sentry.setTag('self-hosted',
|
|
387
|
+
Sentry.setTag('self-hosted', isSelfHostedUrl);
|
|
388
|
+
|
|
354
389
|
return { url: validUrl, selfHosted: true };
|
|
355
390
|
}
|
|
356
391
|
|
|
@@ -553,9 +588,16 @@ export function hasPackageInstalled(
|
|
|
553
588
|
packageName: string,
|
|
554
589
|
packageJson: PackageDotJson,
|
|
555
590
|
): boolean {
|
|
591
|
+
return getPackageVersion(packageName, packageJson) !== undefined;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export function getPackageVersion(
|
|
595
|
+
packageName: string,
|
|
596
|
+
packageJson: PackageDotJson,
|
|
597
|
+
): string | undefined {
|
|
556
598
|
return (
|
|
557
|
-
|
|
558
|
-
|
|
599
|
+
packageJson?.dependencies?.[packageName] ||
|
|
600
|
+
packageJson?.devDependencies?.[packageName]
|
|
559
601
|
);
|
|
560
602
|
}
|
|
561
603
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type WizardOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* The promo code to use while signing up for Sentry.
|
|
4
|
+
* This can be passed via the --promo-code arg.
|
|
5
|
+
*/
|
|
6
|
+
promoCode?: string;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The url of the Sentry instance to use.
|
|
10
|
+
* This can be passed via the `-u` or `--url` arg.
|
|
11
|
+
*/
|
|
12
|
+
url?: string;
|
|
13
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mEAAoE;AAGpE,qDAAoD;AAEpD;;;GAGG;AACH;IAA4B,0BAAe;IACzC,gBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SACb;QAF4B,WAAK,GAAL,KAAK,CAAM;;IAExC,CAAC;IAEY,qBAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,+BAAe,EAAC,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAA;;wBAA1D,SAA0D,CAAC;wBAC3D,sBAAO,EAAE,EAAC;;;;KACX;IAEY,gCAAe,GAA5B,UAA6B,QAAiB;;;gBAC5C,kEAAkE;gBAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE;oBACzB,sBAAO,IAAI,CAAC,gBAAgB,EAAC;iBAC9B;gBACD,6DAA6D;gBAC7D,sBAAO,IAAI,CAAC,eAAe,EAAC;;;KAC7B;IACH,aAAC;AAAD,CAAC,AAlBD,CAA4B,iCAAe,GAkB1C;AAlBY,wBAAM","sourcesContent":["import type { Answers } from 'inquirer';\nimport { runNextjsWizard } from '../../../src/nextjs/nextjs-wizard';\n\nimport type { Args } from '../../Constants';\nimport { BaseIntegration } from './BaseIntegration';\n\n/**\n * This class just redirects to the new `nextjs-wizard.ts` flow\n * for anyone calling the wizard without the '-i nextjs' flag.\n */\nexport class NextJs extends BaseIntegration {\n public constructor(protected _argv: Args) {\n super(_argv);\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runNextjsWizard({ promoCode: this._argv.promoCode });\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SvelteKit.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/SvelteKit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAA6E;AAG7E,qDAAoD;AAEpD;;;GAGG;AACH;IAA+B,6BAAe;IAC5C,mBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SACb;QAF4B,WAAK,GAAL,KAAK,CAAM;;IAExC,CAAC;IAEY,wBAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,qCAAkB,EAAC,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAA;;wBAA7D,SAA6D,CAAC;wBAC9D,sBAAO,EAAE,EAAC;;;;KACX;IAEY,mCAAe,GAA5B,UAA6B,QAAiB;;;gBAC5C,kEAAkE;gBAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE;oBACzB,sBAAO,IAAI,CAAC,gBAAgB,EAAC;iBAC9B;gBACD,6DAA6D;gBAC7D,sBAAO,IAAI,CAAC,eAAe,EAAC;;;KAC7B;IACH,gBAAC;AAAD,CAAC,AAlBD,CAA+B,iCAAe,GAkB7C;AAlBY,8BAAS","sourcesContent":["import type { Answers } from 'inquirer';\nimport { runSvelteKitWizard } from '../../../src/sveltekit/sveltekit-wizard';\n\nimport type { Args } from '../../Constants';\nimport { BaseIntegration } from './BaseIntegration';\n\n/**\n * This class just redirects to the new `sveltekit-wizard.ts` flow\n * for anyone calling the wizard without the '-i sveltekit' flag.\n */\nexport class SvelteKit extends BaseIntegration {\n public constructor(protected _argv: Args) {\n super(_argv);\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runSvelteKitWizard({ promoCode: this._argv.promoCode });\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n}\n"]}
|