@sentry/wizard 3.4.0 → 3.6.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 +20 -0
- package/bin.ts +29 -20
- package/dist/bin.js +27 -19
- package/dist/bin.js.map +1 -1
- package/dist/lib/Constants.d.ts +2 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +2 -9
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +1 -0
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +30 -10
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Apple.d.ts +10 -0
- package/dist/lib/Steps/Integrations/Apple.js +92 -0
- package/dist/lib/Steps/Integrations/Apple.js.map +1 -0
- package/dist/lib/Steps/Integrations/{NextJs.d.ts → NextJsShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.js → NextJsShim.js} +14 -10
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +1 -0
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +5 -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} +14 -10
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +1 -0
- package/dist/package.json +4 -4
- package/dist/src/apple/apple-wizard.d.ts +2 -0
- package/dist/src/apple/apple-wizard.js +197 -0
- package/dist/src/apple/apple-wizard.js.map +1 -0
- package/dist/src/apple/code-tools.d.ts +1 -0
- package/dist/src/apple/code-tools.js +100 -0
- package/dist/src/apple/code-tools.js.map +1 -0
- package/dist/src/apple/templates.d.ts +4 -0
- package/dist/src/apple/templates.js +19 -0
- package/dist/src/apple/templates.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +4 -0
- package/dist/src/apple/xcode-manager.js +145 -0
- package/dist/src/apple/xcode-manager.js.map +1 -0
- 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 +154 -67
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
- package/dist/src/sourcemaps/tools/angular.js +76 -0
- package/dist/src/sourcemaps/tools/angular.js.map +1 -0
- 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.js +2 -1
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +2 -1
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +7 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +2 -1
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +2 -1
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.d.ts +3 -0
- package/dist/src/sourcemaps/utils/detect-tool.js +73 -0
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -0
- package/dist/src/sourcemaps/utils/other-wizards.d.ts +4 -0
- package/dist/src/sourcemaps/utils/other-wizards.js +183 -0
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -0
- package/dist/src/sourcemaps/utils/sdk-version.d.ts +14 -0
- package/dist/src/sourcemaps/utils/sdk-version.js +276 -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 +3 -2
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/telemetry.d.ts +1 -0
- package/dist/src/telemetry.js +7 -1
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/bash.d.ts +3 -0
- package/dist/src/utils/bash.js +118 -0
- package/dist/src/utils/bash.js.map +1 -0
- package/dist/src/utils/clack-utils.d.ts +21 -9
- package/dist/src/utils/clack-utils.js +122 -56
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/package-json.d.ts +19 -0
- package/dist/src/utils/package-json.js +29 -0
- package/dist/src/utils/package-json.js.map +1 -0
- package/dist/src/utils/types.d.ts +16 -0
- package/dist/src/utils/types.js +3 -0
- package/dist/src/utils/types.js.map +1 -0
- package/lib/Constants.ts +6 -0
- package/lib/Helper/Wizard.ts +3 -9
- package/lib/Helper/__tests__/SentryCli.ts +2 -1
- package/lib/Setup.ts +1 -0
- package/lib/Steps/ChooseIntegration.ts +39 -11
- package/lib/Steps/Integrations/Apple.ts +27 -0
- package/lib/Steps/Integrations/{NextJs.ts → NextJsShim.ts} +6 -2
- package/lib/Steps/Integrations/SourceMapsShim.ts +5 -1
- package/lib/Steps/Integrations/{SvelteKit.ts → SvelteKitShim.ts} +6 -2
- package/package-lock.json +8910 -0
- package/package.json +4 -4
- package/src/apple/apple-wizard.ts +150 -0
- package/src/apple/code-tools.ts +81 -0
- package/src/apple/templates.ts +39 -0
- package/src/apple/xcode-manager.ts +147 -0
- package/src/nextjs/nextjs-wizard.ts +3 -8
- package/src/sourcemaps/sourcemaps-wizard.ts +166 -91
- package/src/sourcemaps/tools/angular.ts +42 -0
- package/src/sourcemaps/tools/create-react-app.ts +19 -0
- package/src/sourcemaps/tools/esbuild.ts +1 -1
- package/src/sourcemaps/tools/rollup.ts +2 -4
- package/src/sourcemaps/tools/sentry-cli.ts +6 -1
- package/src/sourcemaps/tools/vite.ts +1 -1
- package/src/sourcemaps/tools/webpack.ts +1 -1
- package/src/sourcemaps/utils/detect-tool.ts +41 -0
- package/src/sourcemaps/utils/other-wizards.ts +148 -0
- package/src/sourcemaps/utils/sdk-version.ts +257 -0
- package/src/sveltekit/sveltekit-wizard.ts +4 -7
- package/src/telemetry.ts +8 -0
- package/src/utils/bash.ts +44 -0
- package/src/utils/clack-utils.ts +100 -51
- package/src/utils/package-json.ts +45 -0
- package/src/utils/types.ts +18 -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":"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;AACzD,mCAAkE;AAClE,yCAAuD;AACvD,2CAAyD;AAczD,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,q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BAClD;4BACD;gCACE,KAAK,EAAE,KAAK;gCACZ,KAAK,EAAE,KAAK;gCACZ,IAAI,EAAE,oDAAoD;6BAC3D;4BACD;gCACE,KAAK,EAAE,mBAAmB;gCAC1B,KAAK,EAAE,YAAY;gCACnB,IAAI,EAAE,iEAAiE;6BACxE;yBACF;qBACF,CAAC,CACH,EAAA;;oBApCK,YAAY,GAA4B,SAoC7C;oBAED,sBAAO,YAAY,EAAC;;;;CACrB;AAED,SAAe,kBAAkB,CAC/B,WAA2B,EAC3B,OAAgD;;;;;;oBAExC,KAAA,WAAW,CAAA;;6BACZ,SAAS,CAAC,CAAV,wBAAS;6BAGT,MAAM,CAAC,CAAP,wBAAM;6BAGN,SAAS,CAAC,CAAV,wBAAS;6BAGT,QAAQ,CAAC,CAAT,wBAAQ;6BAGR,KAAK,CAAC,CAAN,wBAAK;;;wBAXR,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,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,oDAQ8B;AAC9B,6EAA0E;AAE1E,qCAAmD;AACnD,iDAAwD;AACxD,2CAAyD;AACzD,mCAAkE;AAClE,yCAAuD;AACvD,2CAAyD;AAEzD,6DAA+E;AAC/E,mDAAyE;AACzE,0CAAwD;AACxD,2BAA0B;AAC1B,uDAAyF;AACzF,2CAA0E;AAC1E,mDAAqE;AAErE,SAAsB,mBAAmB,CACvC,OAAsB;;;YAEtB,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,YAAY;iBAC1B,EACD,cAAM,OAAA,gCAAgC,CAAC,OAAO,CAAC,EAAzC,CAAyC,CAChD,EAAC;;;CACH;AAVD,kDAUC;AAED,SAAe,gCAAgC,CAC7C,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,gDAAgD;wBAC5D,OAAO,EACL,yQAA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ore - 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 detectPackageManager,\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';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { URL } from 'url';\nimport { checkIfMoreSuitableWizardExistsAndAskForRedirect } from './utils/other-wizards';\nimport { configureAngularSourcemapGenerationFlow } from './tools/angular';\nimport { detectUsedTool, SupportedTools } from './utils/detect-tool';\n\nexport async function runSourcemapsWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'sourcemaps',\n },\n () => runSourcemapsWizardWithTelemetry(options),\n );\n}\n\nasync function runSourcemapsWizardWithTelemetry(\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 const moreSuitableWizard = await traceStep(\n 'check-framework-wizard',\n checkIfMoreSuitableWizardExistsAndAskForRedirect,\n );\n if (moreSuitableWizard) {\n await traceStep('run-framework-wizard', () => moreSuitableWizard(options));\n return;\n }\n\n await traceStep('detect-git', confirmContinueEvenThoughNoGitRepo);\n\n await traceStep('check-sdk-version', ensureMinimumSdkVersionIsInstalled);\n\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n }),\n );\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects),\n );\n\n const selectedTool = await traceStep('select-tool', askForUsedBundlerTool);\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await traceStep('tool-setup', () =>\n startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n }),\n );\n\n await traceStep('ci-setup', () => setupCi(apiKeys.token));\n\n traceStep('outro', () =>\n printOutro(\n sentryUrl,\n selectedProject.organization.slug,\n selectedProject.id,\n ),\n );\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedTools> {\n const selectedTool: SupportedTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which framework, bundler or build tool are you using?',\n options: [\n {\n label: 'Angular',\n value: 'angular',\n hint: 'Select this option if you are using Angular.',\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: '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: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n initialValue: await detectUsedTool(),\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 case 'angular':\n await configureSentryCLI(\n options,\n configureAngularSourcemapGenerationFlow,\n );\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n\nasync function setupCi(authToken: string) {\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=${authToken}\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\nfunction printOutro(url: string, orgSlug: string, projectId: string) {\n const pacMan = detectPackageManager() || 'npm';\n const buildCommand = `'${pacMan}${pacMan === 'npm' ? ' run' : ''} build'`;\n\n const urlObject = new URL(url);\n urlObject.host = `${orgSlug}.${urlObject.host}`;\n urlObject.pathname = '/issues/';\n urlObject.searchParams.set('project', projectId);\n\n const issueStreamUrl = urlObject.toString();\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Test and validate your setup locally with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}.\n ${chalk.gray(`${arrow} For example, run ${chalk.bold(buildCommand)}.`)}\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 appear in Sentry:`)}\n ${chalk.gray(`${arrow} ${issueStreamUrl}`)}\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function configureAngularSourcemapGenerationFlow(): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
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.configureAngularSourcemapGenerationFlow = 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 chalk_1 = __importDefault(require("chalk"));
|
|
46
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
47
|
+
var angularJsonTemplate = chalk_1.default.gray("{\n \"projects\": {\n \"your-project\": {\n \"architect\": {\n \"build\": {\n \"options\": {\n ".concat(chalk_1.default.greenBright("\"sourceMap\": true"), "\n },\n },\n }\n }\n }\n}"));
|
|
48
|
+
function configureAngularSourcemapGenerationFlow() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
prompts_1.default.log.info("Enable generating source maps in your ".concat(chalk_1.default.bold('angular.json'), " file:"));
|
|
54
|
+
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.log(angularJsonTemplate);
|
|
57
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
58
|
+
message: "Verify that you are generating source maps when building your Angular app.",
|
|
59
|
+
options: [
|
|
60
|
+
{
|
|
61
|
+
label: 'I checked!',
|
|
62
|
+
hint: 'My build output folder contains .js.map files after a build.',
|
|
63
|
+
value: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
initialValue: true,
|
|
67
|
+
}))];
|
|
68
|
+
case 1:
|
|
69
|
+
_a.sent();
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.configureAngularSourcemapGenerationFlow = configureAngularSourcemapGenerationFlow;
|
|
76
|
+
//# sourceMappingURL=angular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/angular.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,uDAA2D;AAE3D,IAAM,mBAAmB,GAAG,eAAK,CAAC,IAAI,CAAC,6IAMzB,eAAK,CAAC,WAAW,CAAC,qBAAmB,CAAC,uDAMlD,CAAC,CAAC;AAEJ,SAAsB,uCAAuC;;;;;oBAC3D,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,gDAAyC,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC,WAAQ,CAC5E,CAAC;oBAEF,8FAA8F;oBAC9F,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;oBAEjC,qBAAM,IAAA,8BAAgB,EACpB,iBAAK,CAAC,MAAM,CAAC;4BACX,OAAO,EAAE,4EAA4E;4BACrF,OAAO,EAAE;gCACP;oCACE,KAAK,EAAE,YAAY;oCACnB,IAAI,EAAE,8DAA8D;oCACpE,KAAK,EAAE,IAAI;iCACZ;6BACF;4BACD,YAAY,EAAE,IAAI;yBACnB,CAAC,CACH,EAAA;;oBAZD,SAYC,CAAC;;;;;CACH;AAtBD,0FAsBC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { abortIfCancelled } from '../../utils/clack-utils';\n\nconst angularJsonTemplate = chalk.gray(`{\n \"projects\": {\n \"your-project\": {\n \"architect\": {\n \"build\": {\n \"options\": {\n ${chalk.greenBright(`\"sourceMap\": true`)}\n },\n },\n }\n }\n }\n}`);\n\nexport async function configureAngularSourcemapGenerationFlow(): Promise<void> {\n clack.log.info(\n `Enable generating source maps in your ${chalk.bold('angular.json')} file:`,\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(angularJsonTemplate);\n\n await abortIfCancelled(\n clack.select({\n message: `Verify that you are generating source maps when building your Angular app.`,\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 @@
|
|
|
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"]}
|
|
@@ -67,6 +67,7 @@ exports.configureEsbuildPlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
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
|
};
|
|
@@ -80,7 +81,7 @@ var configureEsbuildPlugin = function (options) { return __awaiter(void 0, void
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/esbuild-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/esbuild-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/esbuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAKiC;AACjC,yDAA+D;AAO/D,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,kCAAmB,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 installPackage,\n} from '../../utils/clack-utils';\nimport { hasPackageInstalled } from '../../utils/package-json';\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"]}
|
|
@@ -67,6 +67,7 @@ exports.configureRollupPlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('import { sentryRollupPlugin } from "@sentry/rollup-plugin";'), "\n\nexport default {\n output: {\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n },\n plugins: [\n // Put the Sentry rollup plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryRollupPlugin({\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
|
};
|
|
@@ -80,7 +81,7 @@ var configureRollupPlugin = function (options) { return __awaiter(void 0, void 0
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/rollup-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/rollup-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAKiC;AACjC,yDAA+D;AAO/D,IAAM,cAAc,GAAG,UAAC,OAAgD;IACtE,OAAA,eAAK,CAAC,IAAI,CAAC,YACX,eAAK,CAAC,WAAW,CACjB,6DAA6D,CAC9D,oDAIK,eAAK,CAAC,WAAW,CACjB,6DAA6D,CAC9D,oGAIC,eAAK,CAAC,WAAW,CAAC,8FAEV,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,iBAGR,CAAC;AAtBA,CAsBA,CAAC;AAEI,IAAM,qBAAqB,GAChC,UAAO,OAAO;;;;;;gBACN,KAAA,4BAAc,CAAA;;oBAClB,WAAW,EAAE,uBAAuB;;gBAClB,KAAA,kCAAmB,CAAA;sBACnC,uBAAuB;gBACvB,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,+CAA+C,CAAC,CAAC;gBAEhE,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,qBAAqB,yBAyB9B","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 installPackage,\n} from '../../utils/clack-utils';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'import { sentryRollupPlugin } from \"@sentry/rollup-plugin\";',\n)}\n\nexport default {\n output: {\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n },\n plugins: [\n // Put the Sentry rollup plugin after all other plugins\n ${chalk.greenBright(`sentryRollupPlugin({\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 configureRollupPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/rollup-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/rollup-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(`Add the following code to your rollup 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"]}
|
|
@@ -70,6 +70,7 @@ var Sentry = __importStar(require("@sentry/node"));
|
|
|
70
70
|
var path = __importStar(require("path"));
|
|
71
71
|
var fs = __importStar(require("fs"));
|
|
72
72
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
73
|
+
var package_json_1 = require("../../utils/package-json");
|
|
73
74
|
function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
74
75
|
if (configureSourcemapGenerationFlow === void 0) { configureSourcemapGenerationFlow = defaultConfigureSourcemapGenerationFlow; }
|
|
75
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -81,7 +82,7 @@ function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
|
81
82
|
packageDotJson = _b.sent();
|
|
82
83
|
return [4 /*yield*/, (0, clack_utils_1.installPackage)({
|
|
83
84
|
packageName: '@sentry/cli',
|
|
84
|
-
alreadyInstalled: (0,
|
|
85
|
+
alreadyInstalled: (0, package_json_1.hasPackageInstalled)('@sentry/cli', packageDotJson),
|
|
85
86
|
})];
|
|
86
87
|
case 2:
|
|
87
88
|
_b.sent();
|
|
@@ -90,6 +91,11 @@ function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
|
90
91
|
case 3: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.text({
|
|
91
92
|
message: 'Where are your build artifacts located?',
|
|
92
93
|
placeholder: ".".concat(path.sep, "out"),
|
|
94
|
+
validate: function (value) {
|
|
95
|
+
if (!value) {
|
|
96
|
+
return 'Please enter a path.';
|
|
97
|
+
}
|
|
98
|
+
},
|
|
93
99
|
}))];
|
|
94
100
|
case 4:
|
|
95
101
|
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,
|
|
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,uDAKiC;AAGjC,yDAA+D;AAE/D,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,kCAAmB,EAAC,aAAa,EAAE,cAAc,CAAC;yBACrE,CAAC,EAAA;;oBAHF,SAGE,CAAC;oBAEC,SAAS,GAAG,KAAK,CAAC;;wBAGI,qBAAM,IAAA,8BAAgB,EAC5C,iBAAK,CAAC,IAAI,CAAC;wBACT,OAAO,EAAE,yCAAyC;wBAClD,WAAW,EAAE,WAAI,IAAI,CAAC,GAAG,QAAK;wBAC9B,QAAQ,YAAC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AAE;wBACd,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;qBACpC;oBAED,qBAAM,IAAA,4BAAc,EAAC,OAAO,CAAC,SAAS,CAAC,EAAA;;oBAAvC,SAAuC,CAAC;;;;;CACzC;AA5GD,gDA4GC;AAED,SAAe,uCAAuC;;;;wBACpD,qBAAM,IAAA,8BAAgB,EACpB,iBAAK,CAAC,MAAM,CAAC;wBACX,OAAO,EAAE,iEAA0D,eAAK,CAAC,GAAG,CAC1E,uEAAuE,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 installPackage,\n} from '../../utils/clack-utils';\n\nimport { SourceMapUploadToolConfigurationOptions } from './types';\nimport { hasPackageInstalled } from '../../utils/package-json';\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"]}
|
|
@@ -67,6 +67,7 @@ exports.configureVitePlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
return chalk_1.default.gray("\nimport { defineConfig } from \"vite\";\n".concat(chalk_1.default.greenBright('import { sentryVitePlugin } from "@sentry/vite-plugin"'), ";\n\nexport default defineConfig({\n build: {\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n },\n plugins: [\n // Put the Sentry vite plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryVitePlugin({\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
|
};
|
|
@@ -80,7 +81,7 @@ var configureVitePlugin = function (options) { return __awaiter(void 0, void 0,
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/vite-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/vite-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools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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;AA3BS,QAAA,mBAAmB,uBA2B5B","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 installPackage,\n} from '../../utils/clack-utils';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\nimport { defineConfig } from \"vite\";\n${chalk.greenBright('import { sentryVitePlugin } from \"@sentry/vite-plugin\"')};\n\nexport default defineConfig({\n build: {\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n },\n plugins: [\n // Put the Sentry vite plugin after all other plugins\n ${chalk.greenBright(`sentryVitePlugin({\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 configureVitePlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/vite-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/vite-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(\n `Add the following code to your ${chalk.bold('vite.config.js')} file:`,\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(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"]}
|
|
@@ -67,6 +67,7 @@ exports.configureWebPackPlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");'), "\n\nmodule.exports = {\n // ... other config options\n ").concat(chalk_1.default.greenBright('devtool: "source-map", // Source map generation must be turned on'), "\n plugins: [\n ").concat(chalk_1.default.greenBright("sentryWebpackPlugin({\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
|
};
|
|
@@ -80,7 +81,7 @@ var configureWebPackPlugin = function (options) { return __awaiter(void 0, void
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/webpack-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/webpack-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/webpack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"webpack.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/webpack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAKiC;AACjC,yDAA+D;AAO/D,IAAM,cAAc,GAAG,UAAC,OAAgD;IACtE,OAAA,eAAK,CAAC,IAAI,CAAC,YACX,eAAK,CAAC,WAAW,CACjB,oEAAoE,CACrE,sEAIG,eAAK,CAAC,WAAW,CACjB,mEAAmE,CACpE,iCAEG,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,eAEzD,CAAC,kBAGP,CAAC;AApBA,CAoBA,CAAC;AAEI,IAAM,sBAAsB,GACjC,UAAO,OAAO;;;;;;gBACN,KAAA,4BAAc,CAAA;;oBAClB,WAAW,EAAE,wBAAwB;;gBACnB,KAAA,kCAAmB,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,CACZ,yCAAkC,eAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAQ,CAC1E,CAAC;gBAEF,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;AA3BS,QAAA,sBAAsB,0BA2B/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 installPackage,\n} from '../../utils/clack-utils';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'const { sentryWebpackPlugin } = require(\"@sentry/webpack-plugin\");',\n)}\n\nmodule.exports = {\n // ... other config options\n ${chalk.greenBright(\n 'devtool: \"source-map\", // Source map generation must be turned on',\n )}\n plugins: [\n ${chalk.greenBright(`sentryWebpackPlugin({\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 configureWebPackPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/webpack-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/webpack-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(\n `Add the following code to your ${chalk.bold('webpack.config.js')} file:`,\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(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"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.detectUsedTool = exports.TOOL_PACKAGE_MAP = void 0;
|
|
40
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
41
|
+
var package_json_1 = require("../../utils/package-json");
|
|
42
|
+
// A map of package names pointing to the tool slug.
|
|
43
|
+
// The order is important, because we want to detect the most specific tool first.
|
|
44
|
+
// For instance, webpack needs to come before tsc because typescript c
|
|
45
|
+
// Similarly
|
|
46
|
+
exports.TOOL_PACKAGE_MAP = {
|
|
47
|
+
'@angular/core': 'angular',
|
|
48
|
+
'create-react-app': 'create-react-app',
|
|
49
|
+
webpack: 'webpack',
|
|
50
|
+
vite: 'vite',
|
|
51
|
+
esbuild: 'esbuild',
|
|
52
|
+
rollup: 'rollup',
|
|
53
|
+
typescript: 'tsc',
|
|
54
|
+
};
|
|
55
|
+
function detectUsedTool() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var packageJson, foundToolPackage;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0: return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
61
|
+
case 1:
|
|
62
|
+
packageJson = _a.sent();
|
|
63
|
+
foundToolPackage = (0, package_json_1.findInstalledPackageFromList)(Object.keys(exports.TOOL_PACKAGE_MAP), packageJson);
|
|
64
|
+
if (foundToolPackage) {
|
|
65
|
+
return [2 /*return*/, exports.TOOL_PACKAGE_MAP[foundToolPackage.name]];
|
|
66
|
+
}
|
|
67
|
+
return [2 /*return*/, 'sentry-cli'];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
exports.detectUsedTool = detectUsedTool;
|
|
73
|
+
//# sourceMappingURL=detect-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-tool.js","sourceRoot":"","sources":["../../../../src/sourcemaps/utils/detect-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA4D;AAC5D,yDAAwE;AAYxE,oDAAoD;AACpD,kFAAkF;AAClF,sEAAsE;AACtE,YAAY;AACC,QAAA,gBAAgB,GAAmC;IAC9D,eAAe,EAAE,SAAS;IAC1B,kBAAkB,EAAE,kBAAkB;IACtC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,SAAsB,cAAc;;;;;wBACd,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAEvC,gBAAgB,GAAG,IAAA,2CAA4B,EACnD,MAAM,CAAC,IAAI,CAAC,wBAAgB,CAAC,EAC7B,WAAW,CACZ,CAAC;oBAEF,IAAI,gBAAgB,EAAE;wBACpB,sBAAO,wBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAC;qBAChD;oBAED,sBAAO,YAAY,EAAC;;;;CACrB;AAbD,wCAaC","sourcesContent":["import { getPackageDotJson } from '../../utils/clack-utils';\nimport { findInstalledPackageFromList } from '../../utils/package-json';\n\nexport type SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli'\n | 'create-react-app'\n | 'angular';\n\n// A map of package names pointing to the tool slug.\n// The order is important, because we want to detect the most specific tool first.\n// For instance, webpack needs to come before tsc because typescript c\n// Similarly\nexport const TOOL_PACKAGE_MAP: Record<string, SupportedTools> = {\n '@angular/core': 'angular',\n 'create-react-app': 'create-react-app',\n webpack: 'webpack',\n vite: 'vite',\n esbuild: 'esbuild',\n rollup: 'rollup',\n typescript: 'tsc',\n};\n\nexport async function detectUsedTool(): Promise<SupportedTools> {\n const packageJson = await getPackageDotJson();\n\n const foundToolPackage = findInstalledPackageFromList(\n Object.keys(TOOL_PACKAGE_MAP),\n packageJson,\n );\n\n if (foundToolPackage) {\n return TOOL_PACKAGE_MAP[foundToolPackage.name];\n }\n\n return 'sentry-cli';\n}\n"]}
|