@sentry/wizard 3.3.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/bin.ts +29 -19
- package/dist/bin.js +23 -18
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +0 -9
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +26 -10
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.d.ts → NextJsShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.js → NextJsShim.js} +13 -10
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +1 -0
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +4 -1
- package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.d.ts → SvelteKitShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.js → SvelteKitShim.js} +13 -10
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +1 -0
- package/dist/package.json +3 -3
- package/dist/src/nextjs/nextjs-wizard.d.ts +2 -5
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +2 -5
- package/dist/src/sourcemaps/sourcemaps-wizard.js +68 -31
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.d.ts +1 -0
- package/dist/src/sourcemaps/tools/create-react-app.js +69 -0
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -0
- package/dist/src/sourcemaps/tools/esbuild.d.ts +2 -0
- package/dist/src/sourcemaps/tools/esbuild.js +109 -0
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -0
- package/dist/src/sourcemaps/tools/rollup.d.ts +2 -0
- package/dist/src/sourcemaps/tools/rollup.js +109 -0
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -0
- package/dist/src/sourcemaps/tools/sentry-cli.d.ts +2 -2
- package/dist/src/sourcemaps/tools/sentry-cli.js +111 -91
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.d.ts +1 -0
- package/dist/src/sourcemaps/tools/tsc.js +93 -0
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -0
- package/dist/src/sourcemaps/utils/sdk-version.d.ts +14 -0
- package/dist/src/sourcemaps/utils/sdk-version.js +275 -0
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -0
- package/dist/src/sveltekit/sveltekit-wizard.d.ts +2 -5
- package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +13 -2
- package/dist/src/utils/clack-utils.js +78 -45
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +12 -0
- package/dist/src/utils/types.js +3 -0
- package/dist/src/utils/types.js.map +1 -0
- package/lib/Helper/Wizard.ts +0 -9
- package/lib/Setup.ts +1 -0
- package/lib/Steps/ChooseIntegration.ts +35 -11
- package/lib/Steps/Integrations/{NextJs.ts → NextJsShim.ts} +5 -2
- package/lib/Steps/Integrations/SourceMapsShim.ts +4 -1
- package/lib/Steps/Integrations/{SvelteKit.ts → SvelteKitShim.ts} +5 -2
- package/package.json +3 -3
- package/src/nextjs/nextjs-wizard.ts +3 -8
- package/src/sourcemaps/sourcemaps-wizard.ts +67 -38
- package/src/sourcemaps/tools/create-react-app.ts +19 -0
- package/src/sourcemaps/tools/esbuild.ts +65 -0
- package/src/sourcemaps/tools/rollup.ts +69 -0
- package/src/sourcemaps/tools/sentry-cli.ts +114 -105
- package/src/sourcemaps/tools/tsc.ts +39 -0
- package/src/sourcemaps/utils/sdk-version.ts +264 -0
- package/src/sveltekit/sveltekit-wizard.ts +3 -6
- package/src/utils/clack-utils.ts +71 -29
- package/src/utils/types.ts +13 -0
- package/dist/lib/Steps/Integrations/NextJs.js.map +0 -1
- package/dist/lib/Steps/Integrations/SvelteKit.js.map +0 -1
|
@@ -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;AAC5E,qCAA+D;AAC/D,yCAA6B;AAE7B,oDAY8B;AAC9B,yCASqB;AAMrB,sCAAsC;AACtC,SAAsB,eAAe,CACnC,OAA4B;;;;;;;oBAE5B,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,uBAAuB;wBACnC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,gDAAkC,GAAE,EAAA;;oBAA1C,SAA0C,CAAC;oBAEvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAC7C,qBAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAA;;oBAA9D,SAA8D,CAAC;oBAExB,qBAAM,IAAA,8BAAgB,GAAE,EAAA;;oBAAzD,KAAiC,SAAwB,EAAlD,SAAS,SAAA,EAAE,UAAU,gBAAA;oBAEJ,qBAAM,IAAA,+BAAiB,EAAC;4BACpD,SAAS,EAAE,OAAO,CAAC,SAAS;4BAC5B,GAAG,EAAE,SAAS;4BACd,QAAQ,EAAE,mBAAmB;yBAC9B,CAAC,EAAA;;oBAJI,KAAwB,SAI5B,EAJM,QAAQ,cAAA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,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAChC,EAAA;;oBATD,SASC,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,kBAAW,eAAK,CAAC,IAAI,CACnB,IAAI,CAAC,IAAI,OAAT,IAAI,kCAAS,aAAa,WAAE,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;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
|
+
{"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,oDAY8B;AAE9B,yCASqB;AAErB,sCAAsC;AACtC,SAAsB,eAAe,CAAC,OAAsB;;;;;;;oBAC1D,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,uBAAuB;wBACnC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,gDAAkC,GAAE,EAAA;;oBAA1C,SAA0C,CAAC;oBAEvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAC7C,qBAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAA;;oBAA9D,SAA8D,CAAC;oBAExB,qBAAM,IAAA,8BAAgB,EAAC,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G,EAAE,GAAK,aAAa,WAAE,KAAK,YAAG;wBAC9D,SAAS,EAAE,IAAI;qBAChB,CAAC,CAAC;oBAEH,qBAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,IAAI,CAAC,IAAI,OAAT,IAAI,+BACF,OAAO,CAAC,GAAG,EAAE,GACV,aAAa,WAChB,KAAK;4BACL,uBAAuB,YAEzB,IAAA,oCAAwB,GAAE,EAC1B,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAChC,EAAA;;oBATD,SASC,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,kBAAW,eAAK,CAAC,IAAI,CACnB,IAAI,CAAC,IAAI,OAAT,IAAI,kCAAS,aAAa,WAAE,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>;
|
|
@@ -72,6 +72,11 @@ var is_unicorn_supported_1 = require("../utils/vendor/is-unicorn-supported");
|
|
|
72
72
|
var vite_1 = require("./tools/vite");
|
|
73
73
|
var sentry_cli_1 = require("./tools/sentry-cli");
|
|
74
74
|
var webpack_1 = require("./tools/webpack");
|
|
75
|
+
var tsc_1 = require("./tools/tsc");
|
|
76
|
+
var rollup_1 = require("./tools/rollup");
|
|
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");
|
|
75
80
|
function runSourcemapsWizard(options) {
|
|
76
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
77
82
|
var _a, sentryUrl, selfHosted, _b, projects, apiKeys, selectedProject, selectedTool, addedEnvVarToCI, arrow;
|
|
@@ -86,20 +91,23 @@ function runSourcemapsWizard(options) {
|
|
|
86
91
|
return [4 /*yield*/, (0, clack_utils_1.confirmContinueEvenThoughNoGitRepo)()];
|
|
87
92
|
case 1:
|
|
88
93
|
_c.sent();
|
|
89
|
-
return [4 /*yield*/, (0,
|
|
94
|
+
return [4 /*yield*/, (0, sdk_version_1.ensureMinimumSdkVersionIsInstalled)()];
|
|
90
95
|
case 2:
|
|
96
|
+
_c.sent();
|
|
97
|
+
return [4 /*yield*/, (0, clack_utils_1.askForSelfHosted)(options.url)];
|
|
98
|
+
case 3:
|
|
91
99
|
_a = _c.sent(), sentryUrl = _a.url, selfHosted = _a.selfHosted;
|
|
92
100
|
return [4 /*yield*/, (0, clack_utils_1.askForWizardLogin)({
|
|
93
101
|
promoCode: options.promoCode,
|
|
94
102
|
url: sentryUrl,
|
|
95
103
|
})];
|
|
96
|
-
case
|
|
104
|
+
case 4:
|
|
97
105
|
_b = _c.sent(), projects = _b.projects, apiKeys = _b.apiKeys;
|
|
98
106
|
return [4 /*yield*/, (0, clack_utils_1.askForProjectSelection)(projects)];
|
|
99
|
-
case
|
|
107
|
+
case 5:
|
|
100
108
|
selectedProject = _c.sent();
|
|
101
109
|
return [4 /*yield*/, askForUsedBundlerTool()];
|
|
102
|
-
case
|
|
110
|
+
case 6:
|
|
103
111
|
selectedTool = _c.sent();
|
|
104
112
|
Sentry.setTag('selected-tool', selectedTool);
|
|
105
113
|
return [4 /*yield*/, startToolSetupFlow(selectedTool, {
|
|
@@ -109,9 +117,9 @@ function runSourcemapsWizard(options) {
|
|
|
109
117
|
url: sentryUrl,
|
|
110
118
|
authToken: apiKeys.token,
|
|
111
119
|
})];
|
|
112
|
-
case
|
|
120
|
+
case 7:
|
|
113
121
|
_c.sent();
|
|
114
|
-
prompts_1.default.log.step('Add the Sentry
|
|
122
|
+
prompts_1.default.log.step('Add the Sentry authentication token as an environment variable to your CI setup:');
|
|
115
123
|
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
116
124
|
// eslint-disable-next-line no-console
|
|
117
125
|
console.log(chalk_1.default.greenBright("\nSENTRY_AUTH_TOKEN=".concat(apiKeys.token, "\n")));
|
|
@@ -128,14 +136,14 @@ function runSourcemapsWizard(options) {
|
|
|
128
136
|
],
|
|
129
137
|
initialValue: true,
|
|
130
138
|
}))];
|
|
131
|
-
case
|
|
139
|
+
case 8:
|
|
132
140
|
addedEnvVarToCI = _c.sent();
|
|
133
141
|
Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);
|
|
134
142
|
if (!addedEnvVarToCI) {
|
|
135
143
|
prompts_1.default.log.info("Don't forget! :)");
|
|
136
144
|
}
|
|
137
145
|
arrow = (0, is_unicorn_supported_1.isUnicodeSupported)() ? '→' : '->';
|
|
138
|
-
prompts_1.default.outro("".concat(chalk_1.default.green("That's it - everything is set up!"), "\n\n ").concat(chalk_1.default.cyan("Validate your setup with the following Steps:\n\n 1. Build your application in ".concat(chalk_1.default.bold('production mode'), "
|
|
146
|
+
prompts_1.default.outro("".concat(chalk_1.default.green("That's it - everything is set up!"), "\n\n ").concat(chalk_1.default.cyan("Validate your setup with the following Steps:\n\n 1. Build your application in ".concat(chalk_1.default.bold('production mode'), ".\n ").concat(chalk_1.default.gray("".concat(arrow, " You should see source map upload logs in your console.")), "\n 2. Run your application and throw a test error.\n ").concat(chalk_1.default.gray("".concat(arrow, " The error should be visible in Sentry.")), "\n 3. Open the error in Sentry and verify that it's source-mapped.\n ").concat(chalk_1.default.gray("".concat(arrow, " The stack trace should show your original source code.")), "\n ")), "\n ").concat(chalk_1.default.dim("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"));
|
|
139
147
|
return [2 /*return*/];
|
|
140
148
|
}
|
|
141
149
|
});
|
|
@@ -153,24 +161,33 @@ function askForUsedBundlerTool() {
|
|
|
153
161
|
{
|
|
154
162
|
label: 'Webpack',
|
|
155
163
|
value: 'webpack',
|
|
156
|
-
hint: '
|
|
164
|
+
hint: 'Select this if you are using Webpack and you have access to your Webpack config.',
|
|
157
165
|
},
|
|
158
166
|
{
|
|
159
167
|
label: 'Vite',
|
|
160
168
|
value: 'vite',
|
|
161
|
-
hint: '
|
|
169
|
+
hint: 'Select this if you are using Vite and you have access to your Vite config.',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: 'esbuild',
|
|
173
|
+
value: 'esbuild',
|
|
174
|
+
hint: 'Select this if you are using esbuild and you have access to your esbuild config.',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: 'Rollup',
|
|
178
|
+
value: 'rollup',
|
|
179
|
+
hint: 'Select this if you are using Rollup and you have access to your Rollup config.',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
label: 'tsc',
|
|
183
|
+
value: 'tsc',
|
|
184
|
+
hint: 'Configure source maps when using tsc as build tool',
|
|
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.',
|
|
162
190
|
},
|
|
163
|
-
// TODO: Implement rollup and esbuild flows
|
|
164
|
-
// {
|
|
165
|
-
// label: 'esbuild',
|
|
166
|
-
// value: 'esbuild',
|
|
167
|
-
// hint: 'Configure source maps upload using esbuild',
|
|
168
|
-
// },
|
|
169
|
-
// {
|
|
170
|
-
// label: 'Rollup',
|
|
171
|
-
// value: 'rollup',
|
|
172
|
-
// hint: 'Configure source maps upload using Rollup',
|
|
173
|
-
// },
|
|
174
191
|
{
|
|
175
192
|
label: 'None of the above',
|
|
176
193
|
value: 'sentry-cli',
|
|
@@ -193,23 +210,43 @@ function startToolSetupFlow(selctedTool, options) {
|
|
|
193
210
|
case 0:
|
|
194
211
|
_a = selctedTool;
|
|
195
212
|
switch (_a) {
|
|
196
|
-
case '
|
|
197
|
-
case '
|
|
213
|
+
case 'webpack': return [3 /*break*/, 1];
|
|
214
|
+
case 'vite': return [3 /*break*/, 3];
|
|
215
|
+
case 'esbuild': return [3 /*break*/, 5];
|
|
216
|
+
case 'rollup': return [3 /*break*/, 7];
|
|
217
|
+
case 'tsc': return [3 /*break*/, 9];
|
|
218
|
+
case 'create-react-app': return [3 /*break*/, 11];
|
|
198
219
|
}
|
|
199
|
-
return [3 /*break*/,
|
|
200
|
-
case 1: return [4 /*yield*/, (0,
|
|
220
|
+
return [3 /*break*/, 13];
|
|
221
|
+
case 1: return [4 /*yield*/, (0, webpack_1.configureWebPackPlugin)(options)];
|
|
201
222
|
case 2:
|
|
202
223
|
_b.sent();
|
|
203
|
-
return [3 /*break*/,
|
|
204
|
-
case 3: return [4 /*yield*/, (0,
|
|
224
|
+
return [3 /*break*/, 15];
|
|
225
|
+
case 3: return [4 /*yield*/, (0, vite_1.configureVitePlugin)(options)];
|
|
205
226
|
case 4:
|
|
206
227
|
_b.sent();
|
|
207
|
-
return [3 /*break*/,
|
|
208
|
-
case 5: return [4 /*yield*/, (0,
|
|
228
|
+
return [3 /*break*/, 15];
|
|
229
|
+
case 5: return [4 /*yield*/, (0, esbuild_1.configureEsbuildPlugin)(options)];
|
|
209
230
|
case 6:
|
|
210
231
|
_b.sent();
|
|
211
|
-
return [3 /*break*/,
|
|
212
|
-
case 7: return [
|
|
232
|
+
return [3 /*break*/, 15];
|
|
233
|
+
case 7: return [4 /*yield*/, (0, rollup_1.configureRollupPlugin)(options)];
|
|
234
|
+
case 8:
|
|
235
|
+
_b.sent();
|
|
236
|
+
return [3 /*break*/, 15];
|
|
237
|
+
case 9: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, tsc_1.configureTscSourcemapGenerationFlow)];
|
|
238
|
+
case 10:
|
|
239
|
+
_b.sent();
|
|
240
|
+
return [3 /*break*/, 15];
|
|
241
|
+
case 11: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, create_react_app_1.configureCRASourcemapGenerationFlow)];
|
|
242
|
+
case 12:
|
|
243
|
+
_b.sent();
|
|
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*/];
|
|
213
250
|
}
|
|
214
251
|
});
|
|
215
252
|
});
|
|
@@ -1 +1 @@
|
|
|
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,6EAA0E;AAE1E,qCAAmD;AACnD,iDAAwD;AACxD,2CAAyD;AAUzD,SAAsB,mBAAmB,CACvC,OAAgC;;;;;;oBAEhC,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,gDAAgD;wBAC5D,OAAO,EACL,yQAAyQ;wBAC3Q,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,gDAAkC,GAAE,EAAA;;oBAA1C,SAA0C,CAAC;oBAEJ,qBAAM,IAAA,8BAAgB,GAAE,EAAA;;oBAAzD,KAAiC,SAAwB,EAAlD,SAAS,SAAA,EAAE,UAAU,gBAAA;oBAEJ,qBAAM,IAAA,+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,mBAAmB;gCAC1B,KAAK,EAAE,YAAY;gCACnB,IAAI,EAAE,iEAAiE;6BACxE;yBACF;qBACF,CAAC,CACH,EAAA;;oBAhCK,YAAY,GAAoC,SAgCrD;oBAED,sBAAO,YAAY,EAAC;;;;CACrB;AAED,SAAe,kBAAkB,CAC/B,WAAmC,EACnC,OAAgD;;;;;;oBAExC,KAAA,WAAW,CAAA;;6BACZ,MAAM,CAAC,CAAP,wBAAM;6BAGN,SAAS,CAAC,CAAV,wBAAS;;;wBAFZ,qBAAM,IAAA,0BAAmB,EAAC,OAAO,CAAC,EAAA;;oBAAlC,SAAkC,CAAC;oBACnC,wBAAM;wBAEN,qBAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,wBAAM;wBAGN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,CAAC,EAAA;;oBAAjC,SAAiC,CAAC;oBAClC,wBAAM;;;;;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';\n\ninterface SourceMapsWizardOptions {\n promoCode?: string;\n}\n\ntype SupportedBundlers = 'webpack' | 'vite' | 'rollup' | 'esbuild';\ntype SupportedTools = 'sentry-cli';\ntype SupportedBundlersTools = SupportedBundlers | SupportedTools;\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 auth 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 when building`,\n )}\n 2. Run your application and throw a test error\n ${chalk.gray(`${arrow} You should see the error in Sentry`)}\n 3. Open the error in Sentry and verify it's source-mapped\n ${chalk.gray(\n `${arrow} If your error is source-mapped, the stack trace should show your original source code`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, follow our Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide didn't help or you encountered a bug, let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedBundlersTools> {\n const selectedTool: SupportedBundlersTools | 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 // TODO: Implement rollup and esbuild flows\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: '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: SupportedBundlersTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n // TODO: implement other bundlers\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,6EAA0E;AAE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;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"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.configureEsbuildPlugin = void 0;
|
|
66
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
67
|
+
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
|
+
var chalk_1 = __importDefault(require("chalk"));
|
|
69
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var getCodeSnippet = function (options) {
|
|
71
|
+
return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");'), "\n\nrequire(\"esbuild\").build({\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n plugins: [\n // Put the Sentry esbuild plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryEsbuildPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"".concat(options.orgSlug, "\",\n project: \"").concat(options.projectSlug, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }),")), "\n ],\n});\n"));
|
|
72
|
+
};
|
|
73
|
+
var configureEsbuildPlugin = function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
var _d;
|
|
76
|
+
return __generator(this, function (_e) {
|
|
77
|
+
switch (_e.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
_a = clack_utils_1.installPackage;
|
|
80
|
+
_d = {
|
|
81
|
+
packageName: '@sentry/esbuild-plugin'
|
|
82
|
+
};
|
|
83
|
+
_b = clack_utils_1.hasPackageInstalled;
|
|
84
|
+
_c = ['@sentry/esbuild-plugin'];
|
|
85
|
+
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
87
|
+
_d)])];
|
|
88
|
+
case 2:
|
|
89
|
+
_e.sent();
|
|
90
|
+
prompts_1.default.log.step("Add the following code to your esbuild config:");
|
|
91
|
+
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
92
|
+
// eslint-disable-next-line no-console
|
|
93
|
+
console.log(getCodeSnippet(options));
|
|
94
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)((0, prompts_1.select)({
|
|
95
|
+
message: 'Did you copy the snippet above?',
|
|
96
|
+
options: [{ label: 'Yes, continue!', value: true }],
|
|
97
|
+
initialValue: true,
|
|
98
|
+
}))];
|
|
99
|
+
case 3:
|
|
100
|
+
_e.sent();
|
|
101
|
+
return [4 /*yield*/, (0, clack_utils_1.addDotEnvSentryBuildPluginFile)(options.authToken)];
|
|
102
|
+
case 4:
|
|
103
|
+
_e.sent();
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); };
|
|
108
|
+
exports.configureEsbuildPlugin = configureEsbuildPlugin;
|
|
109
|
+
//# sourceMappingURL=esbuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/esbuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAMiC;AAOjC,IAAM,cAAc,GAAG,UAAC,OAAgD;IACtE,OAAA,eAAK,CAAC,IAAI,CAAC,YACX,eAAK,CAAC,WAAW,CACjB,oEAAoE,CACrE,iDAGG,eAAK,CAAC,WAAW,CACjB,6DAA6D,CAC9D,+FAGG,eAAK,CAAC,WAAW,CAAC,+FAEV,OAAO,CAAC,OAAO,mCACX,OAAO,CAAC,WAAW,gBAC/B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAiB,OAAO,CAAC,GAAG,QAAI,CAAC,CAAC,CAAC,EAAE,cAExD,CAAC,kBAGR,CAAC;AApBA,CAoBA,CAAC;AAEI,IAAM,sBAAsB,GACjC,UAAO,OAAO;;;;;;gBACN,KAAA,4BAAc,CAAA;;oBAClB,WAAW,EAAE,wBAAwB;;gBACnB,KAAA,iCAAmB,CAAA;sBACnC,wBAAwB;gBACxB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;oBAJ7B,qBAAM,mBAEJ,mBAAgB,GAAE,4BAEhB,SAAyB,GAC1B;6BACD,EAAA;;gBANF,SAME,CAAC;gBAEH,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;gBAEjE,8FAA8F;gBAC9F,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;gBAErC,qBAAM,IAAA,8BAAgB,EACpB,IAAA,gBAAM,EAAC;wBACL,OAAO,EAAE,iCAAiC;wBAC1C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACnD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;gBAND,SAMC,CAAC;gBAEF,qBAAM,IAAA,4CAA8B,EAAC,OAAO,CAAC,SAAS,CAAC,EAAA;;gBAAvD,SAAuD,CAAC;;;;KACzD,CAAC;AAzBS,QAAA,sBAAsB,0BAyB/B","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack, { select } from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n getPackageDotJson,\n hasPackageInstalled,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'const { sentryEsbuildPlugin } = require(\"@sentry/esbuild-plugin\");',\n)}\n\nrequire(\"esbuild\").build({\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n plugins: [\n // Put the Sentry esbuild plugin after all other plugins\n ${chalk.greenBright(`sentryEsbuildPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n});\n`);\n\nexport const configureEsbuildPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/esbuild-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/esbuild-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(`Add the following code to your esbuild config:`);\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(getCodeSnippet(options));\n\n await abortIfCancelled(\n select({\n message: 'Did you copy the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n"]}
|