@sentry/wizard 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/bin.ts +29 -19
- package/dist/bin.js +23 -18
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +0 -9
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +26 -10
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.d.ts → NextJsShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.js → NextJsShim.js} +13 -10
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +1 -0
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +4 -1
- package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.d.ts → SvelteKitShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.js → SvelteKitShim.js} +13 -10
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +1 -0
- package/dist/package.json +3 -3
- package/dist/src/nextjs/nextjs-wizard.d.ts +2 -5
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +2 -5
- package/dist/src/sourcemaps/sourcemaps-wizard.js +34 -19
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.d.ts +1 -0
- package/dist/src/sourcemaps/tools/create-react-app.js +69 -0
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -0
- package/dist/src/sourcemaps/tools/sentry-cli.js +5 -0
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/utils/sdk-version.d.ts +14 -0
- package/dist/src/sourcemaps/utils/sdk-version.js +275 -0
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -0
- package/dist/src/sveltekit/sveltekit-wizard.d.ts +2 -5
- package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +13 -2
- package/dist/src/utils/clack-utils.js +76 -43
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +12 -0
- package/dist/src/utils/types.js +3 -0
- package/dist/src/utils/types.js.map +1 -0
- package/lib/Helper/Wizard.ts +0 -9
- package/lib/Setup.ts +1 -0
- package/lib/Steps/ChooseIntegration.ts +35 -11
- package/lib/Steps/Integrations/{NextJs.ts → NextJsShim.ts} +5 -2
- package/lib/Steps/Integrations/SourceMapsShim.ts +4 -1
- package/lib/Steps/Integrations/{SvelteKit.ts → SvelteKitShim.ts} +5 -2
- package/package.json +3 -3
- package/src/nextjs/nextjs-wizard.ts +3 -8
- package/src/sourcemaps/sourcemaps-wizard.ts +21 -11
- package/src/sourcemaps/tools/create-react-app.ts +19 -0
- package/src/sourcemaps/tools/sentry-cli.ts +5 -0
- package/src/sourcemaps/utils/sdk-version.ts +264 -0
- package/src/sveltekit/sveltekit-wizard.ts +3 -6
- package/src/utils/clack-utils.ts +69 -27
- package/src/utils/types.ts +13 -0
- package/dist/lib/Steps/Integrations/NextJs.js.map +0 -1
- package/dist/lib/Steps/Integrations/SvelteKit.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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;A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KAAK,CACT,UAAG,eAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,oBAEtC,eAAK,CAAC,IAAI,CACV,gHAAgH,CACjH,eAEF,kBAAkB;wBAChB,CAAC,CAAC,2IAEL;wBACG,CAAC,CAAC,EAAE,kBAEH,eAAK,CAAC,GAAG,CACT,sGAAsG,CACvG,CAAE,CACH,CAAC;;;;;CACH;AAzVD,0CAyVC","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 {\n abort,\n abortIfCancelled,\n addSentryCliRc,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n ensurePackageIsInstalled,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport {\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getNextjsSentryBuildOptionsTemplate,\n getNextjsWebpackPluginOptionsTemplate,\n getSentryConfigContents,\n getSentryExampleApiRoute,\n getSentryExamplePageContents,\n} from './templates';\n\ninterface NextjsWizardOptions {\n promoCode?: string;\n}\n\n// eslint-disable-next-line complexity\nexport async function runNextjsWizard(\n options: NextjsWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const packageJson = await getPackageDotJson();\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted();\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: 'javascript-nextjs',\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n await installPackage({\n packageName: '@sentry/nextjs',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n });\n\n let isUsingTypescript = false;\n try {\n isUsingTypescript = fs.existsSync(\n path.join(process.cwd(), 'tsconfig.json'),\n );\n } catch {\n // noop - Default to assuming user is not using typescript\n }\n\n const configVariants = ['server', 'client', 'edge'] as const;\n\n for (const configVariant of configVariants) {\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\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.bold(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.bold(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), isUsingTypescript ? tsConfig : jsConfig),\n getSentryConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.bold(isUsingTypescript ? tsConfig : jsConfig)}.`,\n );\n }\n }\n\n const sentryWebpackOptionsTemplate = getNextjsWebpackPluginOptionsTemplate(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n const sentryBuildOptionsTemplate = getNextjsSentryBuildOptionsTemplate();\n\n const nextConfigJs = 'next.config.js';\n const nextConfigMjs = 'next.config.mjs';\n\n const nextConfigJsExists = fs.existsSync(\n path.join(process.cwd(), nextConfigJs),\n );\n const nextConfigMjsExists = fs.existsSync(\n path.join(process.cwd(), nextConfigMjs),\n );\n\n if (!nextConfigJsExists && !nextConfigMjsExists) {\n await fs.promises.writeFile(\n path.join(process.cwd(), nextConfigJs),\n getNextjsConfigCjsTemplate(\n sentryWebpackOptionsTemplate,\n sentryBuildOptionsTemplate,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.bold('next.config.js')} with Sentry configuration.`,\n );\n }\n\n if (nextConfigJsExists) {\n const nextConfgiJsContent = fs.readFileSync(\n path.join(process.cwd(), nextConfigJs),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfgiJsContent.includes('@sentry/nextjs') &&\n nextConfgiJsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.bold(\n nextConfigJs,\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(), nextConfigJs),\n getNextjsConfigCjsAppendix(\n sentryWebpackOptionsTemplate,\n sentryBuildOptionsTemplate,\n ),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.bold(nextConfigJs)}. ${chalk.dim(\n '(you probably want to clean this up a bit!)',\n )}`,\n );\n }\n }\n\n if (nextConfigMjsExists) {\n const nextConfgiMjsContent = fs.readFileSync(\n path.join(process.cwd(), nextConfigMjs),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfgiMjsContent.includes('@sentry/nextjs') &&\n nextConfgiMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.bold(\n nextConfigMjs,\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(nextConfgiMjsContent);\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 ${sentryWebpackOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), nextConfigMjs),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.bold(\n nextConfigMjs,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n } catch {\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.bold(nextConfigMjs)}`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.bold(\n nextConfigMjs,\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(\n sentryWebpackOptionsTemplate,\n sentryBuildOptionsTemplate,\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.bold(\n nextConfigMjs,\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 const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(process.cwd(), 'src', 'pages');\n\n let 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 pagesLocation = ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...pagesLocation), {\n recursive: true,\n });\n }\n\n if (pagesLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, 'sentry-example-page.js'),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.bold(\n path.join(...pagesLocation, 'sentry-example-page.js'),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesLocation, 'api'), {\n recursive: true,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesLocation,\n 'api',\n 'sentry-example-api.js',\n ),\n getSentryExampleApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.bold(\n path.join(...pagesLocation, 'api', 'sentry-example-api.js'),\n )}.`,\n );\n }\n\n await addSentryCliRc(apiKeys.token);\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n clack.outro(\n `${chalk.green('Everything is set up!')}\n\n ${chalk.cyan(\n 'You can validate your setup by starting your dev environment (`next dev`) and visiting \"/sentry-example-page\".',\n )}\n${\n mightBeUsingVercel\n ? `\n ▲ It seems like you're using Vercel. We recommend using the Sentry Vercel integration: https://vercel.com/integrations/sentry\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}\n"]}
|
|
1
|
+
{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,KAAK,EAAE,uBAAuB,WAC3D,MAAG,CACL,CAAC;;yBAGJ,qBAAM,IAAA,4BAAc,EAAC,OAAO,CAAC,KAAK,CAAC,EAAA;;oBAAnC,SAAmC,CAAC;oBAE9B,kBAAkB,GAAG,EAAE,CAAC,UAAU,CACtC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CACxC,CAAC;oBAEF,iBAAK,CAAC,KAAK,CACT,UAAG,eAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,oBAEtC,eAAK,CAAC,IAAI,CACV,gHAAgH,CACjH,eAEF,kBAAkB;wBAChB,CAAC,CAAC,2IAEL;wBACG,CAAC,CAAC,EAAE,kBAEH,eAAK,CAAC,GAAG,CACT,sGAAsG,CACvG,CAAE,CACH,CAAC;;;;;CACH;AAvVD,0CAuVC","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 {\n abort,\n abortIfCancelled,\n addSentryCliRc,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n ensurePackageIsInstalled,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport {\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getNextjsSentryBuildOptionsTemplate,\n getNextjsWebpackPluginOptionsTemplate,\n getSentryConfigContents,\n getSentryExampleApiRoute,\n getSentryExamplePageContents,\n} from './templates';\n\n// eslint-disable-next-line complexity\nexport async function runNextjsWizard(options: WizardOptions): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const packageJson = await getPackageDotJson();\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted(options.url);\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: 'javascript-nextjs',\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n await installPackage({\n packageName: '@sentry/nextjs',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n });\n\n let isUsingTypescript = false;\n try {\n isUsingTypescript = fs.existsSync(\n path.join(process.cwd(), 'tsconfig.json'),\n );\n } catch {\n // noop - Default to assuming user is not using typescript\n }\n\n const configVariants = ['server', 'client', 'edge'] as const;\n\n for (const configVariant of configVariants) {\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\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.bold(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.bold(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), isUsingTypescript ? tsConfig : jsConfig),\n getSentryConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.bold(isUsingTypescript ? tsConfig : jsConfig)}.`,\n );\n }\n }\n\n const sentryWebpackOptionsTemplate = getNextjsWebpackPluginOptionsTemplate(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n const sentryBuildOptionsTemplate = getNextjsSentryBuildOptionsTemplate();\n\n const nextConfigJs = 'next.config.js';\n const nextConfigMjs = 'next.config.mjs';\n\n const nextConfigJsExists = fs.existsSync(\n path.join(process.cwd(), nextConfigJs),\n );\n const nextConfigMjsExists = fs.existsSync(\n path.join(process.cwd(), nextConfigMjs),\n );\n\n if (!nextConfigJsExists && !nextConfigMjsExists) {\n await fs.promises.writeFile(\n path.join(process.cwd(), nextConfigJs),\n getNextjsConfigCjsTemplate(\n sentryWebpackOptionsTemplate,\n sentryBuildOptionsTemplate,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.bold('next.config.js')} with Sentry configuration.`,\n );\n }\n\n if (nextConfigJsExists) {\n const nextConfgiJsContent = fs.readFileSync(\n path.join(process.cwd(), nextConfigJs),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfgiJsContent.includes('@sentry/nextjs') &&\n nextConfgiJsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.bold(\n nextConfigJs,\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(), nextConfigJs),\n getNextjsConfigCjsAppendix(\n sentryWebpackOptionsTemplate,\n sentryBuildOptionsTemplate,\n ),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.bold(nextConfigJs)}. ${chalk.dim(\n '(you probably want to clean this up a bit!)',\n )}`,\n );\n }\n }\n\n if (nextConfigMjsExists) {\n const nextConfgiMjsContent = fs.readFileSync(\n path.join(process.cwd(), nextConfigMjs),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfgiMjsContent.includes('@sentry/nextjs') &&\n nextConfgiMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.bold(\n nextConfigMjs,\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(nextConfgiMjsContent);\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 ${sentryWebpackOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), nextConfigMjs),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.bold(\n nextConfigMjs,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n } catch {\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.bold(nextConfigMjs)}`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.bold(\n nextConfigMjs,\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(\n sentryWebpackOptionsTemplate,\n sentryBuildOptionsTemplate,\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.bold(\n nextConfigMjs,\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 const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(process.cwd(), 'src', 'pages');\n\n let 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 pagesLocation = ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...pagesLocation), {\n recursive: true,\n });\n }\n\n if (pagesLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, 'sentry-example-page.js'),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.bold(\n path.join(...pagesLocation, 'sentry-example-page.js'),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesLocation, 'api'), {\n recursive: true,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesLocation,\n 'api',\n 'sentry-example-api.js',\n ),\n getSentryExampleApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.bold(\n path.join(...pagesLocation, 'api', 'sentry-example-api.js'),\n )}.`,\n );\n }\n\n await addSentryCliRc(apiKeys.token);\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n clack.outro(\n `${chalk.green('Everything is set up!')}\n\n ${chalk.cyan(\n 'You can validate your setup by starting your dev environment (`next dev`) and visiting \"/sentry-example-page\".',\n )}\n${\n mightBeUsingVercel\n ? `\n ▲ It seems like you're using Vercel. We recommend using the Sentry Vercel integration: https://vercel.com/integrations/sentry\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}\n"]}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export declare function runSourcemapsWizard(options: SourceMapsWizardOptions): Promise<void>;
|
|
5
|
-
export {};
|
|
1
|
+
import { WizardOptions } from '../utils/types';
|
|
2
|
+
export declare function runSourcemapsWizard(options: WizardOptions): Promise<void>;
|
|
@@ -75,6 +75,8 @@ var webpack_1 = require("./tools/webpack");
|
|
|
75
75
|
var tsc_1 = require("./tools/tsc");
|
|
76
76
|
var rollup_1 = require("./tools/rollup");
|
|
77
77
|
var esbuild_1 = require("./tools/esbuild");
|
|
78
|
+
var create_react_app_1 = require("./tools/create-react-app");
|
|
79
|
+
var sdk_version_1 = require("./utils/sdk-version");
|
|
78
80
|
function runSourcemapsWizard(options) {
|
|
79
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
82
|
var _a, sentryUrl, selfHosted, _b, projects, apiKeys, selectedProject, selectedTool, addedEnvVarToCI, arrow;
|
|
@@ -89,20 +91,23 @@ function runSourcemapsWizard(options) {
|
|
|
89
91
|
return [4 /*yield*/, (0, clack_utils_1.confirmContinueEvenThoughNoGitRepo)()];
|
|
90
92
|
case 1:
|
|
91
93
|
_c.sent();
|
|
92
|
-
return [4 /*yield*/, (0,
|
|
94
|
+
return [4 /*yield*/, (0, sdk_version_1.ensureMinimumSdkVersionIsInstalled)()];
|
|
93
95
|
case 2:
|
|
96
|
+
_c.sent();
|
|
97
|
+
return [4 /*yield*/, (0, clack_utils_1.askForSelfHosted)(options.url)];
|
|
98
|
+
case 3:
|
|
94
99
|
_a = _c.sent(), sentryUrl = _a.url, selfHosted = _a.selfHosted;
|
|
95
100
|
return [4 /*yield*/, (0, clack_utils_1.askForWizardLogin)({
|
|
96
101
|
promoCode: options.promoCode,
|
|
97
102
|
url: sentryUrl,
|
|
98
103
|
})];
|
|
99
|
-
case
|
|
104
|
+
case 4:
|
|
100
105
|
_b = _c.sent(), projects = _b.projects, apiKeys = _b.apiKeys;
|
|
101
106
|
return [4 /*yield*/, (0, clack_utils_1.askForProjectSelection)(projects)];
|
|
102
|
-
case
|
|
107
|
+
case 5:
|
|
103
108
|
selectedProject = _c.sent();
|
|
104
109
|
return [4 /*yield*/, askForUsedBundlerTool()];
|
|
105
|
-
case
|
|
110
|
+
case 6:
|
|
106
111
|
selectedTool = _c.sent();
|
|
107
112
|
Sentry.setTag('selected-tool', selectedTool);
|
|
108
113
|
return [4 /*yield*/, startToolSetupFlow(selectedTool, {
|
|
@@ -112,7 +117,7 @@ function runSourcemapsWizard(options) {
|
|
|
112
117
|
url: sentryUrl,
|
|
113
118
|
authToken: apiKeys.token,
|
|
114
119
|
})];
|
|
115
|
-
case
|
|
120
|
+
case 7:
|
|
116
121
|
_c.sent();
|
|
117
122
|
prompts_1.default.log.step('Add the Sentry authentication token as an environment variable to your CI setup:');
|
|
118
123
|
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
@@ -131,7 +136,7 @@ function runSourcemapsWizard(options) {
|
|
|
131
136
|
],
|
|
132
137
|
initialValue: true,
|
|
133
138
|
}))];
|
|
134
|
-
case
|
|
139
|
+
case 8:
|
|
135
140
|
addedEnvVarToCI = _c.sent();
|
|
136
141
|
Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);
|
|
137
142
|
if (!addedEnvVarToCI) {
|
|
@@ -156,28 +161,33 @@ function askForUsedBundlerTool() {
|
|
|
156
161
|
{
|
|
157
162
|
label: 'Webpack',
|
|
158
163
|
value: 'webpack',
|
|
159
|
-
hint: '
|
|
164
|
+
hint: 'Select this if you are using Webpack and you have access to your Webpack config.',
|
|
160
165
|
},
|
|
161
166
|
{
|
|
162
167
|
label: 'Vite',
|
|
163
168
|
value: 'vite',
|
|
164
|
-
hint: '
|
|
169
|
+
hint: 'Select this if you are using Vite and you have access to your Vite config.',
|
|
165
170
|
},
|
|
166
171
|
{
|
|
167
172
|
label: 'esbuild',
|
|
168
173
|
value: 'esbuild',
|
|
169
|
-
hint: '
|
|
174
|
+
hint: 'Select this if you are using esbuild and you have access to your esbuild config.',
|
|
170
175
|
},
|
|
171
176
|
{
|
|
172
177
|
label: 'Rollup',
|
|
173
178
|
value: 'rollup',
|
|
174
|
-
hint: '
|
|
179
|
+
hint: 'Select this if you are using Rollup and you have access to your Rollup config.',
|
|
175
180
|
},
|
|
176
181
|
{
|
|
177
182
|
label: 'tsc',
|
|
178
183
|
value: 'tsc',
|
|
179
184
|
hint: 'Configure source maps when using tsc as build tool',
|
|
180
185
|
},
|
|
186
|
+
{
|
|
187
|
+
label: 'Create React App',
|
|
188
|
+
value: 'create-react-app',
|
|
189
|
+
hint: 'Select this option if you set up your app with Create React App.',
|
|
190
|
+
},
|
|
181
191
|
{
|
|
182
192
|
label: 'None of the above',
|
|
183
193
|
value: 'sentry-cli',
|
|
@@ -205,33 +215,38 @@ function startToolSetupFlow(selctedTool, options) {
|
|
|
205
215
|
case 'esbuild': return [3 /*break*/, 5];
|
|
206
216
|
case 'rollup': return [3 /*break*/, 7];
|
|
207
217
|
case 'tsc': return [3 /*break*/, 9];
|
|
218
|
+
case 'create-react-app': return [3 /*break*/, 11];
|
|
208
219
|
}
|
|
209
|
-
return [3 /*break*/,
|
|
220
|
+
return [3 /*break*/, 13];
|
|
210
221
|
case 1: return [4 /*yield*/, (0, webpack_1.configureWebPackPlugin)(options)];
|
|
211
222
|
case 2:
|
|
212
223
|
_b.sent();
|
|
213
|
-
return [3 /*break*/,
|
|
224
|
+
return [3 /*break*/, 15];
|
|
214
225
|
case 3: return [4 /*yield*/, (0, vite_1.configureVitePlugin)(options)];
|
|
215
226
|
case 4:
|
|
216
227
|
_b.sent();
|
|
217
|
-
return [3 /*break*/,
|
|
228
|
+
return [3 /*break*/, 15];
|
|
218
229
|
case 5: return [4 /*yield*/, (0, esbuild_1.configureEsbuildPlugin)(options)];
|
|
219
230
|
case 6:
|
|
220
231
|
_b.sent();
|
|
221
|
-
return [3 /*break*/,
|
|
232
|
+
return [3 /*break*/, 15];
|
|
222
233
|
case 7: return [4 /*yield*/, (0, rollup_1.configureRollupPlugin)(options)];
|
|
223
234
|
case 8:
|
|
224
235
|
_b.sent();
|
|
225
|
-
return [3 /*break*/,
|
|
236
|
+
return [3 /*break*/, 15];
|
|
226
237
|
case 9: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, tsc_1.configureTscSourcemapGenerationFlow)];
|
|
227
238
|
case 10:
|
|
228
239
|
_b.sent();
|
|
229
|
-
return [3 /*break*/,
|
|
230
|
-
case 11: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options)];
|
|
240
|
+
return [3 /*break*/, 15];
|
|
241
|
+
case 11: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, create_react_app_1.configureCRASourcemapGenerationFlow)];
|
|
231
242
|
case 12:
|
|
232
243
|
_b.sent();
|
|
233
|
-
return [3 /*break*/,
|
|
234
|
-
case 13: return [
|
|
244
|
+
return [3 /*break*/, 15];
|
|
245
|
+
case 13: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options)];
|
|
246
|
+
case 14:
|
|
247
|
+
_b.sent();
|
|
248
|
+
return [3 /*break*/, 15];
|
|
249
|
+
case 15: return [2 /*return*/];
|
|
235
250
|
}
|
|
236
251
|
});
|
|
237
252
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourcemaps-wizard.js","sourceRoot":"","sources":["../../../src/sourcemaps/sourcemaps-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,SAAkC,CAAC;oBACnC,yBAAM;wBAEN,qBAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,yBAAM;wBAEN,qBAAM,IAAA,8BAAqB,EAAC,OAAO,CAAC,EAAA;;oBAApC,SAAoC,CAAC;oBACrC,yBAAM;wBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,EAAE,yCAAmC,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;oBACvE,yBAAM;yBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,CAAC,EAAA;;oBAAjC,SAAiC,CAAC;oBAClC,yBAAM;;;;;CAEX","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nimport {\n abortIfCancelled,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { configureSentryCLI } from './tools/sentry-cli';\nimport { configureWebPackPlugin } from './tools/webpack';\nimport { configureTscSourcemapGenerationFlow } from './tools/tsc';\nimport { configureRollupPlugin } from './tools/rollup';\nimport { configureEsbuildPlugin } from './tools/esbuild';\n\ninterface SourceMapsWizardOptions {\n promoCode?: string;\n}\n\ntype SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli';\n\nexport async function runSourcemapsWizard(\n options: SourceMapsWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Source Maps Upload Configuration Wizard',\n message:\n 'This wizard will help you upload source maps to Sentry as part of your build.\\nThank you for using Sentry :)\\n\\n(This setup wizard sends telemetry data and crash reports to Sentry.\\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted();\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n const selectedTool = await askForUsedBundlerTool();\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n });\n\n clack.log.step(\n 'Add the Sentry authentication token as an environment variable to your CI setup:',\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\nSENTRY_AUTH_TOKEN=${apiKeys.token}\n`),\n );\n\n clack.log.warn(\n chalk.yellow('DO NOT commit this auth token to your repository!'),\n );\n\n const addedEnvVarToCI = await abortIfCancelled(\n clack.select({\n message: 'Did you configure CI as shown above?',\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to set the auth token to upload source maps in CI',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);\n\n if (!addedEnvVarToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Validate your setup with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}.\n ${chalk.gray(\n `${arrow} You should see source map upload logs in your console.`,\n )}\n 2. Run your application and throw a test error.\n ${chalk.gray(`${arrow} The error should be visible in Sentry.`)}\n 3. Open the error in Sentry and verify that it's source-mapped.\n ${chalk.gray(\n `${arrow} The stack trace should show your original source code.`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedTools> {\n const selectedTool: SupportedTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which bundler or build tool are you using?',\n options: [\n {\n label: 'Webpack',\n value: 'webpack',\n hint: 'Configure source maps upload using Webpack',\n },\n {\n label: 'Vite',\n value: 'vite',\n hint: 'Configure source maps upload using Vite',\n },\n {\n label: 'esbuild',\n value: 'esbuild',\n hint: 'Configure source maps upload using esbuild',\n },\n {\n label: 'Rollup',\n value: 'rollup',\n hint: 'Configure source maps upload using Rollup',\n },\n {\n label: 'tsc',\n value: 'tsc',\n hint: 'Configure source maps when using tsc as build tool',\n },\n {\n label: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'esbuild':\n await configureEsbuildPlugin(options);\n break;\n case 'rollup':\n await configureRollupPlugin(options);\n break;\n case 'tsc':\n await configureSentryCLI(options, configureTscSourcemapGenerationFlow);\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sourcemaps-wizard.js","sourceRoot":"","sources":["../../../src/sourcemaps/sourcemaps-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AAEvC,oDAO8B;AAC9B,6EAA0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AkB;;;wBAdrB,qBAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,yBAAM;wBAEN,qBAAM,IAAA,0BAAmB,EAAC,OAAO,CAAC,EAAA;;oBAAlC,SAAkC,CAAC;oBACnC,yBAAM;wBAEN,qBAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,yBAAM;wBAEN,qBAAM,IAAA,8BAAqB,EAAC,OAAO,CAAC,EAAA;;oBAApC,SAAoC,CAAC;oBACrC,yBAAM;wBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,EAAE,yCAAmC,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;oBACvE,yBAAM;yBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,EAAE,sDAAmC,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;oBACvE,yBAAM;yBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,CAAC,EAAA;;oBAAjC,SAAiC,CAAC;oBAClC,yBAAM;;;;;CAEX","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nimport {\n abortIfCancelled,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { configureSentryCLI } from './tools/sentry-cli';\nimport { configureWebPackPlugin } from './tools/webpack';\nimport { configureTscSourcemapGenerationFlow } from './tools/tsc';\nimport { configureRollupPlugin } from './tools/rollup';\nimport { configureEsbuildPlugin } from './tools/esbuild';\nimport { WizardOptions } from '../utils/types';\nimport { configureCRASourcemapGenerationFlow } from './tools/create-react-app';\nimport { ensureMinimumSdkVersionIsInstalled } from './utils/sdk-version';\n\ntype SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli'\n | 'create-react-app';\n\nexport async function runSourcemapsWizard(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Source Maps Upload Configuration Wizard',\n message:\n 'This wizard will help you upload source maps to Sentry as part of your build.\\nThank you for using Sentry :)\\n\\n(This setup wizard sends telemetry data and crash reports to Sentry.\\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n await ensureMinimumSdkVersionIsInstalled();\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted(options.url);\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n const selectedTool = await askForUsedBundlerTool();\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n });\n\n clack.log.step(\n 'Add the Sentry authentication token as an environment variable to your CI setup:',\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\nSENTRY_AUTH_TOKEN=${apiKeys.token}\n`),\n );\n\n clack.log.warn(\n chalk.yellow('DO NOT commit this auth token to your repository!'),\n );\n\n const addedEnvVarToCI = await abortIfCancelled(\n clack.select({\n message: 'Did you configure CI as shown above?',\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to set the auth token to upload source maps in CI',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);\n\n if (!addedEnvVarToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Validate your setup with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}.\n ${chalk.gray(\n `${arrow} You should see source map upload logs in your console.`,\n )}\n 2. Run your application and throw a test error.\n ${chalk.gray(`${arrow} The error should be visible in Sentry.`)}\n 3. Open the error in Sentry and verify that it's source-mapped.\n ${chalk.gray(\n `${arrow} The stack trace should show your original source code.`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedTools> {\n const selectedTool: SupportedTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which bundler or build tool are you using?',\n options: [\n {\n label: 'Webpack',\n value: 'webpack',\n hint: 'Select this if you are using Webpack and you have access to your Webpack config.',\n },\n {\n label: 'Vite',\n value: 'vite',\n hint: 'Select this if you are using Vite and you have access to your Vite config.',\n },\n {\n label: 'esbuild',\n value: 'esbuild',\n hint: 'Select this if you are using esbuild and you have access to your esbuild config.',\n },\n {\n label: 'Rollup',\n value: 'rollup',\n hint: 'Select this if you are using Rollup and you have access to your Rollup config.',\n },\n {\n label: 'tsc',\n value: 'tsc',\n hint: 'Configure source maps when using tsc as build tool',\n },\n {\n label: 'Create React App',\n value: 'create-react-app',\n hint: 'Select this option if you set up your app with Create React App.',\n },\n {\n label: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'esbuild':\n await configureEsbuildPlugin(options);\n break;\n case 'rollup':\n await configureRollupPlugin(options);\n break;\n case 'tsc':\n await configureSentryCLI(options, configureTscSourcemapGenerationFlow);\n break;\n case 'create-react-app':\n await configureSentryCLI(options, configureCRASourcemapGenerationFlow);\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function configureCRASourcemapGenerationFlow(): Promise<void>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.configureCRASourcemapGenerationFlow = void 0;
|
|
43
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
44
|
+
var prompts_1 = __importDefault(require("@clack/prompts"));
|
|
45
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
46
|
+
function configureCRASourcemapGenerationFlow() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
51
|
+
message: "Verify that you are generating source maps when building your React app.\nGenerally this should already happen unless you set the GENERATE_SOURCEMAPS environment variable to false.",
|
|
52
|
+
options: [
|
|
53
|
+
{
|
|
54
|
+
label: 'I checked!',
|
|
55
|
+
hint: 'My build output folder contains .js.map files after a build.',
|
|
56
|
+
value: true,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
initialValue: true,
|
|
60
|
+
}))];
|
|
61
|
+
case 1:
|
|
62
|
+
_a.sent();
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.configureCRASourcemapGenerationFlow = configureCRASourcemapGenerationFlow;
|
|
69
|
+
//# sourceMappingURL=create-react-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-react-app.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/create-react-app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,uDAA2D;AAE3D,SAAsB,mCAAmC;;;;wBACvD,qBAAM,IAAA,8BAAgB,EACpB,iBAAK,CAAC,MAAM,CAAC;wBACX,OAAO,EAAE,sLAAsL;wBAC/L,OAAO,EAAE;4BACP;gCACE,KAAK,EAAE,YAAY;gCACnB,IAAI,EAAE,8DAA8D;gCACpE,KAAK,EAAE,IAAI;6BACZ;yBACF;wBACD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;oBAZD,SAYC,CAAC;;;;;CACH;AAdD,kFAcC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport { abortIfCancelled } from '../../utils/clack-utils';\n\nexport async function configureCRASourcemapGenerationFlow(): Promise<void> {\n await abortIfCancelled(\n clack.select({\n message: `Verify that you are generating source maps when building your React app.\\nGenerally this should already happen unless you set the GENERATE_SOURCEMAPS environment variable to false.`,\n options: [\n {\n label: 'I checked!',\n hint: 'My build output folder contains .js.map files after a build.',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n}\n"]}
|
|
@@ -90,6 +90,11 @@ function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
|
90
90
|
case 3: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.text({
|
|
91
91
|
message: 'Where are your build artifacts located?',
|
|
92
92
|
placeholder: ".".concat(path.sep, "out"),
|
|
93
|
+
validate: function (value) {
|
|
94
|
+
if (!value) {
|
|
95
|
+
return 'Please enter a path.';
|
|
96
|
+
}
|
|
97
|
+
},
|
|
93
98
|
}))];
|
|
94
99
|
case 4:
|
|
95
100
|
rawArtifactPath = _b.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry-cli.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/sentry-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AACvC,yCAA6B;AAC7B,qCAAyB;AACzB,uDAMiC;AAIjC,SAAsB,kBAAkB,CACtC,OAAgD,EAChD,gCAA+F;IAA/F,iDAAA,EAAA,0EAA+F;;;;;wBAExE,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAA1C,cAAc,GAAG,SAAyB;oBAEhD,qBAAM,IAAA,4BAAc,EAAC;4BACnB,WAAW,EAAE,aAAa;4BAC1B,gBAAgB,EAAE,IAAA,iCAAmB,EAAC,aAAa,EAAE,cAAc,CAAC;yBACrE,CAAC,EAAA;;oBAHF,SAGE,CAAC;oBAEC,SAAS,GAAG,KAAK,CAAC;;wBAGI,qBAAM,IAAA,8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uE,CACxE,CAAE;wBACH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACzD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;oBARD,SAQC,CAAC;;;;;CACH","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport {\n abortIfCancelled,\n addSentryCliRc,\n getPackageDotJson,\n hasPackageInstalled,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport { SourceMapUploadToolConfigurationOptions } from './types';\n\nexport async function configureSentryCLI(\n options: SourceMapUploadToolConfigurationOptions,\n configureSourcemapGenerationFlow: () => Promise<void> = defaultConfigureSourcemapGenerationFlow,\n): Promise<void> {\n const packageDotJson = await getPackageDotJson();\n\n await installPackage({\n packageName: '@sentry/cli',\n alreadyInstalled: hasPackageInstalled('@sentry/cli', packageDotJson),\n });\n\n let validPath = false;\n let relativeArtifactPath;\n do {\n const rawArtifactPath = await abortIfCancelled(\n clack.text({\n message: 'Where are your build artifacts located?',\n placeholder: `.${path.sep}out`,\n validate(value) {\n if (!value) {\n return 'Please enter a path.';\n }\n },\n }),\n );\n\n if (path.isAbsolute(rawArtifactPath)) {\n relativeArtifactPath = path.relative(process.cwd(), rawArtifactPath);\n } else {\n relativeArtifactPath = rawArtifactPath;\n }\n\n try {\n await fs.promises.access(path.join(process.cwd(), relativeArtifactPath));\n validPath = true;\n } catch {\n validPath = await abortIfCancelled(\n clack.select({\n message: `We couldn't find artifacts at ${relativeArtifactPath}. Are you sure that this is the location that contains your build artifacts?`,\n options: [\n {\n label: 'No, let me verify.',\n value: false,\n },\n { label: 'Yes, I am sure!', value: true },\n ],\n initialValue: false,\n }),\n );\n }\n } while (!validPath);\n\n const relativePosixArtifactPath = relativeArtifactPath\n .split(path.sep)\n .join(path.posix.sep);\n\n await configureSourcemapGenerationFlow();\n\n packageDotJson.scripts = packageDotJson.scripts || {};\n packageDotJson.scripts['sentry:ci'] = `sentry-cli sourcemaps inject --org ${\n options.orgSlug\n } --project ${\n options.projectSlug\n } ${relativePosixArtifactPath} && sentry-cli${\n options.selfHosted ? ` --url ${options.url}` : ''\n } sourcemaps upload --org ${options.orgSlug} --project ${\n options.projectSlug\n } ${relativePosixArtifactPath}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageDotJson, null, 2),\n );\n\n clack.log.info(\n `Added a ${chalk.cyan('sentry:ci')} script to your ${chalk.cyan(\n 'package.json',\n )}. Make sure to run this script ${chalk.bold(\n 'after',\n )} building your application but ${chalk.bold('before')} deploying!`,\n );\n\n const addedToCI = await abortIfCancelled(\n clack.select({\n message: `Did you add a step to your CI pipeline that runs the ${chalk.cyan(\n 'sentry:ci',\n )} script ${chalk.bold('right after')} building your application?`,\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to run the command after each build for source maps to work properly.',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-ci-script', addedToCI);\n\n if (!addedToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n await addSentryCliRc(options.authToken);\n}\n\nasync function defaultConfigureSourcemapGenerationFlow(): Promise<void> {\n await abortIfCancelled(\n clack.select({\n message: `Verify that your build tool is generating source maps. ${chalk.dim(\n '(Your build output folder should contain .js.map files after a build)',\n )}`,\n options: [{ label: 'I checked. Continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check for a minimum SDK version and prompt the user to upgrade if necessary.
|
|
3
|
+
* We distinguish between 4 cases here:
|
|
4
|
+
*
|
|
5
|
+
* 1. Users didn't install any SDK yet
|
|
6
|
+
* -> We tell them to install an SDK and then continue with the wizard
|
|
7
|
+
* 2. Users installed an SDK in the range >=7.47.0
|
|
8
|
+
* -> All good, no need to do anything!
|
|
9
|
+
* 3. Users installed an SDK in the range >=7.0.0 <= 7.46.0
|
|
10
|
+
* -> We ask if they want to auto-update to the latest version
|
|
11
|
+
* 4. Users installed an SDK in the range <7.x
|
|
12
|
+
* -> We tell users to manually upgrade (migrate between majors)
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureMinimumSdkVersionIsInstalled(): Promise<void>;
|