@sentry/wizard 3.34.1 → 3.34.2
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 +4 -0
- package/dist/package.json +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +33 -26
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +3 -1
- package/dist/src/utils/clack-utils.js +2 -2
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/nextjs/nextjs-wizard.ts +8 -6
- package/src/utils/clack-utils.ts +4 -2
package/CHANGELOG.md
CHANGED
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.34.
|
|
3
|
+
"version": "3.34.2",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -98,10 +98,10 @@ exports.runNextjsWizard = runNextjsWizard;
|
|
|
98
98
|
function runNextjsWizardWithTelemetry(options) {
|
|
99
99
|
var _a;
|
|
100
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
-
var typeScriptDetected, packageJson, nextVersion, _b, selectedProject, authToken, selfHosted, sentryUrl, sdkAlreadyInstalled, shouldCreateExamplePage, isLikelyUsingTurbopack, mightBeUsingVercel,
|
|
101
|
+
var typeScriptDetected, packageJson, nextVersion, _b, selectedProject, authToken, selfHosted, sentryUrl, sdkAlreadyInstalled, packageManagerFromInstallStep, shouldCreateExamplePage, isLikelyUsingTurbopack, mightBeUsingVercel, packageManagerForOutro, _c;
|
|
102
102
|
var _this = this;
|
|
103
|
-
return __generator(this, function (
|
|
104
|
-
switch (
|
|
103
|
+
return __generator(this, function (_d) {
|
|
104
|
+
switch (_d.label) {
|
|
105
105
|
case 0:
|
|
106
106
|
(0, clack_utils_1.printWelcome)({
|
|
107
107
|
wizardName: 'Sentry Next.js Wizard',
|
|
@@ -111,18 +111,18 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
111
111
|
typeScriptDetected = (0, clack_utils_1.isUsingTypeScript)();
|
|
112
112
|
return [4 /*yield*/, (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)()];
|
|
113
113
|
case 1:
|
|
114
|
-
|
|
114
|
+
_d.sent();
|
|
115
115
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
116
116
|
case 2:
|
|
117
|
-
packageJson =
|
|
117
|
+
packageJson = _d.sent();
|
|
118
118
|
return [4 /*yield*/, (0, clack_utils_1.ensurePackageIsInstalled)(packageJson, 'next', 'Next.js')];
|
|
119
119
|
case 3:
|
|
120
|
-
|
|
120
|
+
_d.sent();
|
|
121
121
|
nextVersion = (0, package_json_1.getPackageVersion)('next', packageJson);
|
|
122
122
|
Sentry.setTag('nextjs-version', (0, utils_1.getNextJsVersionBucket)(nextVersion));
|
|
123
123
|
return [4 /*yield*/, (0, clack_utils_1.getOrAskForProjectData)(options, 'javascript-nextjs')];
|
|
124
124
|
case 4:
|
|
125
|
-
_b =
|
|
125
|
+
_b = _d.sent(), selectedProject = _b.selectedProject, authToken = _b.authToken, selfHosted = _b.selfHosted, sentryUrl = _b.sentryUrl;
|
|
126
126
|
sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('@sentry/nextjs', packageJson);
|
|
127
127
|
Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
|
|
128
128
|
return [4 /*yield*/, (0, clack_utils_1.installPackage)({
|
|
@@ -130,7 +130,7 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
130
130
|
alreadyInstalled: !!((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.dependencies) === null || _a === void 0 ? void 0 : _a['@sentry/nextjs']),
|
|
131
131
|
})];
|
|
132
132
|
case 5:
|
|
133
|
-
|
|
133
|
+
packageManagerFromInstallStep = (_d.sent()).packageManager;
|
|
134
134
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('configure-sdk', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
135
135
|
var tunnelRoute, reactComponentAnnotation;
|
|
136
136
|
return __generator(this, function (_a) {
|
|
@@ -152,7 +152,7 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
152
152
|
});
|
|
153
153
|
}); })];
|
|
154
154
|
case 6:
|
|
155
|
-
|
|
155
|
+
_d.sent();
|
|
156
156
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('create-underscoreerror-page', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
157
157
|
var srcDir, maybePagesDirPath, maybeSrcPagesDirPath, pagesLocation, underscoreErrorPageFile, shouldContinue, shouldContinue;
|
|
158
158
|
return __generator(this, function (_a) {
|
|
@@ -228,7 +228,7 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
228
228
|
});
|
|
229
229
|
}); })];
|
|
230
230
|
case 7:
|
|
231
|
-
|
|
231
|
+
_d.sent();
|
|
232
232
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('create-global-error-page', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
233
233
|
var maybeAppDirPath, maybeSrcAppDirPath, appDirLocation, globalErrorPageFile, newGlobalErrorFileName, shouldContinue;
|
|
234
234
|
return __generator(this, function (_a) {
|
|
@@ -284,23 +284,23 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
284
284
|
});
|
|
285
285
|
}); })];
|
|
286
286
|
case 8:
|
|
287
|
-
|
|
287
|
+
_d.sent();
|
|
288
288
|
return [4 /*yield*/, (0, clack_utils_1.askShouldCreateExamplePage)()];
|
|
289
289
|
case 9:
|
|
290
|
-
shouldCreateExamplePage =
|
|
290
|
+
shouldCreateExamplePage = _d.sent();
|
|
291
291
|
if (!shouldCreateExamplePage) return [3 /*break*/, 11];
|
|
292
292
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('create-example-page', function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
293
293
|
return [2 /*return*/, createExamplePage(selfHosted, selectedProject, sentryUrl)];
|
|
294
294
|
}); }); })];
|
|
295
295
|
case 10:
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
_d.sent();
|
|
297
|
+
_d.label = 11;
|
|
298
298
|
case 11: return [4 /*yield*/, (0, clack_utils_1.addDotEnvSentryBuildPluginFile)(authToken)];
|
|
299
299
|
case 12:
|
|
300
|
-
|
|
300
|
+
_d.sent();
|
|
301
301
|
return [4 /*yield*/, checkIfLikelyIsUsingTurbopack()];
|
|
302
302
|
case 13:
|
|
303
|
-
isLikelyUsingTurbopack =
|
|
303
|
+
isLikelyUsingTurbopack = _d.sent();
|
|
304
304
|
if (!(isLikelyUsingTurbopack || isLikelyUsingTurbopack === null)) return [3 /*break*/, 15];
|
|
305
305
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
306
306
|
message: "Warning: The Sentry SDK doesn't yet fully support Turbopack in dev mode. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. Production builds will still fully work. ".concat(chalk_1.default.bold("To continue this setup, if you are using Turbopack, temporarily remove `--turbo` from your dev command until you have verified the SDK is working as expected.")),
|
|
@@ -314,8 +314,8 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
314
314
|
initialValue: true,
|
|
315
315
|
}))];
|
|
316
316
|
case 14:
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
_d.sent();
|
|
318
|
+
_d.label = 15;
|
|
319
319
|
case 15:
|
|
320
320
|
mightBeUsingVercel = fs.existsSync(path.join(process.cwd(), 'vercel.json'));
|
|
321
321
|
if (!mightBeUsingVercel) return [3 /*break*/, 16];
|
|
@@ -323,16 +323,23 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
323
323
|
return [3 /*break*/, 18];
|
|
324
324
|
case 16: return [4 /*yield*/, (0, telemetry_1.traceStep)('configure-ci', function () { return (0, sourcemaps_wizard_1.configureCI)('nextjs', authToken); })];
|
|
325
325
|
case 17:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
case 18:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
return [
|
|
326
|
+
_d.sent();
|
|
327
|
+
_d.label = 18;
|
|
328
|
+
case 18:
|
|
329
|
+
if (!(packageManagerFromInstallStep !== null && packageManagerFromInstallStep !== void 0)) return [3 /*break*/, 19];
|
|
330
|
+
_c = packageManagerFromInstallStep;
|
|
331
|
+
return [3 /*break*/, 21];
|
|
332
|
+
case 19: return [4 /*yield*/, (0, clack_utils_1.getPackageManager)()];
|
|
332
333
|
case 20:
|
|
333
|
-
_c.sent();
|
|
334
|
+
_c = (_d.sent());
|
|
335
|
+
_d.label = 21;
|
|
336
|
+
case 21:
|
|
337
|
+
packageManagerForOutro = _c;
|
|
338
|
+
return [4 /*yield*/, (0, clack_utils_1.runPrettierIfInstalled)()];
|
|
339
|
+
case 22:
|
|
340
|
+
_d.sent();
|
|
334
341
|
prompts_1.default.outro("\n".concat(chalk_1.default.green('Successfully installed the Sentry Next.js SDK!'), " ").concat(shouldCreateExamplePage
|
|
335
|
-
? "\n\nYou can validate your setup by (re)starting your dev environment (e.g. ".concat(chalk_1.default.cyan("".concat(
|
|
342
|
+
? "\n\nYou can validate your setup by (re)starting your dev environment (e.g. ".concat(chalk_1.default.cyan("".concat(packageManagerForOutro.runScriptCommand, " dev")), ") and visiting ").concat(chalk_1.default.cyan('"/sentry-example-page"'))
|
|
336
343
|
: '').concat(shouldCreateExamplePage && isLikelyUsingTurbopack
|
|
337
344
|
? "\nDon't forget to remove `--turbo` from your dev command until you have verified the SDK is working. You can safely add it back afterwards."
|
|
338
345
|
: '', "\n\n").concat(chalk_1.default.dim('If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues')));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-wizard.js","sourceRoot":"","sources":["../../../src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EAAE,IAAI;gDACX,IAAI,EAAE,yDAAyD;6CAChE;4CACD;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,8CAA8C;6CACrD;yCACF;wCACD,YAAY,EAAE,IAAI;qCACnB,CAAC,CACH,EAAA;;oCAlBK,oCAAoC,GAAG,SAkB5C;oCAED,sBAAO,oCAAoC,EAAC;;;yBAC7C,CAAC,EAAA;wBAtBF,sBAAO,SAsBL,EAAC;;;;CACJ;AAED;;GAEG;AACH,SAAe,6BAA6B;;;;;;;oBAGnB,qBAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,MAAM,CACP,EAAA;;oBAHD,kBAAkB,GAAG,SAGpB,CAAC;;;;oBAEF,sBAAO,IAAI,EAAC;wBAGd,sBAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAC;;;;CAC/C","sourcesContent":["/* eslint-disable max-lines */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\n// @ts-ignore - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, parseModule } from 'magicast';\nimport * as path from 'path';\n\nimport * as Sentry from '@sentry/node';\n\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n createNewConfigFile,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n showCopyPasteInstructions,\n} from '../utils/clack-utils';\nimport type { SentryProjectData, WizardOptions } from '../utils/types';\nimport {\n getFullUnderscoreErrorCopyPasteSnippet,\n getGlobalErrorCopyPasteSnippet,\n getInstrumentationHookContent,\n getInstrumentationHookCopyPasteSnippet,\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getSentryConfigContents,\n getSentryDefaultGlobalErrorPage,\n getSentryDefaultUnderscoreErrorPage,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n getSentryExamplePageContents,\n getSimpleUnderscoreErrorCopyPasteSnippet,\n getWithSentryConfigOptionsTemplate,\n} from './templates';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { getNextJsVersionBucket } from './utils';\nimport { configureCI } from '../sourcemaps/sourcemaps-wizard';\n\nexport function runNextjsWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nextjs',\n wizardOptions: options,\n },\n () => runNextjsWizardWithTelemetry(options),\n );\n}\n\nexport async function runNextjsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n const typeScriptDetected = isUsingTypeScript();\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const nextVersion = getPackageVersion('next', packageJson);\n Sentry.setTag('nextjs-version', getNextJsVersionBucket(nextVersion));\n\n const { selectedProject, authToken, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nextjs');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/nextjs',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/nextjs@^8',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n });\n\n await traceStep('configure-sdk', async () => {\n const tunnelRoute = await askShouldSetTunnelRoute();\n const reactComponentAnnotation =\n await askShouldEnableReactComponentAnnotation();\n\n await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {\n tunnelRoute,\n reactComponentAnnotation,\n });\n });\n\n await traceStep('create-underscoreerror-page', async () => {\n const srcDir = path.join(process.cwd(), 'src');\n const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(srcDir, 'pages');\n\n const pagesLocation =\n fs.existsSync(maybePagesDirPath) &&\n fs.lstatSync(maybePagesDirPath).isDirectory()\n ? ['pages']\n : fs.existsSync(maybeSrcPagesDirPath) &&\n fs.lstatSync(maybeSrcPagesDirPath).isDirectory()\n ? ['src', 'pages']\n : undefined;\n\n if (!pagesLocation) {\n return;\n }\n\n const underscoreErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...pagesLocation, '_error.tsx'),\n )\n ? '_error.tsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.ts'))\n ? '_error.ts'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.jsx'))\n ? '_error.jsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.js'))\n ? '_error.js'\n : undefined;\n\n if (!underscoreErrorPageFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, '_error.jsx'),\n getSentryDefaultUnderscoreErrorPage(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(path.join(...pagesLocation, '_error.jsx'))}.`,\n );\n } else if (\n fs\n .readFileSync(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorPageFile),\n 'utf8',\n )\n .includes('getInitialProps')\n ) {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease put the following function call in the ${chalk.bold(\n 'getInitialProps',\n )}\\nmethod of your custom error page at ${chalk.bold(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(getSimpleUnderscoreErrorCopyPasteSnippet());\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you modify your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n } else {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getFullUnderscoreErrorCopyPasteSnippet(\n underscoreErrorPageFile === '_error.ts' ||\n underscoreErrorPageFile === '_error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did add the code to your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('create-global-error-page', async () => {\n const maybeAppDirPath = path.join(process.cwd(), 'app');\n const maybeSrcAppDirPath = path.join(process.cwd(), 'src', 'app');\n\n const appDirLocation =\n fs.existsSync(maybeAppDirPath) &&\n fs.lstatSync(maybeAppDirPath).isDirectory()\n ? ['app']\n : fs.existsSync(maybeSrcAppDirPath) &&\n fs.lstatSync(maybeSrcAppDirPath).isDirectory()\n ? ['src', 'app']\n : undefined;\n\n if (!appDirLocation) {\n return;\n }\n\n const globalErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.tsx'),\n )\n ? 'global-error.tsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.ts'),\n )\n ? 'global-error.ts'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.jsx'),\n )\n ? 'global-error.jsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.js'),\n )\n ? 'global-error.js'\n : undefined;\n\n if (!globalErrorPageFile) {\n const newGlobalErrorFileName = `global-error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...appDirLocation, newGlobalErrorFileName),\n getSentryDefaultGlobalErrorPage(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newGlobalErrorFileName),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a custom error page for your app directory.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )}:\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getGlobalErrorCopyPasteSnippet(\n globalErrorPageFile === 'global-error.ts' ||\n globalErrorPageFile === 'global-error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did add the code to your ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(selfHosted, selectedProject, sentryUrl),\n );\n }\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const isLikelyUsingTurbopack = await checkIfLikelyIsUsingTurbopack();\n if (isLikelyUsingTurbopack || isLikelyUsingTurbopack === null) {\n await abortIfCancelled(\n clack.select({\n message: `Warning: The Sentry SDK doesn't yet fully support Turbopack in dev mode. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. Production builds will still fully work. ${chalk.bold(\n `To continue this setup, if you are using Turbopack, temporarily remove \\`--turbo\\` from your dev command until you have verified the SDK is working as expected.`,\n )}`,\n options: [\n {\n label: 'I understand.',\n hint: 'press enter',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n }\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n if (mightBeUsingVercel) {\n clack.log.info(\n \"▲ It seems like you're using Vercel. We recommend using the Sentry Vercel integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry\",\n );\n } else {\n await traceStep('configure-ci', () => configureCI('nextjs', authToken));\n }\n\n const pacMan = await getPackageManager();\n await runPrettierIfInstalled();\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${\n shouldCreateExamplePage\n ? `\\n\\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(\n `${pacMan.runScriptCommand} dev`,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}`\n : ''\n }${\n shouldCreateExamplePage && isLikelyUsingTurbopack\n ? `\\nDon't forget to remove \\`--turbo\\` from your dev command until you have verified the SDK is working. You can safely add it back afterwards.`\n : ''\n }\n\n${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues',\n)}`);\n}\n\ntype SDKConfigOptions = {\n tunnelRoute: boolean;\n reactComponentAnnotation: boolean;\n};\n\nasync function createOrMergeNextJsFiles(\n selectedProject: SentryProjectData,\n selfHosted: boolean,\n sentryUrl: string,\n sdkConfigOptions: SDKConfigOptions,\n) {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client', 'edge'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n selectedFeatures,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n }\n });\n }\n\n await traceStep('setup-instrumentation-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.ts'),\n );\n const instrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.js'),\n );\n const srcInstrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.ts'),\n );\n const srcInstrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationJsExists || instrumentationTsExists) {\n instrumentationHookLocation = 'root';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n } else {\n if (srcInstrumentationTsExists || srcInstrumentationJsExists) {\n instrumentationHookLocation = 'src';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationFileName = `instrumentation.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationHookLocation === 'does-not-exist') {\n let newInstrumentationHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationHookLocation = 'src';\n } else {\n newInstrumentationHookLocation = 'root';\n }\n\n const newInstrumentationHookPath =\n newInstrumentationHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationFileName)\n : path.join(process.cwd(), 'src', newInstrumentationFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationHookPath,\n getInstrumentationHookContent(newInstrumentationHookLocation),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions(\n newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(\n newInstrumentationHookLocation,\n ),\n );\n }\n } else {\n await showCopyPasteInstructions(\n srcInstrumentationTsExists || instrumentationTsExists\n ? 'instrumentation.ts'\n : srcInstrumentationJsExists || instrumentationJsExists\n ? 'instrumentation.js'\n : newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(instrumentationHookLocation),\n );\n }\n });\n\n await traceStep('setup-next-config', async () => {\n const withSentryConfigOptionsTemplate = getWithSentryConfigOptionsTemplate({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n sentryUrl,\n tunnelRoute: sdkConfigOptions.tunnelRoute,\n reactComponentAnnotation: sdkConfigOptions.reactComponentAnnotation,\n });\n\n const nextConfigPossibleFilesMap = {\n js: 'next.config.js',\n mjs: 'next.config.mjs',\n cjs: 'next.config.cjs',\n ts: 'next.config.ts',\n mts: 'next.config.mts',\n cts: 'next.config.cts',\n };\n\n const foundNextConfigFile = Object.entries(nextConfigPossibleFilesMap).find(\n ([, fileName]) => fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!foundNextConfigFile) {\n Sentry.setTag('next-config-strategy', 'create');\n\n await fs.promises.writeFile(\n // We are creating a `next.config.js` file by default as it is supported by the most Next.js versions\n path.join(process.cwd(), nextConfigPossibleFilesMap.js),\n getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan('next.config.js')} with Sentry configuration.`,\n );\n\n return;\n }\n\n const [foundNextConfigFileType, foundNextConfigFileFilename] =\n foundNextConfigFile;\n\n if (foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs') {\n Sentry.setTag('next-config-strategy', 'modify');\n\n const nextConfigCjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigCjsContent.includes('@sentry/nextjs') &&\n nextConfigCjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n if (shouldInject) {\n await fs.promises.appendFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n\n if (\n foundNextConfigFileType === 'mjs' ||\n foundNextConfigFileType === 'mts' ||\n foundNextConfigFileType === 'cts' ||\n foundNextConfigFileType === 'ts'\n ) {\n const nextConfigMjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigMjsContent.includes('@sentry/nextjs') &&\n nextConfigMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n try {\n if (shouldInject) {\n const mod = parseModule(nextConfigMjsContent);\n mod.imports.$add({\n from: '@sentry/nextjs',\n imported: 'withSentryConfig',\n local: 'withSentryConfig',\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n const expressionToWrap = generateCode(mod.exports.default.$ast).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.default = builders.raw(`withSentryConfig(\n ${expressionToWrap},\n ${withSentryConfigOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n } catch {\n Sentry.setTag('next-config-mod-result', 'fail');\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}.`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}: ${chalk.dim('You probably have to clean it up a bit.')}\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n }\n });\n}\n\nfunction hasDirectoryPathFromRoot(dirnameOrDirs: string | string[]): boolean {\n const dirPath = Array.isArray(dirnameOrDirs)\n ? path.join(process.cwd(), ...dirnameOrDirs)\n : path.join(process.cwd(), dirnameOrDirs);\n\n return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory();\n}\n\nasync function createExamplePage(\n selfHosted: boolean,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n): Promise<void> {\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcAppDirectory = hasDirectoryPathFromRoot(['src', 'app']);\n const hasSrcPagesDirectory = hasDirectoryPathFromRoot(['src', 'pages']);\n\n Sentry.setTag('nextjs-app-dir', hasRootAppDirectory || hasSrcAppDirectory);\n\n const typeScriptDetected = isUsingTypeScript();\n\n // If `pages` or an `app` directory exists in the root, we'll put the example page there.\n // `app` directory takes priority over `pages` directory when they coexist, so we prioritize that.\n // https://nextjs.org/docs/app/building-your-application/routing#the-app-router\n\n const appFolderLocation = hasRootAppDirectory\n ? ['app']\n : hasSrcAppDirectory\n ? ['src', 'app']\n : undefined;\n\n let pagesFolderLocation = hasRootPagesDirectory\n ? ['pages']\n : hasSrcPagesDirectory\n ? ['src', 'pages']\n : undefined;\n\n // If the user has neither pages nor app directory we create a pages folder for them\n if (!appFolderLocation && !pagesFolderLocation) {\n const newPagesFolderLocation = hasSrcDirectory\n ? ['src', 'pages']\n : ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...newPagesFolderLocation), {\n recursive: true,\n });\n\n pagesFolderLocation = newPagesFolderLocation;\n }\n\n if (appFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: true,\n });\n\n fs.mkdirSync(\n path.join(process.cwd(), ...appFolderLocation, 'sentry-example-page'),\n {\n recursive: true,\n },\n );\n\n const newPageFileName = `page.${typeScriptDetected ? 'tsx' : 'jsx'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'sentry-example-page',\n newPageFileName,\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, 'sentry-example-page', newPageFileName),\n )}.`,\n );\n\n fs.mkdirSync(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n ),\n {\n recursive: true,\n },\n );\n\n const newRouteFileName = `route.${typeScriptDetected ? 'ts' : 'js'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n getSentryExampleAppDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n )}.`,\n );\n } else if (pagesFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: false,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'sentry-example-page.jsx',\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'sentry-example-page.js'),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesFolderLocation, 'api'), {\n recursive: true,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'api',\n 'sentry-example-api.js',\n ),\n getSentryExamplePagesDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'api', 'sentry-example-api.js'),\n )}.`,\n );\n }\n}\n\n/**\n * Ask users if they want to set the tunnelRoute option.\n * We can't set this by default because it potentially increases hosting bills.\n * It's valuable enough to for users to justify asking the additional question.\n */\nasync function askShouldSetTunnelRoute() {\n return await traceStep('ask-tunnelRoute-option', async () => {\n const shouldSetTunnelRoute = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Can increase your server load and hosting bill',\n },\n {\n label: 'No',\n value: false,\n hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldSetTunnelRoute) {\n clack.log.info(\n \"Sounds good! We'll leave the option commented for later, just in case :)\",\n );\n }\n\n return shouldSetTunnelRoute;\n });\n}\n\nasync function askShouldEnableReactComponentAnnotation() {\n return await traceStep('ask-react-component-annotation-option', async () => {\n const shouldEnableReactComponentAnnotation = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to enable React component annotations to make breadcrumbs and session replays more readable?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Annotates React component names - increases bundle size',\n },\n {\n label: 'No',\n value: false,\n hint: 'Continue without React component annotations',\n },\n ],\n initialValue: true,\n }),\n );\n\n return shouldEnableReactComponentAnnotation;\n });\n}\n\n/**\n * Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.\n */\nasync function checkIfLikelyIsUsingTurbopack(): Promise<boolean | null> {\n let packageJsonContent: string;\n try {\n packageJsonContent = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n } catch {\n return null;\n }\n\n return packageJsonContent.includes('--turbo');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nextjs-wizard.js","sourceRoot":"","sources":["../../../src/nextjs/nextjs-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qCAAyB;AACzB,4EAA4E;AAC5E,qCAA+D;AAC/D,yCAA6B;AAE7B,mDAAuC;AAEvC,oDAiB8B;AAE9B,yCAgBqB;AACrB,0CAAwD;AACxD,sDAA+E;AAC/E,iCAAiD;AACjD,qEAA8D;AAE9D,SAAgB,eAAe,CAAC,OAAsB;IACpD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,QAAQ;QACrB,aAAa,EAAE,OAAO;KACvB,EACD,cAAM,OAAA,4BAA4B,CAAC,OAAO,CAAC,EAArC,CAAqC,CAC5C,CAAC;AACJ,CAAC;AATD,0CASC;AAED,SAAsB,4BAA4B,CAChD,OAAsB;;;;;;;;oBAEtB,IAAA,0BAAY,EAAC;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sBAAO,IAAI,EAAC;wBAGd,sBAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAC;;;;CAC/C","sourcesContent":["/* eslint-disable max-lines */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\n// @ts-ignore - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, parseModule } from 'magicast';\nimport * as path from 'path';\n\nimport * as Sentry from '@sentry/node';\n\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n createNewConfigFile,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n showCopyPasteInstructions,\n} from '../utils/clack-utils';\nimport type { SentryProjectData, WizardOptions } from '../utils/types';\nimport {\n getFullUnderscoreErrorCopyPasteSnippet,\n getGlobalErrorCopyPasteSnippet,\n getInstrumentationHookContent,\n getInstrumentationHookCopyPasteSnippet,\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getSentryConfigContents,\n getSentryDefaultGlobalErrorPage,\n getSentryDefaultUnderscoreErrorPage,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n getSentryExamplePageContents,\n getSimpleUnderscoreErrorCopyPasteSnippet,\n getWithSentryConfigOptionsTemplate,\n} from './templates';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { getNextJsVersionBucket } from './utils';\nimport { configureCI } from '../sourcemaps/sourcemaps-wizard';\n\nexport function runNextjsWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nextjs',\n wizardOptions: options,\n },\n () => runNextjsWizardWithTelemetry(options),\n );\n}\n\nexport async function runNextjsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n const typeScriptDetected = isUsingTypeScript();\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const nextVersion = getPackageVersion('next', packageJson);\n Sentry.setTag('nextjs-version', getNextJsVersionBucket(nextVersion));\n\n const { selectedProject, authToken, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nextjs');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/nextjs',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n const { packageManager: packageManagerFromInstallStep } =\n await installPackage({\n packageName: '@sentry/nextjs@^8',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n });\n\n await traceStep('configure-sdk', async () => {\n const tunnelRoute = await askShouldSetTunnelRoute();\n const reactComponentAnnotation =\n await askShouldEnableReactComponentAnnotation();\n\n await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {\n tunnelRoute,\n reactComponentAnnotation,\n });\n });\n\n await traceStep('create-underscoreerror-page', async () => {\n const srcDir = path.join(process.cwd(), 'src');\n const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(srcDir, 'pages');\n\n const pagesLocation =\n fs.existsSync(maybePagesDirPath) &&\n fs.lstatSync(maybePagesDirPath).isDirectory()\n ? ['pages']\n : fs.existsSync(maybeSrcPagesDirPath) &&\n fs.lstatSync(maybeSrcPagesDirPath).isDirectory()\n ? ['src', 'pages']\n : undefined;\n\n if (!pagesLocation) {\n return;\n }\n\n const underscoreErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...pagesLocation, '_error.tsx'),\n )\n ? '_error.tsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.ts'))\n ? '_error.ts'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.jsx'))\n ? '_error.jsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.js'))\n ? '_error.js'\n : undefined;\n\n if (!underscoreErrorPageFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, '_error.jsx'),\n getSentryDefaultUnderscoreErrorPage(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(path.join(...pagesLocation, '_error.jsx'))}.`,\n );\n } else if (\n fs\n .readFileSync(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorPageFile),\n 'utf8',\n )\n .includes('getInitialProps')\n ) {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease put the following function call in the ${chalk.bold(\n 'getInitialProps',\n )}\\nmethod of your custom error page at ${chalk.bold(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(getSimpleUnderscoreErrorCopyPasteSnippet());\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you modify your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n } else {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getFullUnderscoreErrorCopyPasteSnippet(\n underscoreErrorPageFile === '_error.ts' ||\n underscoreErrorPageFile === '_error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did add the code to your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('create-global-error-page', async () => {\n const maybeAppDirPath = path.join(process.cwd(), 'app');\n const maybeSrcAppDirPath = path.join(process.cwd(), 'src', 'app');\n\n const appDirLocation =\n fs.existsSync(maybeAppDirPath) &&\n fs.lstatSync(maybeAppDirPath).isDirectory()\n ? ['app']\n : fs.existsSync(maybeSrcAppDirPath) &&\n fs.lstatSync(maybeSrcAppDirPath).isDirectory()\n ? ['src', 'app']\n : undefined;\n\n if (!appDirLocation) {\n return;\n }\n\n const globalErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.tsx'),\n )\n ? 'global-error.tsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.ts'),\n )\n ? 'global-error.ts'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.jsx'),\n )\n ? 'global-error.jsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.js'),\n )\n ? 'global-error.js'\n : undefined;\n\n if (!globalErrorPageFile) {\n const newGlobalErrorFileName = `global-error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...appDirLocation, newGlobalErrorFileName),\n getSentryDefaultGlobalErrorPage(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newGlobalErrorFileName),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a custom error page for your app directory.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )}:\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getGlobalErrorCopyPasteSnippet(\n globalErrorPageFile === 'global-error.ts' ||\n globalErrorPageFile === 'global-error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did add the code to your ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(selfHosted, selectedProject, sentryUrl),\n );\n }\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const isLikelyUsingTurbopack = await checkIfLikelyIsUsingTurbopack();\n if (isLikelyUsingTurbopack || isLikelyUsingTurbopack === null) {\n await abortIfCancelled(\n clack.select({\n message: `Warning: The Sentry SDK doesn't yet fully support Turbopack in dev mode. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. Production builds will still fully work. ${chalk.bold(\n `To continue this setup, if you are using Turbopack, temporarily remove \\`--turbo\\` from your dev command until you have verified the SDK is working as expected.`,\n )}`,\n options: [\n {\n label: 'I understand.',\n hint: 'press enter',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n }\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n if (mightBeUsingVercel) {\n clack.log.info(\n \"▲ It seems like you're using Vercel. We recommend using the Sentry Vercel integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry\",\n );\n } else {\n await traceStep('configure-ci', () => configureCI('nextjs', authToken));\n }\n\n const packageManagerForOutro =\n packageManagerFromInstallStep ?? (await getPackageManager());\n await runPrettierIfInstalled();\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${\n shouldCreateExamplePage\n ? `\\n\\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(\n `${packageManagerForOutro.runScriptCommand} dev`,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}`\n : ''\n }${\n shouldCreateExamplePage && isLikelyUsingTurbopack\n ? `\\nDon't forget to remove \\`--turbo\\` from your dev command until you have verified the SDK is working. You can safely add it back afterwards.`\n : ''\n }\n\n${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues',\n)}`);\n}\n\ntype SDKConfigOptions = {\n tunnelRoute: boolean;\n reactComponentAnnotation: boolean;\n};\n\nasync function createOrMergeNextJsFiles(\n selectedProject: SentryProjectData,\n selfHosted: boolean,\n sentryUrl: string,\n sdkConfigOptions: SDKConfigOptions,\n) {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client', 'edge'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n selectedFeatures,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n }\n });\n }\n\n await traceStep('setup-instrumentation-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.ts'),\n );\n const instrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.js'),\n );\n const srcInstrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.ts'),\n );\n const srcInstrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationJsExists || instrumentationTsExists) {\n instrumentationHookLocation = 'root';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n } else {\n if (srcInstrumentationTsExists || srcInstrumentationJsExists) {\n instrumentationHookLocation = 'src';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationFileName = `instrumentation.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationHookLocation === 'does-not-exist') {\n let newInstrumentationHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationHookLocation = 'src';\n } else {\n newInstrumentationHookLocation = 'root';\n }\n\n const newInstrumentationHookPath =\n newInstrumentationHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationFileName)\n : path.join(process.cwd(), 'src', newInstrumentationFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationHookPath,\n getInstrumentationHookContent(newInstrumentationHookLocation),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions(\n newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(\n newInstrumentationHookLocation,\n ),\n );\n }\n } else {\n await showCopyPasteInstructions(\n srcInstrumentationTsExists || instrumentationTsExists\n ? 'instrumentation.ts'\n : srcInstrumentationJsExists || instrumentationJsExists\n ? 'instrumentation.js'\n : newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(instrumentationHookLocation),\n );\n }\n });\n\n await traceStep('setup-next-config', async () => {\n const withSentryConfigOptionsTemplate = getWithSentryConfigOptionsTemplate({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n sentryUrl,\n tunnelRoute: sdkConfigOptions.tunnelRoute,\n reactComponentAnnotation: sdkConfigOptions.reactComponentAnnotation,\n });\n\n const nextConfigPossibleFilesMap = {\n js: 'next.config.js',\n mjs: 'next.config.mjs',\n cjs: 'next.config.cjs',\n ts: 'next.config.ts',\n mts: 'next.config.mts',\n cts: 'next.config.cts',\n };\n\n const foundNextConfigFile = Object.entries(nextConfigPossibleFilesMap).find(\n ([, fileName]) => fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!foundNextConfigFile) {\n Sentry.setTag('next-config-strategy', 'create');\n\n await fs.promises.writeFile(\n // We are creating a `next.config.js` file by default as it is supported by the most Next.js versions\n path.join(process.cwd(), nextConfigPossibleFilesMap.js),\n getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan('next.config.js')} with Sentry configuration.`,\n );\n\n return;\n }\n\n const [foundNextConfigFileType, foundNextConfigFileFilename] =\n foundNextConfigFile;\n\n if (foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs') {\n Sentry.setTag('next-config-strategy', 'modify');\n\n const nextConfigCjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigCjsContent.includes('@sentry/nextjs') &&\n nextConfigCjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n if (shouldInject) {\n await fs.promises.appendFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n\n if (\n foundNextConfigFileType === 'mjs' ||\n foundNextConfigFileType === 'mts' ||\n foundNextConfigFileType === 'cts' ||\n foundNextConfigFileType === 'ts'\n ) {\n const nextConfigMjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigMjsContent.includes('@sentry/nextjs') &&\n nextConfigMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n try {\n if (shouldInject) {\n const mod = parseModule(nextConfigMjsContent);\n mod.imports.$add({\n from: '@sentry/nextjs',\n imported: 'withSentryConfig',\n local: 'withSentryConfig',\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n const expressionToWrap = generateCode(mod.exports.default.$ast).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.default = builders.raw(`withSentryConfig(\n ${expressionToWrap},\n ${withSentryConfigOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n } catch {\n Sentry.setTag('next-config-mod-result', 'fail');\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}.`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}: ${chalk.dim('You probably have to clean it up a bit.')}\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n }\n });\n}\n\nfunction hasDirectoryPathFromRoot(dirnameOrDirs: string | string[]): boolean {\n const dirPath = Array.isArray(dirnameOrDirs)\n ? path.join(process.cwd(), ...dirnameOrDirs)\n : path.join(process.cwd(), dirnameOrDirs);\n\n return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory();\n}\n\nasync function createExamplePage(\n selfHosted: boolean,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n): Promise<void> {\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcAppDirectory = hasDirectoryPathFromRoot(['src', 'app']);\n const hasSrcPagesDirectory = hasDirectoryPathFromRoot(['src', 'pages']);\n\n Sentry.setTag('nextjs-app-dir', hasRootAppDirectory || hasSrcAppDirectory);\n\n const typeScriptDetected = isUsingTypeScript();\n\n // If `pages` or an `app` directory exists in the root, we'll put the example page there.\n // `app` directory takes priority over `pages` directory when they coexist, so we prioritize that.\n // https://nextjs.org/docs/app/building-your-application/routing#the-app-router\n\n const appFolderLocation = hasRootAppDirectory\n ? ['app']\n : hasSrcAppDirectory\n ? ['src', 'app']\n : undefined;\n\n let pagesFolderLocation = hasRootPagesDirectory\n ? ['pages']\n : hasSrcPagesDirectory\n ? ['src', 'pages']\n : undefined;\n\n // If the user has neither pages nor app directory we create a pages folder for them\n if (!appFolderLocation && !pagesFolderLocation) {\n const newPagesFolderLocation = hasSrcDirectory\n ? ['src', 'pages']\n : ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...newPagesFolderLocation), {\n recursive: true,\n });\n\n pagesFolderLocation = newPagesFolderLocation;\n }\n\n if (appFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: true,\n });\n\n fs.mkdirSync(\n path.join(process.cwd(), ...appFolderLocation, 'sentry-example-page'),\n {\n recursive: true,\n },\n );\n\n const newPageFileName = `page.${typeScriptDetected ? 'tsx' : 'jsx'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'sentry-example-page',\n newPageFileName,\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, 'sentry-example-page', newPageFileName),\n )}.`,\n );\n\n fs.mkdirSync(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n ),\n {\n recursive: true,\n },\n );\n\n const newRouteFileName = `route.${typeScriptDetected ? 'ts' : 'js'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n getSentryExampleAppDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n )}.`,\n );\n } else if (pagesFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: false,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'sentry-example-page.jsx',\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'sentry-example-page.js'),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesFolderLocation, 'api'), {\n recursive: true,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'api',\n 'sentry-example-api.js',\n ),\n getSentryExamplePagesDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'api', 'sentry-example-api.js'),\n )}.`,\n );\n }\n}\n\n/**\n * Ask users if they want to set the tunnelRoute option.\n * We can't set this by default because it potentially increases hosting bills.\n * It's valuable enough to for users to justify asking the additional question.\n */\nasync function askShouldSetTunnelRoute() {\n return await traceStep('ask-tunnelRoute-option', async () => {\n const shouldSetTunnelRoute = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Can increase your server load and hosting bill',\n },\n {\n label: 'No',\n value: false,\n hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldSetTunnelRoute) {\n clack.log.info(\n \"Sounds good! We'll leave the option commented for later, just in case :)\",\n );\n }\n\n return shouldSetTunnelRoute;\n });\n}\n\nasync function askShouldEnableReactComponentAnnotation() {\n return await traceStep('ask-react-component-annotation-option', async () => {\n const shouldEnableReactComponentAnnotation = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to enable React component annotations to make breadcrumbs and session replays more readable?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Annotates React component names - increases bundle size',\n },\n {\n label: 'No',\n value: false,\n hint: 'Continue without React component annotations',\n },\n ],\n initialValue: true,\n }),\n );\n\n return shouldEnableReactComponentAnnotation;\n });\n}\n\n/**\n * Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.\n */\nasync function checkIfLikelyIsUsingTurbopack(): Promise<boolean | null> {\n let packageJsonContent: string;\n try {\n packageJsonContent = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n } catch {\n return null;\n }\n\n return packageJsonContent.includes('--turbo');\n}\n"]}
|
|
@@ -56,7 +56,9 @@ export declare function installPackage({ packageName, alreadyInstalled, askBefor
|
|
|
56
56
|
packageName: string;
|
|
57
57
|
alreadyInstalled: boolean;
|
|
58
58
|
askBeforeUpdating?: boolean;
|
|
59
|
-
}): Promise<
|
|
59
|
+
}): Promise<{
|
|
60
|
+
packageManager?: PackageManager;
|
|
61
|
+
}>;
|
|
60
62
|
export declare function addSentryCliConfig({ authToken, org, project, url }: CliSetupConfigContent, setupConfig?: CliSetupConfig): Promise<void>;
|
|
61
63
|
export declare function addDotEnvSentryBuildPluginFile(authToken: string): Promise<void>;
|
|
62
64
|
export declare function runPrettierIfInstalled(): Promise<void>;
|
|
@@ -380,7 +380,7 @@ function installPackage(_a) {
|
|
|
380
380
|
case 1:
|
|
381
381
|
shouldUpdatePackage = _a.sent();
|
|
382
382
|
if (!shouldUpdatePackage) {
|
|
383
|
-
return [2 /*return
|
|
383
|
+
return [2 /*return*/, {}];
|
|
384
384
|
}
|
|
385
385
|
_a.label = 2;
|
|
386
386
|
case 2:
|
|
@@ -420,7 +420,7 @@ function installPackage(_a) {
|
|
|
420
420
|
return [3 /*break*/, 8];
|
|
421
421
|
case 8:
|
|
422
422
|
sdkInstallSpinner.stop("".concat(alreadyInstalled ? 'Updated' : 'Installed', " ").concat(chalk_1.default.bold.cyan(packageName), " with ").concat(chalk_1.default.bold(packageManager.label), "."));
|
|
423
|
-
return [2 /*return
|
|
423
|
+
return [2 /*return*/, { packageManager: packageManager }];
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
426
|
}); })];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clack-utils.js","sourceRoot":"","sources":["../../../src/utils/clack-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,gDAA0B;AAC1B,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CAAC;sCAEvB,EAAR,qBAAQ;;;qCAAR,CAAA,sBAAQ,CAAA;gCAAnB,OAAO;gCACC,qBAAM,gBAAgB,CACrC,KAAK,CAAC,MAAM,CAAC;wCACX,OAAO,EAAE,OAAO,CAAC,MAAM;wCACvB,YAAY,EAAE,IAAI;wCAClB,OAAO,EAAE;4CACP;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,OAAO,CAAC,WAAW;6CAC1B;4CACD;gDACE,KAAK,EAAE,KAAK;gDACZ,KAAK,EAAE,IAAI;gDACX,IAAI,EAAE,OAAO,CAAC,YAAY;6CAC3B;yCACF;qCACF,CAAC,CACH,EAAA;;gCAjBK,QAAQ,GAAG,SAiBhB;gCAED,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;;;gCApBpB,IAAQ,CAAA;;oCAuB9B,sBAAO,gBAAyD,EAAC;;;qBAClE,CAAC,EAAC;;;CACJ;AA/BD,wDA+BC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport axios from 'axios';\nimport chalk from 'chalk';\nimport * as childProcess from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { setInterval } from 'timers';\nimport { URL } from 'url';\nimport * as Sentry from '@sentry/node';\nimport { hasPackageInstalled, PackageDotJson } from './package-json';\nimport { Feature, SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\n options?: {\n wait?: boolean;\n },\n) => Promise<childProcess.ChildProcess>;\n\nexport const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';\nexport const SENTRY_CLI_RC_FILE = '.sentryclirc';\nexport const SENTRY_PROPERTIES_FILE = 'sentry.properties';\n\nconst SAAS_URL = 'https://sentry.io/';\n\nconst DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';\n\ninterface WizardProjectData {\n apiKeys?: {\n token?: string;\n };\n projects?: SentryProjectData[];\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport const rcCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_CLI_RC_FILE,\n name: 'source maps',\n gitignore: true,\n likelyAlreadyHasAuthToken: function (contents: string): boolean {\n return !!(contents.includes('[auth]') && contents.match(/token=./g));\n },\n tokenContent: function (authToken: string): string {\n return `[auth]\\ntoken=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject: function (contents: string): boolean {\n return !!(\n contents.includes('[defaults]') &&\n contents.match(/org=./g) &&\n contents.match(/project=./g)\n );\n },\n orgAndProjContent: function (org: string, project: string): string {\n return `[defaults]\\norg=${org}\\nproject=${project}`;\n },\n};\n\nexport const propertiesCliSetupConfig: Required<CliSetupConfig> = {\n filename: SENTRY_PROPERTIES_FILE,\n gitignore: true,\n name: 'debug files',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n likelyAlreadyHasUrl(contents: string): boolean {\n return !!contents.match(/defaults\\.url=./g);\n },\n urlContent(url: string): string {\n return `defaults.url=${url}`;\n },\n};\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n clack.outro(message ?? 'Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('aborted');\n sentryTransaction?.finish();\n const sentrySession = sentryHub.getScope().getSession();\n if (sentrySession) {\n sentrySession.status = status === 0 ? 'abnormal' : 'crashed';\n sentryHub.captureSession(true);\n }\n await Sentry.flush(3000);\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n): Promise<Exclude<T, symbol>> {\n if (clack.isCancel(await input)) {\n clack.cancel('Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('cancelled');\n sentryTransaction?.finish();\n sentryHub.captureSession(true);\n await Sentry.flush(3000);\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: {\n wizardName: string;\n promoCode?: string;\n message?: string;\n telemetryEnabled?: boolean;\n}): void {\n let wizardPackage: { version?: string } = {};\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n } catch {\n // We don't need to have this\n }\n\n // eslint-disable-next-line no-console\n console.log('');\n clack.intro(chalk.inverse(` ${options.wizardName} `));\n\n let welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up Sentry for your application.\\nThank you for using Sentry :)`;\n\n if (options.promoCode) {\n welcomeText = `${welcomeText}\\n\\nUsing promo-code: ${options.promoCode}`;\n }\n\n if (wizardPackage.version) {\n welcomeText = `${welcomeText}\\n\\nVersion: ${wizardPackage.version}`;\n }\n\n if (options.telemetryEnabled) {\n welcomeText = `${welcomeText}\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ${chalk.cyanBright(\n 'sentry-wizard --disable-telemetry',\n )}.`;\n }\n\n clack.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n const continueWithoutGit = await abortIfCancelled(\n clack.confirm({\n message:\n 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n clack.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe wizard will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport function isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1')\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askToInstallSentryCLI(): Promise<boolean> {\n return await abortIfCancelled(\n clack.confirm({\n message:\n \"You don't have Sentry CLI installed. Do you want to install it?\",\n }),\n );\n}\n\nexport async function askForItemSelection(\n items: string[],\n message: string,\n): Promise<{ value: string; index: number }> {\n const selection: { value: string; index: number } | symbol =\n await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection;\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n clack.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n clack.note(\n note ??\n `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`,\n );\n const continueWithUnsupportedVersion = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n Sentry.setTag(\n `${packageName.toLowerCase()}-continue-with-unsupported-version`,\n continueWithUnsupportedVersion,\n );\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n}: {\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n}): Promise<void> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n clack.confirm({\n message: `The ${chalk.bold.cyan(\n packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return;\n }\n }\n\n const sdkInstallSpinner = clack.spinner();\n\n const packageManager = await getPackageManager();\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `${packageManager.installCommand} ${packageName} ${packageManager.flags}`,\n (err, stdout, stderr) => {\n if (err) {\n // Write a log file so we can better troubleshoot issues\n fs.writeFileSync(\n path.join(\n process.cwd(),\n `sentry-wizard-installation-error-${Date.now()}.log`,\n ),\n JSON.stringify({\n stdout,\n stderr,\n }),\n { encoding: 'utf8' },\n );\n\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n \"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\",\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n });\n}\n\nexport async function addSentryCliConfig(\n { authToken, org, project, url }: CliSetupConfigContent,\n setupConfig: CliSetupConfig = rcCliSetupConfig,\n): Promise<void> {\n return traceStep('add-sentry-cli-config', async () => {\n const configPath = path.join(process.cwd(), setupConfig.filename);\n const configExists = fs.existsSync(configPath);\n\n let configContents =\n (configExists && fs.readFileSync(configPath, 'utf8')) || '';\n configContents = addAuthTokenToSentryConfig(\n configContents,\n authToken,\n setupConfig,\n );\n configContents = addOrgAndProjectToSentryConfig(\n configContents,\n org,\n project,\n setupConfig,\n );\n configContents = addUrlToSentryConfig(configContents, url, setupConfig);\n\n try {\n await fs.promises.writeFile(configPath, configContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `${configExists ? 'Saved' : 'Created'} ${chalk.cyan(\n setupConfig.filename,\n )}.`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.cyan(\n setupConfig.filename,\n )}. Uploading ${\n setupConfig.name\n } during build will likely not work locally.`,\n );\n }\n\n if (setupConfig.gitignore) {\n await addCliConfigFileToGitIgnore(setupConfig.filename);\n } else {\n clack.log.warn(\n chalk.yellow('DO NOT commit auth token to your repository!'),\n );\n }\n });\n}\n\nfunction addAuthTokenToSentryConfig(\n configContents: string,\n authToken: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!authToken) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has auth token. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.tokenContent(\n authToken,\n )}\\n`;\n clack.log.success(\n `Added auth token to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addOrgAndProjectToSentryConfig(\n configContents: string,\n org: string | undefined,\n project: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!org || !project) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has org and project. Will not add them.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.orgAndProjContent(\n org,\n project,\n )}\\n`;\n clack.log.success(\n `Added default org and project to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addUrlToSentryConfig(\n configContents: string,\n url: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!url || !setupConfig.urlContent || !setupConfig.likelyAlreadyHasUrl) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasUrl(configContents)) {\n clack.log.warn(\n `${chalk.cyan(setupConfig.filename)} already has url. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.urlContent(url)}\\n`;\n clack.log.success(\n `Added default url to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nexport async function addDotEnvSentryBuildPluginFile(\n authToken: string,\n): Promise<void> {\n const envVarContent = `# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own \\`.env\\` files and remove this file.\nSENTRY_AUTH_TOKEN=${authToken}\n`;\n\n const dotEnvFilePath = path.join(process.cwd(), SENTRY_DOT_ENV_FILE);\n const dotEnvFileExists = fs.existsSync(dotEnvFilePath);\n\n if (dotEnvFileExists) {\n const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');\n\n const hasAuthToken = !!dotEnvFileContent.match(\n /^\\s*SENTRY_AUTH_TOKEN\\s*=/g,\n );\n\n if (hasAuthToken) {\n clack.log.warn(\n `${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} already has auth token. Will not add one.`,\n );\n } else {\n try {\n await fs.promises.writeFile(\n dotEnvFilePath,\n `${dotEnvFileContent}\\n${envVarContent}`,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added auth token to ${chalk.bold(SENTRY_DOT_ENV_FILE)}`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )}. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n } else {\n try {\n await fs.promises.writeFile(dotEnvFilePath, envVarContent, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `Created ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token for you to test source map uploading locally.`,\n );\n } catch {\n clack.log.warning(\n `Failed to create ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n\n await addCliConfigFileToGitIgnore(SENTRY_DOT_ENV_FILE);\n}\n\nasync function addCliConfigFileToGitIgnore(filename: string): Promise<void> {\n const gitignorePath = path.join(process.cwd(), '.gitignore');\n\n try {\n const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');\n if (gitignoreContent.split(/\\r?\\n/).includes(filename)) {\n clack.log.info(\n `${chalk.bold('.gitignore')} already has ${chalk.bold(\n filename,\n )}. Will not add it again.`,\n );\n return;\n }\n\n await fs.promises.appendFile(\n gitignorePath,\n `\\n# Sentry Config File\\n${filename}\\n`,\n { encoding: 'utf8' },\n );\n clack.log.success(\n `Added ${chalk.cyan(filename)} to ${chalk.cyan('.gitignore')}.`,\n );\n } catch {\n clack.log.error(\n `Failed adding ${chalk.cyan(filename)} to ${chalk.cyan(\n '.gitignore',\n )}. Please add it manually!`,\n );\n }\n}\n\nexport async function runPrettierIfInstalled(): Promise<void> {\n return traceStep('run-prettier', async () => {\n if (!isInGitRepo()) {\n // We only run formatting on changed files. If we're not in a git repo, we can't find\n // changed files. So let's early-return without showing any formatting-related messages.\n return;\n }\n\n const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()\n .map((filename) => {\n return filename.startsWith('- ') ? filename.slice(2) : filename;\n })\n .join(' ');\n\n if (!changedOrUntrackedFiles.length) {\n // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.\n return;\n }\n\n const packageJson = await getPackageDotJson();\n const prettierInstalled = hasPackageInstalled('prettier', packageJson);\n\n Sentry.setTag('prettier-installed', prettierInstalled);\n\n if (!prettierInstalled) {\n return;\n }\n\n // prompt the user if they want to run prettier\n const shouldRunPrettier = await abortIfCancelled(\n clack.confirm({\n message:\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n }),\n );\n\n if (!shouldRunPrettier) {\n return;\n }\n\n const prettierSpinner = clack.spinner();\n prettierSpinner.start('Running Prettier on your files.');\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`,\n (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n prettierSpinner.stop('Prettier failed to run.');\n clack.log.warn(\n 'Prettier failed to run. There may be formatting issues in your updated files.',\n );\n return;\n }\n\n prettierSpinner.stop('Prettier has formatted your files.');\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);\n const continueWithoutPackage = await abortIfCancelled(\n clack.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson(): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises\n .readFile(path.join(process.cwd(), 'package.json'), 'utf8')\n .catch(() => {\n clack.log.error(\n 'Could not find package.json. Make sure to run the wizard in the root of your app!',\n );\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'package.json',\n )}. Make sure it has a valid format!`,\n );\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function getPackageManager(): Promise<PackageManager> {\n const detectedPackageManager = detectPackageManger();\n\n if (detectedPackageManager) {\n return detectedPackageManager;\n }\n\n const selectedPackageManager: PackageManager | symbol =\n await abortIfCancelled(\n clack.select({\n message: 'Please select your package manager.',\n options: packageManagers.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n Sentry.setTag('package-manager', selectedPackageManager.name);\n\n return selectedPackageManager;\n}\n\nexport function isUsingTypeScript() {\n try {\n return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if we already got project data from a previous wizard invocation.\n * If yes, this data is returned.\n * Otherwise, we start the login flow and ask the user to select a project.\n *\n * Use this function to get project data for the wizard.\n *\n * @param options wizard options\n * @param platform the platform of the wizard\n * @returns project data (org, project, token, url)\n */\nexport async function getOrAskForProjectData(\n options: WizardOptions,\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native',\n): Promise<{\n sentryUrl: string;\n selfHosted: boolean;\n selectedProject: SentryProjectData;\n authToken: string;\n}> {\n if (options.preSelectedProject) {\n return {\n selfHosted: options.preSelectedProject.selfHosted,\n sentryUrl: options.url ?? SAAS_URL,\n authToken: options.preSelectedProject.authToken,\n selectedProject: options.preSelectedProject.project,\n };\n }\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url, options.saas),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\n orgSlug: options.orgSlug,\n projectSlug: options.projectSlug,\n }),\n );\n\n if (!projects || !projects.length) {\n clack.log.error(\n 'No projects found. Please create a project in Sentry and try again.',\n );\n Sentry.setTag('no-projects-found', true);\n await abort();\n // This rejection won't return due to the abort call but TS doesn't know that\n return Promise.reject();\n }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects, options.orgSlug, options.projectSlug),\n );\n\n const { token } = apiKeys ?? {};\n\n if (!token) {\n clack.log.error(`Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n${chalk.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);\n\n clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk.cyan(\n `\"${DUMMY_AUTH_TOKEN}\"`,\n )}) for you to replace later.\nCreate your auth token here:\n${chalk.cyan(\n selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`\n : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`,\n)}`);\n }\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,\n selectedProject,\n };\n}\n\n/**\n * Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.\n *\n * If users started the wizard with a --url arg, that URL is used as the default and we skip\n * the self-hosted question. However, the passed url is still validated and in case it's\n * invalid, users are asked to enter a new one until it is valid.\n *\n * @param urlFromArgs the url passed via the --url arg\n */\nasync function askForSelfHosted(\n urlFromArgs?: string,\n saas?: boolean,\n): Promise<{\n url: string;\n selfHosted: boolean;\n}> {\n if (saas) {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n\n if (!urlFromArgs) {\n const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(\n clack.select({\n message: 'Are you using Sentry SaaS or self-hosted Sentry?',\n options: [\n { value: 'saas', label: 'Sentry SaaS (sentry.io)' },\n {\n value: 'self-hosted',\n label: 'Self-hosted/on-premise/single-tenant',\n },\n ],\n }),\n );\n\n if (choice === 'saas') {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n }\n\n let validUrl: string | undefined;\n let tmpUrlFromArgs = urlFromArgs;\n\n while (validUrl === undefined) {\n const url =\n tmpUrlFromArgs ||\n (await abortIfCancelled(\n clack.text({\n message: `Please enter the URL of your ${\n urlFromArgs ? '' : 'self-hosted '\n }Sentry instance.`,\n placeholder: 'https://sentry.io/',\n }),\n ));\n tmpUrlFromArgs = undefined;\n\n try {\n validUrl = new URL(url).toString();\n\n // We assume everywhere else that the URL ends in a slash\n if (!validUrl.endsWith('/')) {\n validUrl += '/';\n }\n } catch {\n clack.log.error(\n `Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ${url})`,\n );\n }\n }\n\n const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;\n\n Sentry.setTag('url', validUrl);\n Sentry.setTag('self-hosted', isSelfHostedUrl);\n\n return { url: validUrl, selfHosted: true };\n}\n\nasync function askForWizardLogin(options: {\n url: string;\n promoCode?: string;\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native';\n orgSlug?: string;\n projectSlug?: string;\n}): Promise<WizardProjectData> {\n Sentry.setTag('has-promo-code', !!options.promoCode);\n\n let hasSentryAccount = await clack.confirm({\n message: 'Do you already have a Sentry account?',\n });\n\n hasSentryAccount = await abortIfCancelled(hasSentryAccount);\n\n Sentry.setTag('already-has-sentry-account', hasSentryAccount);\n\n let wizardHash: string;\n try {\n wizardHash = (\n await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)\n ).data.hash;\n } catch (e: unknown) {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please check your configuration and try again.\\n\\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n } else {\n clack.log.error('Loading Wizard failed.');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n }\n }\n\n const loginUrl = new URL(\n `${options.url}account/settings/wizard/${wizardHash!}/`,\n );\n\n if (options.orgSlug) {\n loginUrl.searchParams.set('org_slug', options.orgSlug);\n }\n\n if (options.projectSlug) {\n loginUrl.searchParams.set('project_slug', options.projectSlug);\n }\n\n if (!hasSentryAccount) {\n loginUrl.searchParams.set('signup', '1');\n if (options.platform) {\n loginUrl.searchParams.set('project_platform', options.platform);\n }\n }\n\n if (options.promoCode) {\n loginUrl.searchParams.set('code', options.promoCode);\n }\n\n const urlToOpen = loginUrl.toString();\n clack.log.info(\n `${chalk.bold(\n `If the browser window didn't open automatically, please open the following link to ${\n hasSentryAccount ? 'log' : 'sign'\n } into Sentry:`,\n )}\\n\\n${chalk.cyan(urlToOpen)}`,\n );\n\n opn(urlToOpen, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n\n const loginSpinner = clack.spinner();\n\n loginSpinner.start('Waiting for you to log in using the link above');\n\n const data = await new Promise<WizardProjectData>((resolve) => {\n const pollingInterval = setInterval(() => {\n axios\n .get<WizardProjectData>(`${options.url}api/0/wizard/${wizardHash}/`, {\n headers: {\n 'Accept-Encoding': 'deflate',\n },\n })\n .then((result) => {\n resolve(result.data);\n clearTimeout(timeout);\n clearInterval(pollingInterval);\n void axios.delete(`${options.url}api/0/wizard/${wizardHash}/`);\n })\n .catch(() => {\n // noop - just try again\n });\n }, 500);\n\n const timeout = setTimeout(() => {\n clearInterval(pollingInterval);\n loginSpinner.stop(\n 'Login timed out. No worries - it happens to the best of us.',\n );\n\n Sentry.setTag('opened-wizard-link', false);\n void abort('Please restart the Wizard and log in to complete the setup.');\n }, 180_000);\n });\n\n loginSpinner.stop('Login complete.');\n Sentry.setTag('opened-wizard-link', true);\n\n return data;\n}\n\nasync function askForProjectSelection(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n\n const filteredProjects = filterProjectsBySlugs(\n projects,\n orgSlug,\n projectSlug,\n );\n\n if (filteredProjects.length === 1) {\n const selection = filteredProjects[0];\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n clack.log.step(`Selected project ${label(selection)}`);\n\n return selection;\n }\n\n if (filteredProjects.length === 0) {\n clack.log.warn('Could not find a project with the provided slugs.');\n }\n\n const sortedProjects = filteredProjects.length ? filteredProjects : projects;\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\n });\n\n const selection: SentryProjectData | symbol = await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: 'Select your Sentry project.',\n options: sortedProjects.map((project) => {\n return {\n value: project,\n label: label(project),\n };\n }),\n }),\n );\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n\n return selection;\n}\n\nfunction filterProjectsBySlugs(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): SentryProjectData[] {\n if (!orgSlug && !projectSlug) {\n return projects;\n }\n if (orgSlug && !projectSlug) {\n return projects.filter((p) => p.organization.slug === orgSlug);\n }\n if (!orgSlug && projectSlug) {\n return projects.filter((p) => p.slug === projectSlug);\n }\n\n return projects.filter(\n (p) => p.organization.slug === orgSlug && p.slug === projectSlug,\n );\n}\n\n/**\n * Asks users if they have a config file for @param tool (e.g. Vite).\n * If yes, asks users to specify the path to their config file.\n *\n * Use this helper function as a fallback mechanism if the lookup for\n * a config file with its most usual location/name fails.\n *\n * @param toolName Name of the tool for which we're looking for the config file\n * @param configFileName Name of the most common config file name (e.g. vite.config.js)\n *\n * @returns a user path to the config file or undefined if the user doesn't have a config file\n */\nexport async function askForToolConfigPath(\n toolName: string,\n configFileName: string,\n): Promise<string | undefined> {\n const hasConfig = await abortIfCancelled(\n clack.confirm({\n message: `Do you have a ${toolName} config file (e.g. ${chalk.cyan(\n configFileName,\n )})?`,\n initialValue: true,\n }),\n );\n\n if (!hasConfig) {\n return undefined;\n }\n\n return await abortIfCancelled(\n clack.text({\n message: `Please enter the path to your ${toolName} config file:`,\n placeholder: path.join('.', configFileName),\n validate: (value) => {\n if (!value) {\n return 'Please enter a path.';\n }\n\n try {\n fs.accessSync(value);\n } catch {\n return 'Could not access the file at this path.';\n }\n },\n }),\n );\n}\n\n/**\n * Prints copy/paste-able instructions to the console.\n * Afterwards asks the user if they added the code snippet to their file.\n *\n * While there's no point in providing a \"no\" answer here, it gives users time to fulfill the\n * task before the wizard continues with additional steps.\n *\n * Use this function if you want to show users instructions on how to add/modify\n * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.\n *\n * @param filename the name of the file to which the code snippet should be applied.\n * If a path is provided, only the filename will be used.\n *\n * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the\n * diff-like format for visually highlighting unchanged or modified lines of code.\n *\n * @param hint (optional) a hint to be printed after the main instruction to add\n * the code from @param codeSnippet to their @param filename.\n *\n * More guidelines on copy/paste instructions:\n * @see {@link https://develop.sentry.dev/sdk/setup-wizards/#copy--paste-snippets}\n *\n * TODO: refactor copy paste instructions across different wizards to use this function.\n * this might require adding a custom message parameter to the function\n */\nexport async function showCopyPasteInstructions(\n filename: string,\n codeSnippet: string,\n hint?: string,\n): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.cyan(\n path.basename(filename),\n )} file:${hint ? chalk.dim(` (${chalk.dim(hint)})`) : ''}`,\n );\n\n // Padding the code snippet to be printed with a \\n at the beginning and end\n // This makes it easier to distinguish the snippet from the rest of the output\n // Intentionally logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(`\\n${codeSnippet}\\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you apply the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\n/**\n * Callback that exposes formatting helpers for a code snippet.\n * @param unchanged - Formats text as old code.\n * @param plus - Formats text as new code.\n * @param minus - Formats text as removed code.\n */\ntype CodeSnippetFormatter = (\n unchanged: (txt: string) => string,\n plus: (txt: string) => string,\n minus: (txt: string) => string,\n) => string;\n\n/**\n * Crafts a code snippet that can be used to e.g.\n * - print copy/paste instructions to the console\n * - create a new config file.\n *\n * @param colors set this to true if you want the final snippet to be colored.\n * This is useful for printing the snippet to the console as part of copy/paste instructions.\n *\n * @param callback the callback that returns the formatted code snippet.\n * It exposes takes the helper functions for marking code as unchanged, new or removed.\n * These functions no-op if no special formatting should be applied\n * and otherwise apply the appropriate formatting/coloring.\n * (@see {@link CodeSnippetFormatter})\n *\n * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.\n *\n * @returns a string containing the final, formatted code snippet.\n */\nexport function makeCodeSnippet(\n colors: boolean,\n callback: CodeSnippetFormatter,\n): string {\n const unchanged = (txt: string) => (colors ? chalk.grey(txt) : txt);\n const plus = (txt: string) => (colors ? chalk.greenBright(txt) : txt);\n const minus = (txt: string) => (colors ? chalk.redBright(txt) : txt);\n\n return callback(unchanged, plus, minus);\n}\n\n/**\n * Creates a new config file with the given @param filepath and @param codeSnippet.\n *\n * Use this function to create a new config file for users. This is useful\n * when users answered that they don't yet have a config file for a tool.\n *\n * (This doesn't mean that they don't yet have some other way of configuring\n * their tool but we can leave it up to them to figure out how to merge configs\n * here.)\n *\n * @param filepath absolute path to the new config file\n * @param codeSnippet the snippet to be inserted into the file\n * @param moreInformation (optional) the message to be printed after the file was created\n * For example, this can be a link to more information about configuring the tool.\n *\n * @returns true on success, false otherwise\n */\nexport async function createNewConfigFile(\n filepath: string,\n codeSnippet: string,\n moreInformation?: string,\n): Promise<boolean> {\n if (!path.isAbsolute(filepath)) {\n debug(`createNewConfigFile: filepath is not absolute: ${filepath}`);\n return false;\n }\n\n const prettyFilename = chalk.cyan(path.relative(process.cwd(), filepath));\n\n try {\n await fs.promises.writeFile(filepath, codeSnippet);\n\n clack.log.success(`Added new ${prettyFilename} file.`);\n\n if (moreInformation) {\n clack.log.info(chalk.gray(moreInformation));\n }\n\n return true;\n } catch (e) {\n debug(e);\n clack.log.warn(\n `Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`,\n );\n }\n\n return false;\n}\n\nexport async function askShouldCreateExamplePage(\n customRoute?: string,\n): Promise<boolean> {\n const route = chalk.cyan(customRoute ?? '/sentry-example-page');\n return traceStep('ask-create-example-page', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example page (\"${route}\") to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(\n features: F,\n): Promise<{ [key in F[number]['id']]: boolean }> {\n return traceStep('feature-selection', async () => {\n const selectedFeatures: Record<string, boolean> = {};\n\n for (const feature of features) {\n const selected = await abortIfCancelled(\n clack.select({\n message: feature.prompt,\n initialValue: true,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: feature.enabledHint,\n },\n {\n value: false,\n label: 'No',\n hint: feature.disabledHint,\n },\n ],\n }),\n );\n\n selectedFeatures[feature.id] = selected;\n }\n\n return selectedFeatures as { [key in F[number]['id']]: boolean };\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"clack-utils.js","sourceRoot":"","sources":["../../../src/utils/clack-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,gDAA0B;AAC1B,0DAA8C;AAC9C,qCAAyB;AACzB,yCAA6B;AAC7B,qCAAyB;AACzB,iCAAqC;AACrC,2BAA0B;AAC1B,mDAAuC;AACvC,+CAAqE;AAErE,0CAAyC;AACzC,qDAI2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAKc,CAAC;AAE3B,QAAA,mBAAmB,GAAG,0BAA0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AE;4CACP;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,OAAO,CAAC,WAAW;6CAC1B;4CACD;gDACE,KAAK,EAAE,KAAK;gDACZ,KAAK,EAAE,IAAI;gDACX,IAAI,EAAE,OAAO,CAAC,YAAY;6CAC3B;yCACF;qCACF,CAAC,CACH,EAAA;;gCAjBK,QAAQ,GAAG,SAiBhB;gCAED,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;;;gCApBpB,IAAQ,CAAA;;oCAuB9B,sBAAO,gBAAyD,EAAC;;;qBAClE,CAAC,EAAC;;;CACJ;AA/BD,wDA+BC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport axios from 'axios';\nimport chalk from 'chalk';\nimport * as childProcess from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { setInterval } from 'timers';\nimport { URL } from 'url';\nimport * as Sentry from '@sentry/node';\nimport { hasPackageInstalled, PackageDotJson } from './package-json';\nimport { Feature, SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\n options?: {\n wait?: boolean;\n },\n) => Promise<childProcess.ChildProcess>;\n\nexport const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';\nexport const SENTRY_CLI_RC_FILE = '.sentryclirc';\nexport const SENTRY_PROPERTIES_FILE = 'sentry.properties';\n\nconst SAAS_URL = 'https://sentry.io/';\n\nconst DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';\n\ninterface WizardProjectData {\n apiKeys?: {\n token?: string;\n };\n projects?: SentryProjectData[];\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport const rcCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_CLI_RC_FILE,\n name: 'source maps',\n gitignore: true,\n likelyAlreadyHasAuthToken: function (contents: string): boolean {\n return !!(contents.includes('[auth]') && contents.match(/token=./g));\n },\n tokenContent: function (authToken: string): string {\n return `[auth]\\ntoken=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject: function (contents: string): boolean {\n return !!(\n contents.includes('[defaults]') &&\n contents.match(/org=./g) &&\n contents.match(/project=./g)\n );\n },\n orgAndProjContent: function (org: string, project: string): string {\n return `[defaults]\\norg=${org}\\nproject=${project}`;\n },\n};\n\nexport const propertiesCliSetupConfig: Required<CliSetupConfig> = {\n filename: SENTRY_PROPERTIES_FILE,\n gitignore: true,\n name: 'debug files',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n likelyAlreadyHasUrl(contents: string): boolean {\n return !!contents.match(/defaults\\.url=./g);\n },\n urlContent(url: string): string {\n return `defaults.url=${url}`;\n },\n};\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n clack.outro(message ?? 'Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('aborted');\n sentryTransaction?.finish();\n const sentrySession = sentryHub.getScope().getSession();\n if (sentrySession) {\n sentrySession.status = status === 0 ? 'abnormal' : 'crashed';\n sentryHub.captureSession(true);\n }\n await Sentry.flush(3000);\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n): Promise<Exclude<T, symbol>> {\n if (clack.isCancel(await input)) {\n clack.cancel('Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('cancelled');\n sentryTransaction?.finish();\n sentryHub.captureSession(true);\n await Sentry.flush(3000);\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: {\n wizardName: string;\n promoCode?: string;\n message?: string;\n telemetryEnabled?: boolean;\n}): void {\n let wizardPackage: { version?: string } = {};\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n } catch {\n // We don't need to have this\n }\n\n // eslint-disable-next-line no-console\n console.log('');\n clack.intro(chalk.inverse(` ${options.wizardName} `));\n\n let welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up Sentry for your application.\\nThank you for using Sentry :)`;\n\n if (options.promoCode) {\n welcomeText = `${welcomeText}\\n\\nUsing promo-code: ${options.promoCode}`;\n }\n\n if (wizardPackage.version) {\n welcomeText = `${welcomeText}\\n\\nVersion: ${wizardPackage.version}`;\n }\n\n if (options.telemetryEnabled) {\n welcomeText = `${welcomeText}\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ${chalk.cyanBright(\n 'sentry-wizard --disable-telemetry',\n )}.`;\n }\n\n clack.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n const continueWithoutGit = await abortIfCancelled(\n clack.confirm({\n message:\n 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n clack.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe wizard will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport function isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1')\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askToInstallSentryCLI(): Promise<boolean> {\n return await abortIfCancelled(\n clack.confirm({\n message:\n \"You don't have Sentry CLI installed. Do you want to install it?\",\n }),\n );\n}\n\nexport async function askForItemSelection(\n items: string[],\n message: string,\n): Promise<{ value: string; index: number }> {\n const selection: { value: string; index: number } | symbol =\n await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection;\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n clack.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n clack.note(\n note ??\n `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`,\n );\n const continueWithUnsupportedVersion = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n Sentry.setTag(\n `${packageName.toLowerCase()}-continue-with-unsupported-version`,\n continueWithUnsupportedVersion,\n );\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n}: {\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n}): Promise<{ packageManager?: PackageManager }> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n clack.confirm({\n message: `The ${chalk.bold.cyan(\n packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return {};\n }\n }\n\n const sdkInstallSpinner = clack.spinner();\n\n const packageManager = await getPackageManager();\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `${packageManager.installCommand} ${packageName} ${packageManager.flags}`,\n (err, stdout, stderr) => {\n if (err) {\n // Write a log file so we can better troubleshoot issues\n fs.writeFileSync(\n path.join(\n process.cwd(),\n `sentry-wizard-installation-error-${Date.now()}.log`,\n ),\n JSON.stringify({\n stdout,\n stderr,\n }),\n { encoding: 'utf8' },\n );\n\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n \"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\",\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n return { packageManager };\n });\n}\n\nexport async function addSentryCliConfig(\n { authToken, org, project, url }: CliSetupConfigContent,\n setupConfig: CliSetupConfig = rcCliSetupConfig,\n): Promise<void> {\n return traceStep('add-sentry-cli-config', async () => {\n const configPath = path.join(process.cwd(), setupConfig.filename);\n const configExists = fs.existsSync(configPath);\n\n let configContents =\n (configExists && fs.readFileSync(configPath, 'utf8')) || '';\n configContents = addAuthTokenToSentryConfig(\n configContents,\n authToken,\n setupConfig,\n );\n configContents = addOrgAndProjectToSentryConfig(\n configContents,\n org,\n project,\n setupConfig,\n );\n configContents = addUrlToSentryConfig(configContents, url, setupConfig);\n\n try {\n await fs.promises.writeFile(configPath, configContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `${configExists ? 'Saved' : 'Created'} ${chalk.cyan(\n setupConfig.filename,\n )}.`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.cyan(\n setupConfig.filename,\n )}. Uploading ${\n setupConfig.name\n } during build will likely not work locally.`,\n );\n }\n\n if (setupConfig.gitignore) {\n await addCliConfigFileToGitIgnore(setupConfig.filename);\n } else {\n clack.log.warn(\n chalk.yellow('DO NOT commit auth token to your repository!'),\n );\n }\n });\n}\n\nfunction addAuthTokenToSentryConfig(\n configContents: string,\n authToken: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!authToken) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has auth token. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.tokenContent(\n authToken,\n )}\\n`;\n clack.log.success(\n `Added auth token to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addOrgAndProjectToSentryConfig(\n configContents: string,\n org: string | undefined,\n project: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!org || !project) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has org and project. Will not add them.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.orgAndProjContent(\n org,\n project,\n )}\\n`;\n clack.log.success(\n `Added default org and project to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addUrlToSentryConfig(\n configContents: string,\n url: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!url || !setupConfig.urlContent || !setupConfig.likelyAlreadyHasUrl) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasUrl(configContents)) {\n clack.log.warn(\n `${chalk.cyan(setupConfig.filename)} already has url. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.urlContent(url)}\\n`;\n clack.log.success(\n `Added default url to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nexport async function addDotEnvSentryBuildPluginFile(\n authToken: string,\n): Promise<void> {\n const envVarContent = `# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own \\`.env\\` files and remove this file.\nSENTRY_AUTH_TOKEN=${authToken}\n`;\n\n const dotEnvFilePath = path.join(process.cwd(), SENTRY_DOT_ENV_FILE);\n const dotEnvFileExists = fs.existsSync(dotEnvFilePath);\n\n if (dotEnvFileExists) {\n const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');\n\n const hasAuthToken = !!dotEnvFileContent.match(\n /^\\s*SENTRY_AUTH_TOKEN\\s*=/g,\n );\n\n if (hasAuthToken) {\n clack.log.warn(\n `${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} already has auth token. Will not add one.`,\n );\n } else {\n try {\n await fs.promises.writeFile(\n dotEnvFilePath,\n `${dotEnvFileContent}\\n${envVarContent}`,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added auth token to ${chalk.bold(SENTRY_DOT_ENV_FILE)}`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )}. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n } else {\n try {\n await fs.promises.writeFile(dotEnvFilePath, envVarContent, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `Created ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token for you to test source map uploading locally.`,\n );\n } catch {\n clack.log.warning(\n `Failed to create ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n\n await addCliConfigFileToGitIgnore(SENTRY_DOT_ENV_FILE);\n}\n\nasync function addCliConfigFileToGitIgnore(filename: string): Promise<void> {\n const gitignorePath = path.join(process.cwd(), '.gitignore');\n\n try {\n const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');\n if (gitignoreContent.split(/\\r?\\n/).includes(filename)) {\n clack.log.info(\n `${chalk.bold('.gitignore')} already has ${chalk.bold(\n filename,\n )}. Will not add it again.`,\n );\n return;\n }\n\n await fs.promises.appendFile(\n gitignorePath,\n `\\n# Sentry Config File\\n${filename}\\n`,\n { encoding: 'utf8' },\n );\n clack.log.success(\n `Added ${chalk.cyan(filename)} to ${chalk.cyan('.gitignore')}.`,\n );\n } catch {\n clack.log.error(\n `Failed adding ${chalk.cyan(filename)} to ${chalk.cyan(\n '.gitignore',\n )}. Please add it manually!`,\n );\n }\n}\n\nexport async function runPrettierIfInstalled(): Promise<void> {\n return traceStep('run-prettier', async () => {\n if (!isInGitRepo()) {\n // We only run formatting on changed files. If we're not in a git repo, we can't find\n // changed files. So let's early-return without showing any formatting-related messages.\n return;\n }\n\n const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()\n .map((filename) => {\n return filename.startsWith('- ') ? filename.slice(2) : filename;\n })\n .join(' ');\n\n if (!changedOrUntrackedFiles.length) {\n // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.\n return;\n }\n\n const packageJson = await getPackageDotJson();\n const prettierInstalled = hasPackageInstalled('prettier', packageJson);\n\n Sentry.setTag('prettier-installed', prettierInstalled);\n\n if (!prettierInstalled) {\n return;\n }\n\n // prompt the user if they want to run prettier\n const shouldRunPrettier = await abortIfCancelled(\n clack.confirm({\n message:\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n }),\n );\n\n if (!shouldRunPrettier) {\n return;\n }\n\n const prettierSpinner = clack.spinner();\n prettierSpinner.start('Running Prettier on your files.');\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`,\n (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n prettierSpinner.stop('Prettier failed to run.');\n clack.log.warn(\n 'Prettier failed to run. There may be formatting issues in your updated files.',\n );\n return;\n }\n\n prettierSpinner.stop('Prettier has formatted your files.');\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);\n const continueWithoutPackage = await abortIfCancelled(\n clack.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson(): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises\n .readFile(path.join(process.cwd(), 'package.json'), 'utf8')\n .catch(() => {\n clack.log.error(\n 'Could not find package.json. Make sure to run the wizard in the root of your app!',\n );\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'package.json',\n )}. Make sure it has a valid format!`,\n );\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function getPackageManager(): Promise<PackageManager> {\n const detectedPackageManager = detectPackageManger();\n\n if (detectedPackageManager) {\n return detectedPackageManager;\n }\n\n const selectedPackageManager: PackageManager | symbol =\n await abortIfCancelled(\n clack.select({\n message: 'Please select your package manager.',\n options: packageManagers.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n Sentry.setTag('package-manager', selectedPackageManager.name);\n\n return selectedPackageManager;\n}\n\nexport function isUsingTypeScript() {\n try {\n return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if we already got project data from a previous wizard invocation.\n * If yes, this data is returned.\n * Otherwise, we start the login flow and ask the user to select a project.\n *\n * Use this function to get project data for the wizard.\n *\n * @param options wizard options\n * @param platform the platform of the wizard\n * @returns project data (org, project, token, url)\n */\nexport async function getOrAskForProjectData(\n options: WizardOptions,\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native',\n): Promise<{\n sentryUrl: string;\n selfHosted: boolean;\n selectedProject: SentryProjectData;\n authToken: string;\n}> {\n if (options.preSelectedProject) {\n return {\n selfHosted: options.preSelectedProject.selfHosted,\n sentryUrl: options.url ?? SAAS_URL,\n authToken: options.preSelectedProject.authToken,\n selectedProject: options.preSelectedProject.project,\n };\n }\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url, options.saas),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\n orgSlug: options.orgSlug,\n projectSlug: options.projectSlug,\n }),\n );\n\n if (!projects || !projects.length) {\n clack.log.error(\n 'No projects found. Please create a project in Sentry and try again.',\n );\n Sentry.setTag('no-projects-found', true);\n await abort();\n // This rejection won't return due to the abort call but TS doesn't know that\n return Promise.reject();\n }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects, options.orgSlug, options.projectSlug),\n );\n\n const { token } = apiKeys ?? {};\n\n if (!token) {\n clack.log.error(`Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n${chalk.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);\n\n clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk.cyan(\n `\"${DUMMY_AUTH_TOKEN}\"`,\n )}) for you to replace later.\nCreate your auth token here:\n${chalk.cyan(\n selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`\n : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`,\n)}`);\n }\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,\n selectedProject,\n };\n}\n\n/**\n * Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.\n *\n * If users started the wizard with a --url arg, that URL is used as the default and we skip\n * the self-hosted question. However, the passed url is still validated and in case it's\n * invalid, users are asked to enter a new one until it is valid.\n *\n * @param urlFromArgs the url passed via the --url arg\n */\nasync function askForSelfHosted(\n urlFromArgs?: string,\n saas?: boolean,\n): Promise<{\n url: string;\n selfHosted: boolean;\n}> {\n if (saas) {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n\n if (!urlFromArgs) {\n const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(\n clack.select({\n message: 'Are you using Sentry SaaS or self-hosted Sentry?',\n options: [\n { value: 'saas', label: 'Sentry SaaS (sentry.io)' },\n {\n value: 'self-hosted',\n label: 'Self-hosted/on-premise/single-tenant',\n },\n ],\n }),\n );\n\n if (choice === 'saas') {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n }\n\n let validUrl: string | undefined;\n let tmpUrlFromArgs = urlFromArgs;\n\n while (validUrl === undefined) {\n const url =\n tmpUrlFromArgs ||\n (await abortIfCancelled(\n clack.text({\n message: `Please enter the URL of your ${\n urlFromArgs ? '' : 'self-hosted '\n }Sentry instance.`,\n placeholder: 'https://sentry.io/',\n }),\n ));\n tmpUrlFromArgs = undefined;\n\n try {\n validUrl = new URL(url).toString();\n\n // We assume everywhere else that the URL ends in a slash\n if (!validUrl.endsWith('/')) {\n validUrl += '/';\n }\n } catch {\n clack.log.error(\n `Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ${url})`,\n );\n }\n }\n\n const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;\n\n Sentry.setTag('url', validUrl);\n Sentry.setTag('self-hosted', isSelfHostedUrl);\n\n return { url: validUrl, selfHosted: true };\n}\n\nasync function askForWizardLogin(options: {\n url: string;\n promoCode?: string;\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native';\n orgSlug?: string;\n projectSlug?: string;\n}): Promise<WizardProjectData> {\n Sentry.setTag('has-promo-code', !!options.promoCode);\n\n let hasSentryAccount = await clack.confirm({\n message: 'Do you already have a Sentry account?',\n });\n\n hasSentryAccount = await abortIfCancelled(hasSentryAccount);\n\n Sentry.setTag('already-has-sentry-account', hasSentryAccount);\n\n let wizardHash: string;\n try {\n wizardHash = (\n await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)\n ).data.hash;\n } catch (e: unknown) {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please check your configuration and try again.\\n\\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n } else {\n clack.log.error('Loading Wizard failed.');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n }\n }\n\n const loginUrl = new URL(\n `${options.url}account/settings/wizard/${wizardHash!}/`,\n );\n\n if (options.orgSlug) {\n loginUrl.searchParams.set('org_slug', options.orgSlug);\n }\n\n if (options.projectSlug) {\n loginUrl.searchParams.set('project_slug', options.projectSlug);\n }\n\n if (!hasSentryAccount) {\n loginUrl.searchParams.set('signup', '1');\n if (options.platform) {\n loginUrl.searchParams.set('project_platform', options.platform);\n }\n }\n\n if (options.promoCode) {\n loginUrl.searchParams.set('code', options.promoCode);\n }\n\n const urlToOpen = loginUrl.toString();\n clack.log.info(\n `${chalk.bold(\n `If the browser window didn't open automatically, please open the following link to ${\n hasSentryAccount ? 'log' : 'sign'\n } into Sentry:`,\n )}\\n\\n${chalk.cyan(urlToOpen)}`,\n );\n\n opn(urlToOpen, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n\n const loginSpinner = clack.spinner();\n\n loginSpinner.start('Waiting for you to log in using the link above');\n\n const data = await new Promise<WizardProjectData>((resolve) => {\n const pollingInterval = setInterval(() => {\n axios\n .get<WizardProjectData>(`${options.url}api/0/wizard/${wizardHash}/`, {\n headers: {\n 'Accept-Encoding': 'deflate',\n },\n })\n .then((result) => {\n resolve(result.data);\n clearTimeout(timeout);\n clearInterval(pollingInterval);\n void axios.delete(`${options.url}api/0/wizard/${wizardHash}/`);\n })\n .catch(() => {\n // noop - just try again\n });\n }, 500);\n\n const timeout = setTimeout(() => {\n clearInterval(pollingInterval);\n loginSpinner.stop(\n 'Login timed out. No worries - it happens to the best of us.',\n );\n\n Sentry.setTag('opened-wizard-link', false);\n void abort('Please restart the Wizard and log in to complete the setup.');\n }, 180_000);\n });\n\n loginSpinner.stop('Login complete.');\n Sentry.setTag('opened-wizard-link', true);\n\n return data;\n}\n\nasync function askForProjectSelection(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n\n const filteredProjects = filterProjectsBySlugs(\n projects,\n orgSlug,\n projectSlug,\n );\n\n if (filteredProjects.length === 1) {\n const selection = filteredProjects[0];\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n clack.log.step(`Selected project ${label(selection)}`);\n\n return selection;\n }\n\n if (filteredProjects.length === 0) {\n clack.log.warn('Could not find a project with the provided slugs.');\n }\n\n const sortedProjects = filteredProjects.length ? filteredProjects : projects;\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\n });\n\n const selection: SentryProjectData | symbol = await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: 'Select your Sentry project.',\n options: sortedProjects.map((project) => {\n return {\n value: project,\n label: label(project),\n };\n }),\n }),\n );\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n\n return selection;\n}\n\nfunction filterProjectsBySlugs(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): SentryProjectData[] {\n if (!orgSlug && !projectSlug) {\n return projects;\n }\n if (orgSlug && !projectSlug) {\n return projects.filter((p) => p.organization.slug === orgSlug);\n }\n if (!orgSlug && projectSlug) {\n return projects.filter((p) => p.slug === projectSlug);\n }\n\n return projects.filter(\n (p) => p.organization.slug === orgSlug && p.slug === projectSlug,\n );\n}\n\n/**\n * Asks users if they have a config file for @param tool (e.g. Vite).\n * If yes, asks users to specify the path to their config file.\n *\n * Use this helper function as a fallback mechanism if the lookup for\n * a config file with its most usual location/name fails.\n *\n * @param toolName Name of the tool for which we're looking for the config file\n * @param configFileName Name of the most common config file name (e.g. vite.config.js)\n *\n * @returns a user path to the config file or undefined if the user doesn't have a config file\n */\nexport async function askForToolConfigPath(\n toolName: string,\n configFileName: string,\n): Promise<string | undefined> {\n const hasConfig = await abortIfCancelled(\n clack.confirm({\n message: `Do you have a ${toolName} config file (e.g. ${chalk.cyan(\n configFileName,\n )})?`,\n initialValue: true,\n }),\n );\n\n if (!hasConfig) {\n return undefined;\n }\n\n return await abortIfCancelled(\n clack.text({\n message: `Please enter the path to your ${toolName} config file:`,\n placeholder: path.join('.', configFileName),\n validate: (value) => {\n if (!value) {\n return 'Please enter a path.';\n }\n\n try {\n fs.accessSync(value);\n } catch {\n return 'Could not access the file at this path.';\n }\n },\n }),\n );\n}\n\n/**\n * Prints copy/paste-able instructions to the console.\n * Afterwards asks the user if they added the code snippet to their file.\n *\n * While there's no point in providing a \"no\" answer here, it gives users time to fulfill the\n * task before the wizard continues with additional steps.\n *\n * Use this function if you want to show users instructions on how to add/modify\n * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.\n *\n * @param filename the name of the file to which the code snippet should be applied.\n * If a path is provided, only the filename will be used.\n *\n * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the\n * diff-like format for visually highlighting unchanged or modified lines of code.\n *\n * @param hint (optional) a hint to be printed after the main instruction to add\n * the code from @param codeSnippet to their @param filename.\n *\n * More guidelines on copy/paste instructions:\n * @see {@link https://develop.sentry.dev/sdk/setup-wizards/#copy--paste-snippets}\n *\n * TODO: refactor copy paste instructions across different wizards to use this function.\n * this might require adding a custom message parameter to the function\n */\nexport async function showCopyPasteInstructions(\n filename: string,\n codeSnippet: string,\n hint?: string,\n): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.cyan(\n path.basename(filename),\n )} file:${hint ? chalk.dim(` (${chalk.dim(hint)})`) : ''}`,\n );\n\n // Padding the code snippet to be printed with a \\n at the beginning and end\n // This makes it easier to distinguish the snippet from the rest of the output\n // Intentionally logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(`\\n${codeSnippet}\\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you apply the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\n/**\n * Callback that exposes formatting helpers for a code snippet.\n * @param unchanged - Formats text as old code.\n * @param plus - Formats text as new code.\n * @param minus - Formats text as removed code.\n */\ntype CodeSnippetFormatter = (\n unchanged: (txt: string) => string,\n plus: (txt: string) => string,\n minus: (txt: string) => string,\n) => string;\n\n/**\n * Crafts a code snippet that can be used to e.g.\n * - print copy/paste instructions to the console\n * - create a new config file.\n *\n * @param colors set this to true if you want the final snippet to be colored.\n * This is useful for printing the snippet to the console as part of copy/paste instructions.\n *\n * @param callback the callback that returns the formatted code snippet.\n * It exposes takes the helper functions for marking code as unchanged, new or removed.\n * These functions no-op if no special formatting should be applied\n * and otherwise apply the appropriate formatting/coloring.\n * (@see {@link CodeSnippetFormatter})\n *\n * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.\n *\n * @returns a string containing the final, formatted code snippet.\n */\nexport function makeCodeSnippet(\n colors: boolean,\n callback: CodeSnippetFormatter,\n): string {\n const unchanged = (txt: string) => (colors ? chalk.grey(txt) : txt);\n const plus = (txt: string) => (colors ? chalk.greenBright(txt) : txt);\n const minus = (txt: string) => (colors ? chalk.redBright(txt) : txt);\n\n return callback(unchanged, plus, minus);\n}\n\n/**\n * Creates a new config file with the given @param filepath and @param codeSnippet.\n *\n * Use this function to create a new config file for users. This is useful\n * when users answered that they don't yet have a config file for a tool.\n *\n * (This doesn't mean that they don't yet have some other way of configuring\n * their tool but we can leave it up to them to figure out how to merge configs\n * here.)\n *\n * @param filepath absolute path to the new config file\n * @param codeSnippet the snippet to be inserted into the file\n * @param moreInformation (optional) the message to be printed after the file was created\n * For example, this can be a link to more information about configuring the tool.\n *\n * @returns true on success, false otherwise\n */\nexport async function createNewConfigFile(\n filepath: string,\n codeSnippet: string,\n moreInformation?: string,\n): Promise<boolean> {\n if (!path.isAbsolute(filepath)) {\n debug(`createNewConfigFile: filepath is not absolute: ${filepath}`);\n return false;\n }\n\n const prettyFilename = chalk.cyan(path.relative(process.cwd(), filepath));\n\n try {\n await fs.promises.writeFile(filepath, codeSnippet);\n\n clack.log.success(`Added new ${prettyFilename} file.`);\n\n if (moreInformation) {\n clack.log.info(chalk.gray(moreInformation));\n }\n\n return true;\n } catch (e) {\n debug(e);\n clack.log.warn(\n `Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`,\n );\n }\n\n return false;\n}\n\nexport async function askShouldCreateExamplePage(\n customRoute?: string,\n): Promise<boolean> {\n const route = chalk.cyan(customRoute ?? '/sentry-example-page');\n return traceStep('ask-create-example-page', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example page (\"${route}\") to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(\n features: F,\n): Promise<{ [key in F[number]['id']]: boolean }> {\n return traceStep('feature-selection', async () => {\n const selectedFeatures: Record<string, boolean> = {};\n\n for (const feature of features) {\n const selected = await abortIfCancelled(\n clack.select({\n message: feature.prompt,\n initialValue: true,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: feature.enabledHint,\n },\n {\n value: false,\n label: 'No',\n hint: feature.disabledHint,\n },\n ],\n }),\n );\n\n selectedFeatures[feature.id] = selected;\n }\n\n return selectedFeatures as { [key in F[number]['id']]: boolean };\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.34.
|
|
3
|
+
"version": "3.34.2",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -90,10 +90,11 @@ export async function runNextjsWizardWithTelemetry(
|
|
|
90
90
|
);
|
|
91
91
|
Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
const { packageManager: packageManagerFromInstallStep } =
|
|
94
|
+
await installPackage({
|
|
95
|
+
packageName: '@sentry/nextjs@^8',
|
|
96
|
+
alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],
|
|
97
|
+
});
|
|
97
98
|
|
|
98
99
|
await traceStep('configure-sdk', async () => {
|
|
99
100
|
const tunnelRoute = await askShouldSetTunnelRoute();
|
|
@@ -331,14 +332,15 @@ export async function runNextjsWizardWithTelemetry(
|
|
|
331
332
|
await traceStep('configure-ci', () => configureCI('nextjs', authToken));
|
|
332
333
|
}
|
|
333
334
|
|
|
334
|
-
const
|
|
335
|
+
const packageManagerForOutro =
|
|
336
|
+
packageManagerFromInstallStep ?? (await getPackageManager());
|
|
335
337
|
await runPrettierIfInstalled();
|
|
336
338
|
|
|
337
339
|
clack.outro(`
|
|
338
340
|
${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${
|
|
339
341
|
shouldCreateExamplePage
|
|
340
342
|
? `\n\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(
|
|
341
|
-
`${
|
|
343
|
+
`${packageManagerForOutro.runScriptCommand} dev`,
|
|
342
344
|
)}) and visiting ${chalk.cyan('"/sentry-example-page"')}`
|
|
343
345
|
: ''
|
|
344
346
|
}${
|
package/src/utils/clack-utils.ts
CHANGED
|
@@ -358,7 +358,7 @@ export async function installPackage({
|
|
|
358
358
|
packageName: string;
|
|
359
359
|
alreadyInstalled: boolean;
|
|
360
360
|
askBeforeUpdating?: boolean;
|
|
361
|
-
}): Promise<
|
|
361
|
+
}): Promise<{ packageManager?: PackageManager }> {
|
|
362
362
|
return traceStep('install-package', async () => {
|
|
363
363
|
if (alreadyInstalled && askBeforeUpdating) {
|
|
364
364
|
const shouldUpdatePackage = await abortIfCancelled(
|
|
@@ -370,7 +370,7 @@ export async function installPackage({
|
|
|
370
370
|
);
|
|
371
371
|
|
|
372
372
|
if (!shouldUpdatePackage) {
|
|
373
|
-
return;
|
|
373
|
+
return {};
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -428,6 +428,8 @@ export async function installPackage({
|
|
|
428
428
|
packageName,
|
|
429
429
|
)} with ${chalk.bold(packageManager.label)}.`,
|
|
430
430
|
);
|
|
431
|
+
|
|
432
|
+
return { packageManager };
|
|
431
433
|
});
|
|
432
434
|
}
|
|
433
435
|
|