@sentry/wizard 3.25.1 → 3.26.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 +14 -0
- package/bin.ts +10 -2
- package/dist/bin.js +12 -3
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/Env.js +1 -0
- package/dist/lib/Helper/Env.js.map +1 -1
- package/dist/lib/Setup.d.ts +6 -0
- package/dist/lib/Setup.js +6 -0
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +0 -29
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/OpenSentry.js +1 -1
- package/dist/lib/Steps/OpenSentry.js.map +1 -1
- package/dist/package.json +2 -1
- package/dist/src/nextjs/nextjs-wizard.d.ts +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +166 -84
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +3 -2
- package/dist/src/nextjs/templates.js +10 -8
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/run.d.ts +16 -0
- package/dist/src/run.js +195 -0
- package/dist/src/run.js.map +1 -0
- package/dist/src/telemetry.js +10 -3
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/clack-utils.js +35 -11
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/package-json.d.ts +1 -0
- package/dist/src/utils/package-json.js.map +1 -1
- package/dist/src/utils/package-manager.d.ts +1 -1
- package/dist/src/utils/package-manager.js +5 -52
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +14 -0
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/lib/Helper/Env.ts +1 -0
- package/lib/Setup.ts +6 -0
- package/lib/Steps/ChooseIntegration.ts +0 -29
- package/lib/Steps/OpenSentry.ts +1 -1
- package/package.json +2 -1
- package/src/nextjs/nextjs-wizard.ts +188 -99
- package/src/nextjs/templates.ts +19 -4
- package/src/run.ts +142 -0
- package/src/telemetry.ts +7 -1
- package/src/utils/clack-utils.ts +44 -7
- package/src/utils/package-json.ts +1 -0
- package/src/utils/package-manager.ts +5 -9
- package/test/nextjs/templates.test.ts +56 -0
- package/dist/lib/Steps/Integrations/Android.d.ts +0 -9
- package/dist/lib/Steps/Integrations/Android.js +0 -86
- package/dist/lib/Steps/Integrations/Android.js.map +0 -1
- package/dist/lib/Steps/Integrations/Apple.d.ts +0 -10
- package/dist/lib/Steps/Integrations/Apple.js +0 -92
- package/dist/lib/Steps/Integrations/Apple.js.map +0 -1
- package/dist/lib/Steps/Integrations/NextJsShim.d.ts +0 -13
- package/dist/lib/Steps/Integrations/NextJsShim.js +0 -99
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +0 -1
- package/dist/lib/Steps/Integrations/ReactNative.d.ts +0 -10
- package/dist/lib/Steps/Integrations/ReactNative.js +0 -93
- package/dist/lib/Steps/Integrations/ReactNative.js.map +0 -1
- package/dist/lib/Steps/Integrations/Remix.d.ts +0 -12
- package/dist/lib/Steps/Integrations/Remix.js +0 -98
- package/dist/lib/Steps/Integrations/Remix.js.map +0 -1
- package/dist/lib/Steps/Integrations/SourceMapsShim.d.ts +0 -13
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +0 -94
- package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +0 -1
- package/dist/lib/Steps/Integrations/SvelteKitShim.d.ts +0 -13
- package/dist/lib/Steps/Integrations/SvelteKitShim.js +0 -99
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +0 -1
- package/lib/Steps/Integrations/Android.ts +0 -23
- package/lib/Steps/Integrations/Apple.ts +0 -27
- package/lib/Steps/Integrations/NextJsShim.ts +0 -33
- package/lib/Steps/Integrations/ReactNative.ts +0 -28
- package/lib/Steps/Integrations/Remix.ts +0 -32
- package/lib/Steps/Integrations/SourceMapsShim.ts +0 -28
- package/lib/Steps/Integrations/SvelteKitShim.ts +0 -33
package/src/nextjs/templates.ts
CHANGED
|
@@ -7,6 +7,7 @@ type WithSentryConfigOptions = {
|
|
|
7
7
|
selfHosted: boolean;
|
|
8
8
|
sentryUrl: string;
|
|
9
9
|
tunnelRoute: boolean;
|
|
10
|
+
reactComponentAnnotation: boolean;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export function getWithSentryConfigOptionsTemplate({
|
|
@@ -14,6 +15,7 @@ export function getWithSentryConfigOptionsTemplate({
|
|
|
14
15
|
projectSlug,
|
|
15
16
|
selfHosted,
|
|
16
17
|
tunnelRoute,
|
|
18
|
+
reactComponentAnnotation,
|
|
17
19
|
sentryUrl,
|
|
18
20
|
}: WithSentryConfigOptions): string {
|
|
19
21
|
return `{
|
|
@@ -32,7 +34,15 @@ export function getWithSentryConfigOptionsTemplate({
|
|
|
32
34
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
|
33
35
|
|
|
34
36
|
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
|
35
|
-
widenClientFileUpload: true
|
|
37
|
+
widenClientFileUpload: true,${
|
|
38
|
+
reactComponentAnnotation
|
|
39
|
+
? `\n
|
|
40
|
+
// Automatically annotate React components to show their full name in breadcrumbs and session replay
|
|
41
|
+
reactComponentAnnotation: {
|
|
42
|
+
enabled: true,
|
|
43
|
+
},`
|
|
44
|
+
: ''
|
|
45
|
+
}
|
|
36
46
|
|
|
37
47
|
// ${
|
|
38
48
|
tunnelRoute ? 'Route' : 'Uncomment to route'
|
|
@@ -125,7 +135,6 @@ export function getSentryConfigContents(
|
|
|
125
135
|
let additionalOptions = '';
|
|
126
136
|
if (config === 'client') {
|
|
127
137
|
additionalOptions = `
|
|
128
|
-
|
|
129
138
|
replaysOnErrorSampleRate: 1.0,
|
|
130
139
|
|
|
131
140
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
@@ -261,7 +270,7 @@ export default function Page() {
|
|
|
261
270
|
`;
|
|
262
271
|
}
|
|
263
272
|
|
|
264
|
-
export function
|
|
273
|
+
export function getSentryExamplePagesDirApiRoute() {
|
|
265
274
|
return `// A faulty API route to test Sentry's error monitoring
|
|
266
275
|
export default function handler(_req, res) {
|
|
267
276
|
throw new Error("Sentry Example API Route Error");
|
|
@@ -307,16 +316,19 @@ export default CustomErrorComponent;
|
|
|
307
316
|
export function getSimpleUnderscoreErrorCopyPasteSnippet() {
|
|
308
317
|
return `
|
|
309
318
|
${chalk.green(`import * as Sentry from '@sentry/nextjs';`)}
|
|
319
|
+
${chalk.green(`import Error from "next/error";`)}
|
|
310
320
|
|
|
311
321
|
${chalk.dim(
|
|
312
322
|
'// Replace "YourCustomErrorComponent" with your custom error component!',
|
|
313
323
|
)}
|
|
314
324
|
YourCustomErrorComponent.getInitialProps = async (${chalk.green(
|
|
315
|
-
|
|
325
|
+
'contextData',
|
|
316
326
|
)}) => {
|
|
317
327
|
${chalk.green('await Sentry.captureUnderscoreErrorException(contextData);')}
|
|
318
328
|
|
|
319
329
|
${chalk.dim('// ...other getInitialProps code')}
|
|
330
|
+
|
|
331
|
+
return Error.getInitialProps(contextData);
|
|
320
332
|
};
|
|
321
333
|
`;
|
|
322
334
|
}
|
|
@@ -326,6 +338,7 @@ export function getFullUnderscoreErrorCopyPasteSnippet(isTs: boolean) {
|
|
|
326
338
|
import * as Sentry from '@sentry/nextjs';${
|
|
327
339
|
isTs ? '\nimport type { NextPageContext } from "next";' : ''
|
|
328
340
|
}
|
|
341
|
+
import Error from "next/error";
|
|
329
342
|
|
|
330
343
|
${chalk.dim(
|
|
331
344
|
'// Replace "YourCustomErrorComponent" with your custom error component!',
|
|
@@ -334,6 +347,8 @@ YourCustomErrorComponent.getInitialProps = async (contextData${
|
|
|
334
347
|
isTs ? ': NextPageContext' : ''
|
|
335
348
|
}) => {
|
|
336
349
|
await Sentry.captureUnderscoreErrorException(contextData);
|
|
350
|
+
|
|
351
|
+
return Error.getInitialProps(contextData);
|
|
337
352
|
};
|
|
338
353
|
`;
|
|
339
354
|
}
|
package/src/run.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
2
|
+
import * as clack from '@clack/prompts';
|
|
3
|
+
import { abortIfCancelled } from './utils/clack-utils';
|
|
4
|
+
import { runReactNativeWizard } from './react-native/react-native-wizard';
|
|
5
|
+
|
|
6
|
+
import { run as legacyRun } from '../lib/Setup';
|
|
7
|
+
import { WizardOptions } from './utils/types';
|
|
8
|
+
import { runAndroidWizard } from './android/android-wizard';
|
|
9
|
+
import { runAppleWizard } from './apple/apple-wizard';
|
|
10
|
+
import { runNextjsWizard } from './nextjs/nextjs-wizard';
|
|
11
|
+
import { runRemixWizard } from './remix/remix-wizard';
|
|
12
|
+
import { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';
|
|
13
|
+
import { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';
|
|
14
|
+
import { readEnvironment } from '../lib/Helper/Env';
|
|
15
|
+
import { Platform } from '../lib/Constants';
|
|
16
|
+
import { PackageDotJson } from './utils/package-json';
|
|
17
|
+
|
|
18
|
+
type WizardIntegration =
|
|
19
|
+
| 'reactNative'
|
|
20
|
+
| 'ios'
|
|
21
|
+
| 'android'
|
|
22
|
+
| 'cordova'
|
|
23
|
+
| 'electron'
|
|
24
|
+
| 'nextjs'
|
|
25
|
+
| 'remix'
|
|
26
|
+
| 'sveltekit'
|
|
27
|
+
| 'sourcemaps';
|
|
28
|
+
|
|
29
|
+
type Args = {
|
|
30
|
+
integration?: WizardIntegration;
|
|
31
|
+
|
|
32
|
+
uninstall: boolean;
|
|
33
|
+
signup: boolean;
|
|
34
|
+
skipConnect: boolean;
|
|
35
|
+
debug: boolean;
|
|
36
|
+
quiet: boolean;
|
|
37
|
+
disableTelemetry: boolean;
|
|
38
|
+
promoCode?: string;
|
|
39
|
+
|
|
40
|
+
url?: string;
|
|
41
|
+
platform?: Platform[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export async function run(argv: Args) {
|
|
45
|
+
const finalArgs = {
|
|
46
|
+
...argv,
|
|
47
|
+
...readEnvironment(),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
let integration = finalArgs.integration;
|
|
51
|
+
if (!integration) {
|
|
52
|
+
clack.intro(`Sentry Wizard ${tryGetWizardVersion()}`);
|
|
53
|
+
|
|
54
|
+
integration = await abortIfCancelled(
|
|
55
|
+
clack.select({
|
|
56
|
+
message: 'What do you want to set up?',
|
|
57
|
+
options: [
|
|
58
|
+
{ value: 'reactNative', label: 'React Native' },
|
|
59
|
+
{ value: 'ios', label: 'iOS' },
|
|
60
|
+
{ value: 'android', label: 'Android' },
|
|
61
|
+
{ value: 'cordova', label: 'Cordova' },
|
|
62
|
+
{ value: 'electron', label: 'Electron' },
|
|
63
|
+
{ value: 'nextjs', label: 'NextJS' },
|
|
64
|
+
{ value: 'remix', label: 'Remix' },
|
|
65
|
+
{ value: 'sveltekit', label: 'SvelteKit' },
|
|
66
|
+
{ value: 'sourcemaps', label: 'Configure Source Maps Upload' },
|
|
67
|
+
],
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
if (!integration) {
|
|
72
|
+
clack.log.error('No integration selected. Exiting.');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
clack.outro(`Starting ${integration} setup`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const wizardOptions: WizardOptions = {
|
|
80
|
+
telemetryEnabled: !argv.disableTelemetry,
|
|
81
|
+
promoCode: argv.promoCode,
|
|
82
|
+
url: argv.url,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
switch (integration) {
|
|
86
|
+
case 'reactNative':
|
|
87
|
+
await runReactNativeWizard({
|
|
88
|
+
...wizardOptions,
|
|
89
|
+
uninstall: argv.uninstall,
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
case 'ios':
|
|
94
|
+
await runAppleWizard(wizardOptions);
|
|
95
|
+
break;
|
|
96
|
+
|
|
97
|
+
case 'android':
|
|
98
|
+
await runAndroidWizard(wizardOptions);
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
case 'nextjs':
|
|
102
|
+
await runNextjsWizard(wizardOptions);
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
case 'remix':
|
|
106
|
+
await runRemixWizard(wizardOptions);
|
|
107
|
+
break;
|
|
108
|
+
|
|
109
|
+
case 'sveltekit':
|
|
110
|
+
await runSvelteKitWizard(wizardOptions);
|
|
111
|
+
break;
|
|
112
|
+
|
|
113
|
+
case 'sourcemaps':
|
|
114
|
+
await runSourcemapsWizard(wizardOptions);
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
case 'cordova':
|
|
118
|
+
argv.integration = 'cordova';
|
|
119
|
+
void legacyRun(argv);
|
|
120
|
+
break;
|
|
121
|
+
|
|
122
|
+
case 'electron':
|
|
123
|
+
argv.integration = 'electron';
|
|
124
|
+
void legacyRun(argv);
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
default:
|
|
128
|
+
clack.log.error(`No setup wizard selected!`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* TODO: replace with rollup replace whenever we switch to rollup
|
|
134
|
+
*/
|
|
135
|
+
function tryGetWizardVersion(): string {
|
|
136
|
+
try {
|
|
137
|
+
const wizardPkgJson = require('../package.json') as PackageDotJson;
|
|
138
|
+
return wizardPkgJson.version ?? '';
|
|
139
|
+
} catch {
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
}
|
package/src/telemetry.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
runWithAsyncContext,
|
|
9
9
|
setTag,
|
|
10
10
|
startSpan,
|
|
11
|
+
flush,
|
|
11
12
|
} from '@sentry/node';
|
|
12
13
|
import packageJson from '../package.json';
|
|
13
14
|
|
|
@@ -49,7 +50,12 @@ export async function withTelemetry<F>(
|
|
|
49
50
|
throw e;
|
|
50
51
|
} finally {
|
|
51
52
|
sentryHub.endSession();
|
|
52
|
-
await sentryClient.flush(3000)
|
|
53
|
+
await sentryClient.flush(3000).then(null, () => {
|
|
54
|
+
// If telemetry flushing fails we generally don't care
|
|
55
|
+
});
|
|
56
|
+
await flush(3000).then(null, () => {
|
|
57
|
+
// If telemetry flushing fails we generally don't care
|
|
58
|
+
});
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
|
package/src/utils/clack-utils.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { traceStep } from '../telemetry';
|
|
|
15
15
|
import {
|
|
16
16
|
detectPackageManger,
|
|
17
17
|
PackageManager,
|
|
18
|
-
installPackageWithPackageManager,
|
|
19
18
|
packageManagers,
|
|
20
19
|
} from './package-manager';
|
|
21
20
|
import { debug } from './debug';
|
|
@@ -23,6 +22,9 @@ import { fulfillsVersionRange } from './semver';
|
|
|
23
22
|
|
|
24
23
|
const opn = require('opn') as (
|
|
25
24
|
url: string,
|
|
25
|
+
options?: {
|
|
26
|
+
wait?: boolean;
|
|
27
|
+
},
|
|
26
28
|
) => Promise<childProcess.ChildProcess>;
|
|
27
29
|
|
|
28
30
|
export const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';
|
|
@@ -383,7 +385,31 @@ export async function installPackage({
|
|
|
383
385
|
);
|
|
384
386
|
|
|
385
387
|
try {
|
|
386
|
-
await
|
|
388
|
+
await new Promise<void>((resolve, reject) => {
|
|
389
|
+
childProcess.exec(
|
|
390
|
+
`${packageManager.installCommand} ${packageName} ${packageManager.flags}`,
|
|
391
|
+
(err, stdout, stderr) => {
|
|
392
|
+
if (err) {
|
|
393
|
+
// Write a log file so we can better troubleshoot issues
|
|
394
|
+
fs.writeFileSync(
|
|
395
|
+
path.join(
|
|
396
|
+
process.cwd(),
|
|
397
|
+
`sentry-wizard-installation-error-${Date.now()}.log`,
|
|
398
|
+
),
|
|
399
|
+
JSON.stringify({
|
|
400
|
+
stdout,
|
|
401
|
+
stderr,
|
|
402
|
+
}),
|
|
403
|
+
{ encoding: 'utf8' },
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
reject(err);
|
|
407
|
+
} else {
|
|
408
|
+
resolve();
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
);
|
|
412
|
+
});
|
|
387
413
|
} catch (e) {
|
|
388
414
|
sdkInstallSpinner.stop('Installation failed.');
|
|
389
415
|
clack.log.error(
|
|
@@ -391,7 +417,7 @@ export async function installPackage({
|
|
|
391
417
|
'Encountered the following error during installation:',
|
|
392
418
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
393
419
|
)}\n\n${e}\n\n${chalk.dim(
|
|
394
|
-
|
|
420
|
+
"The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\nhttps://github.com/getsentry/sentry-wizard/issues",
|
|
395
421
|
)}`,
|
|
396
422
|
);
|
|
397
423
|
await abort();
|
|
@@ -614,10 +640,21 @@ SENTRY_AUTH_TOKEN=${authToken}
|
|
|
614
640
|
}
|
|
615
641
|
|
|
616
642
|
async function addCliConfigFileToGitIgnore(filename: string): Promise<void> {
|
|
617
|
-
|
|
643
|
+
const gitignorePath = path.join(process.cwd(), '.gitignore');
|
|
644
|
+
|
|
618
645
|
try {
|
|
646
|
+
const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');
|
|
647
|
+
if (gitignoreContent.split(/\r?\n/).includes(filename)) {
|
|
648
|
+
clack.log.info(
|
|
649
|
+
`${chalk.bold('.gitignore')} already has ${chalk.bold(
|
|
650
|
+
filename,
|
|
651
|
+
)}. Will not add it again.`,
|
|
652
|
+
);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
|
|
619
656
|
await fs.promises.appendFile(
|
|
620
|
-
|
|
657
|
+
gitignorePath,
|
|
621
658
|
`\n# Sentry Config File\n${filename}\n`,
|
|
622
659
|
{ encoding: 'utf8' },
|
|
623
660
|
);
|
|
@@ -875,7 +912,7 @@ async function askForSelfHosted(urlFromArgs?: string): Promise<{
|
|
|
875
912
|
}
|
|
876
913
|
} catch {
|
|
877
914
|
clack.log.error(
|
|
878
|
-
|
|
915
|
+
`Please enter a valid URL. (It should look something like "https://sentry.mydomain.com/", got ${url})`,
|
|
879
916
|
);
|
|
880
917
|
}
|
|
881
918
|
}
|
|
@@ -958,7 +995,7 @@ async function askForWizardLogin(options: {
|
|
|
958
995
|
)}\n\n${chalk.cyan(urlToOpen)}`,
|
|
959
996
|
);
|
|
960
997
|
|
|
961
|
-
opn(urlToOpen).catch(() => {
|
|
998
|
+
opn(urlToOpen, { wait: false }).catch(() => {
|
|
962
999
|
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
963
1000
|
});
|
|
964
1001
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/typedef */
|
|
2
|
-
import { exec } from 'child_process';
|
|
3
2
|
import * as fs from 'fs';
|
|
4
3
|
import * as path from 'path';
|
|
5
|
-
import { promisify } from 'util';
|
|
6
4
|
|
|
7
5
|
import * as Sentry from '@sentry/node';
|
|
8
6
|
import { traceStep } from '../telemetry';
|
|
@@ -15,6 +13,7 @@ export interface PackageManager {
|
|
|
15
13
|
buildCommand: string;
|
|
16
14
|
/* The command that the package manager uses to run a script from package.json */
|
|
17
15
|
runScriptCommand: string;
|
|
16
|
+
flags: string;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export const BUN: PackageManager = {
|
|
@@ -24,6 +23,7 @@ export const BUN: PackageManager = {
|
|
|
24
23
|
installCommand: 'bun add',
|
|
25
24
|
buildCommand: 'bun run build',
|
|
26
25
|
runScriptCommand: 'bun run',
|
|
26
|
+
flags: '',
|
|
27
27
|
};
|
|
28
28
|
export const YARN: PackageManager = {
|
|
29
29
|
name: 'yarn',
|
|
@@ -32,6 +32,7 @@ export const YARN: PackageManager = {
|
|
|
32
32
|
installCommand: 'yarn add',
|
|
33
33
|
buildCommand: 'yarn build',
|
|
34
34
|
runScriptCommand: 'yarn',
|
|
35
|
+
flags: '--ignore-workspace-root-check',
|
|
35
36
|
};
|
|
36
37
|
export const PNPM: PackageManager = {
|
|
37
38
|
name: 'pnpm',
|
|
@@ -40,6 +41,7 @@ export const PNPM: PackageManager = {
|
|
|
40
41
|
installCommand: 'pnpm add',
|
|
41
42
|
buildCommand: 'pnpm build',
|
|
42
43
|
runScriptCommand: 'pnpm',
|
|
44
|
+
flags: '--ignore-workspace-root-check',
|
|
43
45
|
};
|
|
44
46
|
export const NPM: PackageManager = {
|
|
45
47
|
name: 'npm',
|
|
@@ -48,6 +50,7 @@ export const NPM: PackageManager = {
|
|
|
48
50
|
installCommand: 'npm add',
|
|
49
51
|
buildCommand: 'npm run build',
|
|
50
52
|
runScriptCommand: 'npm run',
|
|
53
|
+
flags: '',
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
export const packageManagers = [BUN, YARN, PNPM, NPM];
|
|
@@ -64,10 +67,3 @@ export function detectPackageManger(): PackageManager | null {
|
|
|
64
67
|
return null;
|
|
65
68
|
});
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
export async function installPackageWithPackageManager(
|
|
69
|
-
packageManager: PackageManager,
|
|
70
|
-
packageName: string,
|
|
71
|
-
): Promise<void> {
|
|
72
|
-
await promisify(exec)(`${packageManager.installCommand} ${packageName}`);
|
|
73
|
-
}
|
|
@@ -9,6 +9,7 @@ describe('NextJS code templates', () => {
|
|
|
9
9
|
selfHosted: false,
|
|
10
10
|
sentryUrl: 'https://dont-use-this-url.com',
|
|
11
11
|
tunnelRoute: true,
|
|
12
|
+
reactComponentAnnotation: false,
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
expect(template).toMatchInlineSnapshot(`
|
|
@@ -56,6 +57,7 @@ describe('NextJS code templates', () => {
|
|
|
56
57
|
selfHosted: true,
|
|
57
58
|
sentryUrl: 'https://my-sentry.com',
|
|
58
59
|
tunnelRoute: true,
|
|
60
|
+
reactComponentAnnotation: false,
|
|
59
61
|
});
|
|
60
62
|
|
|
61
63
|
expect(template).toMatchInlineSnapshot(`
|
|
@@ -104,6 +106,7 @@ describe('NextJS code templates', () => {
|
|
|
104
106
|
selfHosted: false,
|
|
105
107
|
sentryUrl: 'https://dont-use-this-url.com',
|
|
106
108
|
tunnelRoute: false,
|
|
109
|
+
reactComponentAnnotation: false,
|
|
107
110
|
});
|
|
108
111
|
|
|
109
112
|
expect(template).toMatchInlineSnapshot(`
|
|
@@ -143,5 +146,58 @@ describe('NextJS code templates', () => {
|
|
|
143
146
|
}"
|
|
144
147
|
`);
|
|
145
148
|
});
|
|
149
|
+
|
|
150
|
+
it('adds `reactComponentAnnotations` option if `reactComponentAnnotations` is enabled', () => {
|
|
151
|
+
const template = getWithSentryConfigOptionsTemplate({
|
|
152
|
+
orgSlug: 'my-org',
|
|
153
|
+
projectSlug: 'my-project',
|
|
154
|
+
selfHosted: false,
|
|
155
|
+
sentryUrl: 'https://dont-use-this-url.com',
|
|
156
|
+
tunnelRoute: true,
|
|
157
|
+
reactComponentAnnotation: true,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
expect(template).toMatchInlineSnapshot(`
|
|
161
|
+
"{
|
|
162
|
+
// For all available options, see:
|
|
163
|
+
// https://github.com/getsentry/sentry-webpack-plugin#options
|
|
164
|
+
|
|
165
|
+
org: "my-org",
|
|
166
|
+
project: "my-project",
|
|
167
|
+
|
|
168
|
+
// Only print logs for uploading source maps in CI
|
|
169
|
+
silent: !process.env.CI,
|
|
170
|
+
|
|
171
|
+
// For all available options, see:
|
|
172
|
+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
|
173
|
+
|
|
174
|
+
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
|
175
|
+
widenClientFileUpload: true,
|
|
176
|
+
|
|
177
|
+
// Automatically annotate React components to show their full name in breadcrumbs and session replay
|
|
178
|
+
reactComponentAnnotation: {
|
|
179
|
+
enabled: true,
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
|
183
|
+
// This can increase your server load as well as your hosting bill.
|
|
184
|
+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
|
185
|
+
// side errors will fail.
|
|
186
|
+
tunnelRoute: "/monitoring",
|
|
187
|
+
|
|
188
|
+
// Hides source maps from generated client bundles
|
|
189
|
+
hideSourceMaps: true,
|
|
190
|
+
|
|
191
|
+
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
|
192
|
+
disableLogger: true,
|
|
193
|
+
|
|
194
|
+
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
|
|
195
|
+
// See the following for more information:
|
|
196
|
+
// https://docs.sentry.io/product/crons/
|
|
197
|
+
// https://vercel.com/docs/cron-jobs
|
|
198
|
+
automaticVercelMonitors: true,
|
|
199
|
+
}"
|
|
200
|
+
`);
|
|
201
|
+
});
|
|
146
202
|
});
|
|
147
203
|
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
2
|
-
import { BaseIntegration } from './BaseIntegration';
|
|
3
|
-
import { Args } from '../../Constants';
|
|
4
|
-
export declare class Android extends BaseIntegration {
|
|
5
|
-
protected _argv: Args;
|
|
6
|
-
constructor(_argv: Args);
|
|
7
|
-
emit(_answers: Answers): Promise<Answers>;
|
|
8
|
-
shouldConfigure(_answers: Answers): Promise<Answers>;
|
|
9
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.Android = void 0;
|
|
55
|
-
var BaseIntegration_1 = require("./BaseIntegration");
|
|
56
|
-
var android_wizard_1 = require("../../../src/android/android-wizard");
|
|
57
|
-
var Android = /** @class */ (function (_super) {
|
|
58
|
-
__extends(Android, _super);
|
|
59
|
-
function Android(_argv) {
|
|
60
|
-
var _this = _super.call(this, _argv) || this;
|
|
61
|
-
_this._argv = _argv;
|
|
62
|
-
return _this;
|
|
63
|
-
}
|
|
64
|
-
Android.prototype.emit = function (_answers) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0: return [4 /*yield*/, (0, android_wizard_1.runAndroidWizard)({
|
|
69
|
-
promoCode: this._argv.promoCode,
|
|
70
|
-
url: this._argv.url,
|
|
71
|
-
telemetryEnabled: !this._argv.disableTelemetry,
|
|
72
|
-
})];
|
|
73
|
-
case 1:
|
|
74
|
-
_a.sent();
|
|
75
|
-
return [2 /*return*/, {}];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
Android.prototype.shouldConfigure = function (_answers) {
|
|
81
|
-
return this._shouldConfigure;
|
|
82
|
-
};
|
|
83
|
-
return Android;
|
|
84
|
-
}(BaseIntegration_1.BaseIntegration));
|
|
85
|
-
exports.Android = Android;
|
|
86
|
-
//# sourceMappingURL=Android.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Android.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Android.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAoD;AAEpD,sEAAuE;AAEvE;IAA6B,2BAAe;IAC1C,iBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SACb;QAF4B,WAAK,GAAL,KAAK,CAAM;;IAExC,CAAC;IAEY,sBAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,iCAAgB,EAAC;4BACrB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;4BAC/B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;4BACnB,gBAAgB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;yBAC/C,CAAC,EAAA;;wBAJF,SAIE,CAAC;wBACH,sBAAO,EAAE,EAAC;;;;KACX;IAEM,iCAAe,GAAtB,UAAuB,QAAiB;QACtC,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IACH,cAAC;AAAD,CAAC,AAjBD,CAA6B,iCAAe,GAiB3C;AAjBY,0BAAO","sourcesContent":["import { Answers } from 'inquirer';\nimport { BaseIntegration } from './BaseIntegration';\nimport { Args } from '../../Constants';\nimport { runAndroidWizard } from '../../../src/android/android-wizard';\n\nexport class Android extends BaseIntegration {\n public constructor(protected _argv: Args) {\n super(_argv);\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runAndroidWizard({\n promoCode: this._argv.promoCode,\n url: this._argv.url,\n telemetryEnabled: !this._argv.disableTelemetry,\n });\n return {};\n }\n\n public shouldConfigure(_answers: Answers): Promise<Answers> {\n return this._shouldConfigure;\n }\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
2
|
-
import type { Args } from '../../Constants';
|
|
3
|
-
import { BaseIntegration } from './BaseIntegration';
|
|
4
|
-
export declare class Apple extends BaseIntegration {
|
|
5
|
-
protected _argv: Args;
|
|
6
|
-
argv: Args;
|
|
7
|
-
constructor(_argv: Args);
|
|
8
|
-
emit(_answers: Answers): Promise<Answers>;
|
|
9
|
-
shouldConfigure(_answers: Answers): Promise<Answers>;
|
|
10
|
-
}
|