@sentry/wizard 3.25.2 → 3.27.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/dist/lib/Steps/OpenSentry.js +1 -1
- package/dist/lib/Steps/OpenSentry.js.map +1 -1
- package/dist/package.json +2 -1
- package/dist/src/nextjs/nextjs-wizard.d.ts +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +194 -99
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +7 -3
- package/dist/src/nextjs/templates.js +27 -14
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/run.js +1 -1
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/telemetry.js +10 -3
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +4 -1
- package/dist/src/utils/clack-utils.js +81 -11
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/package-manager.d.ts +5 -2
- package/dist/src/utils/package-manager.js +44 -56
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/src/utils/types.d.ts +6 -0
- package/dist/src/utils/types.js.map +1 -1
- package/dist/src/utils/url.js +7 -2
- package/dist/src/utils/url.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +79 -1
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +2 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/lib/Steps/OpenSentry.ts +1 -1
- package/package.json +2 -1
- package/src/nextjs/nextjs-wizard.ts +209 -101
- package/src/nextjs/templates.ts +54 -26
- package/src/run.ts +1 -1
- package/src/sourcemaps/sourcemaps-wizard.ts +1 -1
- package/src/telemetry.ts +7 -1
- package/src/utils/clack-utils.ts +77 -7
- package/src/utils/package-manager.ts +43 -13
- package/src/utils/types.ts +7 -0
- package/src/utils/url.ts +6 -2
- package/test/nextjs/templates.test.ts +296 -2
- package/test/sourcemaps/tools/sentry-cli.test.ts +2 -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,oDAQ8B;AAC9B,6EAA0E;AAE1E,qCAAmD;AACnD,iDAA4E;AAC5E,2CAAyD;AACzD,mCAAkE;AAClE,yCAAuD;AACvD,2CAAyD;AAEzD,6DAA+E;AAC/E,mDAAyE;AACzE,0CAAwD;AACxD,uDAAyF;AACzF,2CAA0E;AAC1E,mDAAqE;AACrE,yCAAiE;AACjE,uCAA+D;AAC/D,4DAA+D;AAC/D,oCAAiD;AAEjD,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,EAAE,sHAEP,OAAO,CAAC,gBAAgB;4BACtB,CAAC,CAAC,6JAGwE;4BAC1E,CAAC,CAAC,EAAE,CACN;wBACF,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEwB,qBAAM,IAAA,qBAAS,EACxC,wBAAwB,EACxB,gEAAgD,CACjD,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D,CACrD,OACH,CAAC,CAAC;AACH,CAAC","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 abort,\n abortIfCancelled,\n confirmContinueIfNoOrDirtyGitRepo,\n SENTRY_DOT_ENV_FILE,\n printWelcome,\n SENTRY_CLI_RC_FILE,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { setupNpmScriptInCI, 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 { checkIfMoreSuitableWizardExistsAndAskForRedirect } from './utils/other-wizards';\nimport { configureAngularSourcemapGenerationFlow } from './tools/angular';\nimport { detectUsedTool, SupportedTools } from './utils/detect-tool';\nimport { configureNextJsSourceMapsUpload } from './tools/nextjs';\nimport { configureRemixSourceMapsUpload } from './tools/remix';\nimport { detectPackageManger } from '../utils/package-manager';\nimport { getIssueStreamUrl } from '../utils/url';\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: `This wizard will help you upload source maps to Sentry as part of your build.\nThank you for using Sentry :)${\n options.telemetryEnabled\n ? `\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 : ''\n }`,\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 confirmContinueIfNoOrDirtyGitRepo();\n\n await traceStep('check-sdk-version', ensureMinimumSdkVersionIsInstalled);\n\n const { selfHosted, selectedProject, sentryUrl, authToken } =\n await getOrAskForProjectData(options);\n\n const wizardOptionsWithPreSelectedProject = {\n ...options,\n preSelectedProject: {\n project: selectedProject,\n authToken,\n selfHosted,\n },\n };\n\n const selectedTool = await traceStep('select-tool', askForUsedBundlerTool);\n\n Sentry.setTag('selected-tool', selectedTool);\n\n if (selectedTool === 'no-tool') {\n clack.log.info(\n \"No Problem! But in this case, there's nothing to configure :)\",\n );\n await abort('Exiting, have a great day!', 0);\n return;\n }\n\n await traceStep('tool-setup', () =>\n startToolSetupFlow(\n selectedTool,\n {\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n authToken,\n },\n wizardOptionsWithPreSelectedProject,\n ),\n );\n\n await traceStep('ci-setup', () => configureCI(selectedTool, authToken));\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 = 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: 'Next.js',\n value: 'nextjs',\n hint: 'Select this option if you want to set up source maps in a NextJS project.',\n },\n {\n label: 'Remix',\n value: 'remix',\n hint: 'Select this option if you want to set up source maps in a Remix project.',\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: 'I use another tool',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n {\n label: \"I don't minify, transpile or bundle my code\",\n value: 'no-tool',\n hint: 'This will exit the wizard',\n },\n ],\n initialValue: await detectUsedTool(),\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n wizardOptions: WizardOptions,\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 case 'nextjs':\n await configureNextJsSourceMapsUpload(options, wizardOptions);\n break;\n case 'remix':\n await configureRemixSourceMapsUpload(options, wizardOptions);\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n\nexport async function configureCI(\n selectedTool: SupportedTools,\n authToken: string,\n): Promise<void> {\n const isUsingCI = await abortIfCancelled(\n clack.select({\n message: `Are you using a CI/CD tool to build and deploy your application?`,\n options: [\n {\n label: 'Yes',\n hint: 'I use a tool like GitHub Actions, GitLab, CircleCI, TravisCI, Jenkins, Vercel, ...',\n value: true,\n },\n {\n label: 'No',\n hint: 'I build and deploy my application manually',\n value: false,\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('using-ci', isUsingCI);\n\n const isCliBasedFlowTool = [\n 'sentry-cli',\n 'tsc',\n 'angular',\n 'create-react-app',\n ].includes(selectedTool);\n\n // some non-cli-based flows also use the .sentryclirc file\n const usesSentryCliRc = selectedTool === 'nextjs';\n\n const authTokenFile =\n isCliBasedFlowTool || usesSentryCliRc\n ? SENTRY_CLI_RC_FILE\n : SENTRY_DOT_ENV_FILE;\n\n if (!isUsingCI) {\n clack.log.info(\n `No Problem! Just make sure that the Sentry auth token from ${chalk.cyan(\n authTokenFile,\n )} is available whenever you build and deploy your app.`,\n );\n return;\n }\n\n if (isCliBasedFlowTool) {\n await traceStep('ci-npm-script-setup', setupNpmScriptInCI);\n }\n\n await traceStep('ci-auth-token-setup', () => setupAuthTokenInCI(authToken));\n}\n\nasync function setupAuthTokenInCI(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 packageManager = detectPackageManger();\n const buildCommand = packageManager?.buildCommand ?? 'npm run build';\n\n const issueStreamUrl = getIssueStreamUrl({ url, orgSlug, projectId });\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"]}
|
|
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,iDAA4E;AAC5E,2CAAyD;AACzD,mCAAkE;AAClE,yCAAuD;AACvD,2CAAyD;AAEzD,6DAA+E;AAC/E,mDAAyE;AACzE,0CAAwD;AACxD,uDAAyF;AACzF,2CAA0E;AAC1E,mDAAqE;AACrE,yCAAiE;AACjE,uCAA+D;AAC/D,4DA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GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEhD,iBAAK,CAAC,KAAK,CAAC,UAAG,eAAK,CAAC,KAAK,CAAC,mCAAmC,CAAC,oBAE5D,eAAK,CAAC,IAAI,CAAC,4GAEkB,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,sBACvD,eAAK,CAAC,IAAI,CAAC,UAAG,KAAK,+BAAqB,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAG,CAAC,qBACpE,eAAK,CAAC,IAAI,CACV,UAAG,KAAK,4DAAyD,CAClE,yEAEC,eAAK,CAAC,IAAI,CAAC,UAAG,KAAK,wCAAqC,CAAC,qBACzD,eAAK,CAAC,IAAI,CAAC,UAAG,KAAK,cAAI,cAAc,CAAE,CAAC,yFAExC,eAAK,CAAC,IAAI,CACV,UAAG,KAAK,4DAAyD,CAClE,UACH,CAAC,kBACA,eAAK,CAAC,GAAG,CACT,6RAIoD,CACrD,OACH,CAAC,CAAC;AACH,CAAC","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 abort,\n abortIfCancelled,\n confirmContinueIfNoOrDirtyGitRepo,\n SENTRY_DOT_ENV_FILE,\n printWelcome,\n SENTRY_CLI_RC_FILE,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { setupNpmScriptInCI, 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 { checkIfMoreSuitableWizardExistsAndAskForRedirect } from './utils/other-wizards';\nimport { configureAngularSourcemapGenerationFlow } from './tools/angular';\nimport { detectUsedTool, SupportedTools } from './utils/detect-tool';\nimport { configureNextJsSourceMapsUpload } from './tools/nextjs';\nimport { configureRemixSourceMapsUpload } from './tools/remix';\nimport { detectPackageManger } from '../utils/package-manager';\nimport { getIssueStreamUrl } from '../utils/url';\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: `This wizard will help you upload source maps to Sentry as part of your build.\nThank you for using Sentry :)${\n options.telemetryEnabled\n ? `\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 : ''\n }`,\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 confirmContinueIfNoOrDirtyGitRepo();\n\n await traceStep('check-sdk-version', ensureMinimumSdkVersionIsInstalled);\n\n const { selfHosted, selectedProject, sentryUrl, authToken } =\n await getOrAskForProjectData(options);\n\n const wizardOptionsWithPreSelectedProject = {\n ...options,\n preSelectedProject: {\n project: selectedProject,\n authToken,\n selfHosted,\n },\n };\n\n const selectedTool = await traceStep('select-tool', askForUsedBundlerTool);\n\n Sentry.setTag('selected-tool', selectedTool);\n\n if (selectedTool === 'no-tool') {\n clack.log.info(\n \"No Problem! But in this case, there's nothing to configure :)\",\n );\n await abort('Exiting, have a great day!', 0);\n return;\n }\n\n await traceStep('tool-setup', () =>\n startToolSetupFlow(\n selectedTool,\n {\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n authToken,\n },\n wizardOptionsWithPreSelectedProject,\n ),\n );\n\n await traceStep('ci-setup', () => configureCI(selectedTool, authToken));\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 = 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: 'Next.js',\n value: 'nextjs',\n hint: 'Select this option if you want to set up source maps in a Next.js project.',\n },\n {\n label: 'Remix',\n value: 'remix',\n hint: 'Select this option if you want to set up source maps in a Remix project.',\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: 'I use another tool',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n {\n label: \"I don't minify, transpile or bundle my code\",\n value: 'no-tool',\n hint: 'This will exit the wizard',\n },\n ],\n initialValue: await detectUsedTool(),\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n wizardOptions: WizardOptions,\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 case 'nextjs':\n await configureNextJsSourceMapsUpload(options, wizardOptions);\n break;\n case 'remix':\n await configureRemixSourceMapsUpload(options, wizardOptions);\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n\nexport async function configureCI(\n selectedTool: SupportedTools,\n authToken: string,\n): Promise<void> {\n const isUsingCI = await abortIfCancelled(\n clack.select({\n message: `Are you using a CI/CD tool to build and deploy your application?`,\n options: [\n {\n label: 'Yes',\n hint: 'I use a tool like GitHub Actions, GitLab, CircleCI, TravisCI, Jenkins, Vercel, ...',\n value: true,\n },\n {\n label: 'No',\n hint: 'I build and deploy my application manually',\n value: false,\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('using-ci', isUsingCI);\n\n const isCliBasedFlowTool = [\n 'sentry-cli',\n 'tsc',\n 'angular',\n 'create-react-app',\n ].includes(selectedTool);\n\n // some non-cli-based flows also use the .sentryclirc file\n const usesSentryCliRc = selectedTool === 'nextjs';\n\n const authTokenFile =\n isCliBasedFlowTool || usesSentryCliRc\n ? SENTRY_CLI_RC_FILE\n : SENTRY_DOT_ENV_FILE;\n\n if (!isUsingCI) {\n clack.log.info(\n `No Problem! Just make sure that the Sentry auth token from ${chalk.cyan(\n authTokenFile,\n )} is available whenever you build and deploy your app.`,\n );\n return;\n }\n\n if (isCliBasedFlowTool) {\n await traceStep('ci-npm-script-setup', setupNpmScriptInCI);\n }\n\n await traceStep('ci-auth-token-setup', () => setupAuthTokenInCI(authToken));\n}\n\nasync function setupAuthTokenInCI(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 packageManager = detectPackageManger();\n const buildCommand = packageManager?.buildCommand ?? 'npm run build';\n\n const issueStreamUrl = getIssueStreamUrl({ url, orgSlug, projectId });\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"]}
|
package/dist/src/telemetry.js
CHANGED
|
@@ -55,7 +55,7 @@ function withTelemetry(options, callback) {
|
|
|
55
55
|
sentryHub.captureSession();
|
|
56
56
|
_b.label = 1;
|
|
57
57
|
case 1:
|
|
58
|
-
_b.trys.push([1, 3, 4,
|
|
58
|
+
_b.trys.push([1, 3, 4, 7]);
|
|
59
59
|
return [4 /*yield*/, (0, node_1.startSpan)({
|
|
60
60
|
name: 'sentry-wizard-execution',
|
|
61
61
|
status: 'ok',
|
|
@@ -82,11 +82,18 @@ function withTelemetry(options, callback) {
|
|
|
82
82
|
throw e_1;
|
|
83
83
|
case 4:
|
|
84
84
|
sentryHub.endSession();
|
|
85
|
-
return [4 /*yield*/, sentryClient.flush(3000)
|
|
85
|
+
return [4 /*yield*/, sentryClient.flush(3000).then(null, function () {
|
|
86
|
+
// If telemetry flushing fails we generally don't care
|
|
87
|
+
})];
|
|
86
88
|
case 5:
|
|
89
|
+
_b.sent();
|
|
90
|
+
return [4 /*yield*/, (0, node_1.flush)(3000).then(null, function () {
|
|
91
|
+
// If telemetry flushing fails we generally don't care
|
|
92
|
+
})];
|
|
93
|
+
case 6:
|
|
87
94
|
_b.sent();
|
|
88
95
|
return [7 /*endfinally*/];
|
|
89
|
-
case
|
|
96
|
+
case 7: return [2 /*return*/];
|
|
90
97
|
}
|
|
91
98
|
});
|
|
92
99
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAWsB;AACtB,iEAA0C;AAE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E,IAAI,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,cAAM,OAAA,QAAQ,EAAE,EAAV,CAAU,CAAC,CAAC;AACxE,CAAC;AAHD,8BAGC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAA,aAAM,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC;AAFD,wCAEC","sourcesContent":["import {\n defaultStackParser,\n Hub,\n Integrations,\n makeMain,\n makeNodeTransport,\n NodeClient,\n runWithAsyncContext,\n setTag,\n startSpan,\n flush,\n} from '@sentry/node';\nimport packageJson from '../package.json';\n\nexport async function withTelemetry<F>(\n options: {\n enabled: boolean;\n integration: string;\n },\n callback: () => F | Promise<F>,\n): Promise<F> {\n const { sentryHub, sentryClient } = createSentryInstance(\n options.enabled,\n options.integration,\n );\n\n makeMain(sentryHub);\n\n const sentrySession = sentryHub.startSession();\n sentryHub.captureSession();\n\n try {\n return await startSpan(\n {\n name: 'sentry-wizard-execution',\n status: 'ok',\n op: 'wizard.flow',\n },\n async () => {\n updateProgress('start');\n const res = await runWithAsyncContext(callback);\n updateProgress('finished');\n\n return res;\n },\n );\n } catch (e) {\n sentryHub.captureException('Error during wizard execution.');\n sentrySession.status = 'crashed';\n throw e;\n } finally {\n sentryHub.endSession();\n await sentryClient.flush(3000).then(null, () => {\n // If telemetry flushing fails we generally don't care\n });\n await flush(3000).then(null, () => {\n // If telemetry flushing fails we generally don't care\n });\n }\n}\n\nfunction createSentryInstance(enabled: boolean, integration: string) {\n const client = new NodeClient({\n dsn: 'https://8871d3ff64814ed8960c96d1fcc98a27@o1.ingest.sentry.io/4505425820712960',\n enabled: enabled,\n\n environment: `production-${integration}`,\n\n tracesSampleRate: 1,\n sampleRate: 1,\n\n release: packageJson.version,\n integrations: [new Integrations.Http()],\n tracePropagationTargets: [/^https:\\/\\/sentry.io\\//],\n\n stackParser: defaultStackParser,\n\n beforeSendTransaction: (event) => {\n delete event.server_name; // Server name might contain PII\n return event;\n },\n\n beforeSend: (event) => {\n event.exception?.values?.forEach((exception) => {\n delete exception.stacktrace;\n });\n\n delete event.server_name; // Server name might contain PII\n return event;\n },\n\n transport: makeNodeTransport,\n\n debug: true,\n });\n\n const hub = new Hub(client);\n\n hub.setTag('integration', integration);\n hub.setTag('node', process.version);\n hub.setTag('platform', process.platform);\n\n return { sentryHub: hub, sentryClient: client };\n}\n\nexport function traceStep<T>(step: string, callback: () => T): T {\n updateProgress(step);\n return startSpan({ name: step, op: 'wizard.step' }, () => callback());\n}\n\nexport function updateProgress(step: string) {\n setTag('progress', step);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PackageDotJson } from './package-json';
|
|
2
|
-
import { SentryProjectData, WizardOptions } from './types';
|
|
2
|
+
import { Feature, SentryProjectData, WizardOptions } from './types';
|
|
3
3
|
export declare const SENTRY_DOT_ENV_FILE = ".env.sentry-build-plugin";
|
|
4
4
|
export declare const SENTRY_CLI_RC_FILE = ".sentryclirc";
|
|
5
5
|
export declare const SENTRY_PROPERTIES_FILE = "sentry.properties";
|
|
@@ -170,4 +170,7 @@ export declare function makeCodeSnippet(colors: boolean, callback: CodeSnippetFo
|
|
|
170
170
|
*/
|
|
171
171
|
export declare function createNewConfigFile(filepath: string, codeSnippet: string, moreInformation?: string): Promise<boolean>;
|
|
172
172
|
export declare function askShouldCreateExamplePage(customRoute?: string): Promise<boolean>;
|
|
173
|
+
export declare function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(features: F): Promise<{
|
|
174
|
+
[key in F[number]['id']]: boolean;
|
|
175
|
+
}>;
|
|
173
176
|
export {};
|
|
@@ -71,7 +71,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
71
71
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
72
72
|
};
|
|
73
73
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
|
-
exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
|
|
74
|
+
exports.featureSelectionPrompt = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
|
|
75
75
|
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
76
76
|
var clack = __importStar(require("@clack/prompts"));
|
|
77
77
|
var axios_1 = __importDefault(require("axios"));
|
|
@@ -399,14 +399,28 @@ function installPackage(_a) {
|
|
|
399
399
|
_a.label = 4;
|
|
400
400
|
case 4:
|
|
401
401
|
_a.trys.push([4, 6, , 8]);
|
|
402
|
-
return [4 /*yield*/, (
|
|
402
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
403
|
+
childProcess.exec("".concat(packageManager.installCommand, " ").concat(packageName, " ").concat(packageManager.flags), function (err, stdout, stderr) {
|
|
404
|
+
if (err) {
|
|
405
|
+
// Write a log file so we can better troubleshoot issues
|
|
406
|
+
fs.writeFileSync(path.join(process.cwd(), "sentry-wizard-installation-error-".concat(Date.now(), ".log")), JSON.stringify({
|
|
407
|
+
stdout: stdout,
|
|
408
|
+
stderr: stderr,
|
|
409
|
+
}), { encoding: 'utf8' });
|
|
410
|
+
reject(err);
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
resolve();
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
})];
|
|
403
417
|
case 5:
|
|
404
418
|
_a.sent();
|
|
405
419
|
return [3 /*break*/, 8];
|
|
406
420
|
case 6:
|
|
407
421
|
e_1 = _a.sent();
|
|
408
422
|
sdkInstallSpinner.stop('Installation failed.');
|
|
409
|
-
clack.log.error("".concat(chalk_1.default.red('Encountered the following error during installation:'), "\n\n").concat(e_1, "\n\n").concat(chalk_1.default.dim(
|
|
423
|
+
clack.log.error("".concat(chalk_1.default.red('Encountered the following error during installation:'), "\n\n").concat(e_1, "\n\n").concat(chalk_1.default.dim("The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\nhttps://github.com/getsentry/sentry-wizard/issues")));
|
|
410
424
|
return [4 /*yield*/, abort()];
|
|
411
425
|
case 7:
|
|
412
426
|
_a.sent();
|
|
@@ -561,21 +575,31 @@ function addDotEnvSentryBuildPluginFile(authToken) {
|
|
|
561
575
|
exports.addDotEnvSentryBuildPluginFile = addDotEnvSentryBuildPluginFile;
|
|
562
576
|
function addCliConfigFileToGitIgnore(filename) {
|
|
563
577
|
return __awaiter(this, void 0, void 0, function () {
|
|
564
|
-
var _a;
|
|
578
|
+
var gitignorePath, gitignoreContent, _a;
|
|
565
579
|
return __generator(this, function (_b) {
|
|
566
580
|
switch (_b.label) {
|
|
567
581
|
case 0:
|
|
568
|
-
|
|
569
|
-
|
|
582
|
+
gitignorePath = path.join(process.cwd(), '.gitignore');
|
|
583
|
+
_b.label = 1;
|
|
570
584
|
case 1:
|
|
585
|
+
_b.trys.push([1, 4, , 5]);
|
|
586
|
+
return [4 /*yield*/, fs.promises.readFile(gitignorePath, 'utf8')];
|
|
587
|
+
case 2:
|
|
588
|
+
gitignoreContent = _b.sent();
|
|
589
|
+
if (gitignoreContent.split(/\r?\n/).includes(filename)) {
|
|
590
|
+
clack.log.info("".concat(chalk_1.default.bold('.gitignore'), " already has ").concat(chalk_1.default.bold(filename), ". Will not add it again."));
|
|
591
|
+
return [2 /*return*/];
|
|
592
|
+
}
|
|
593
|
+
return [4 /*yield*/, fs.promises.appendFile(gitignorePath, "\n# Sentry Config File\n".concat(filename, "\n"), { encoding: 'utf8' })];
|
|
594
|
+
case 3:
|
|
571
595
|
_b.sent();
|
|
572
596
|
clack.log.success("Added ".concat(chalk_1.default.cyan(filename), " to ").concat(chalk_1.default.cyan('.gitignore'), "."));
|
|
573
|
-
return [3 /*break*/,
|
|
574
|
-
case
|
|
597
|
+
return [3 /*break*/, 5];
|
|
598
|
+
case 4:
|
|
575
599
|
_a = _b.sent();
|
|
576
600
|
clack.log.error("Failed adding ".concat(chalk_1.default.cyan(filename), " to ").concat(chalk_1.default.cyan('.gitignore'), ". Please add it manually!"));
|
|
577
|
-
return [3 /*break*/,
|
|
578
|
-
case
|
|
601
|
+
return [3 /*break*/, 5];
|
|
602
|
+
case 5: return [2 /*return*/];
|
|
579
603
|
}
|
|
580
604
|
});
|
|
581
605
|
});
|
|
@@ -882,7 +906,7 @@ function askForWizardLogin(options) {
|
|
|
882
906
|
}
|
|
883
907
|
urlToOpen = loginUrl.toString();
|
|
884
908
|
clack.log.info("".concat(chalk_1.default.bold("If the browser window didn't open automatically, please open the following link to ".concat(hasSentryAccount ? 'log' : 'sign', " into Sentry:")), "\n\n").concat(chalk_1.default.cyan(urlToOpen)));
|
|
885
|
-
opn(urlToOpen).catch(function () {
|
|
909
|
+
opn(urlToOpen, { wait: false }).catch(function () {
|
|
886
910
|
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
887
911
|
});
|
|
888
912
|
loginSpinner = clack.spinner();
|
|
@@ -1146,4 +1170,50 @@ function askShouldCreateExamplePage(customRoute) {
|
|
|
1146
1170
|
});
|
|
1147
1171
|
}
|
|
1148
1172
|
exports.askShouldCreateExamplePage = askShouldCreateExamplePage;
|
|
1173
|
+
function featureSelectionPrompt(features) {
|
|
1174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1175
|
+
var _this = this;
|
|
1176
|
+
return __generator(this, function (_a) {
|
|
1177
|
+
return [2 /*return*/, (0, telemetry_1.traceStep)('feature-selection', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1178
|
+
var selectedFeatures, _i, features_1, feature, selected;
|
|
1179
|
+
return __generator(this, function (_a) {
|
|
1180
|
+
switch (_a.label) {
|
|
1181
|
+
case 0:
|
|
1182
|
+
selectedFeatures = {};
|
|
1183
|
+
_i = 0, features_1 = features;
|
|
1184
|
+
_a.label = 1;
|
|
1185
|
+
case 1:
|
|
1186
|
+
if (!(_i < features_1.length)) return [3 /*break*/, 4];
|
|
1187
|
+
feature = features_1[_i];
|
|
1188
|
+
return [4 /*yield*/, abortIfCancelled(clack.select({
|
|
1189
|
+
message: feature.prompt,
|
|
1190
|
+
initialValue: true,
|
|
1191
|
+
options: [
|
|
1192
|
+
{
|
|
1193
|
+
value: true,
|
|
1194
|
+
label: 'Yes',
|
|
1195
|
+
hint: feature.enabledHint,
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
value: false,
|
|
1199
|
+
label: 'No',
|
|
1200
|
+
hint: feature.disabledHint,
|
|
1201
|
+
},
|
|
1202
|
+
],
|
|
1203
|
+
}))];
|
|
1204
|
+
case 2:
|
|
1205
|
+
selected = _a.sent();
|
|
1206
|
+
selectedFeatures[feature.id] = selected;
|
|
1207
|
+
_a.label = 3;
|
|
1208
|
+
case 3:
|
|
1209
|
+
_i++;
|
|
1210
|
+
return [3 /*break*/, 1];
|
|
1211
|
+
case 4: return [2 /*return*/, selectedFeatures];
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
}); })];
|
|
1215
|
+
});
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
exports.featureSelectionPrompt = featureSelectionPrompt;
|
|
1149
1219
|
//# sourceMappingURL=clack-utils.js.map
|