@sentry/wizard 3.34.4 → 3.35.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/e2e-tests/tests/nuxt-3.test.d.ts +1 -0
  3. package/dist/e2e-tests/tests/nuxt-3.test.js +231 -0
  4. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -0
  5. package/dist/e2e-tests/tests/nuxt-4.test.d.ts +1 -0
  6. package/dist/e2e-tests/tests/nuxt-4.test.js +232 -0
  7. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -0
  8. package/dist/e2e-tests/tests/remix.test.js +92 -27
  9. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/sveltekit.test.js +102 -42
  11. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  12. package/dist/e2e-tests/utils/index.d.ts +18 -1
  13. package/dist/e2e-tests/utils/index.js +31 -2
  14. package/dist/e2e-tests/utils/index.js.map +1 -1
  15. package/dist/lib/Constants.d.ts +1 -0
  16. package/dist/lib/Constants.js +1 -0
  17. package/dist/lib/Constants.js.map +1 -1
  18. package/dist/package.json +1 -1
  19. package/dist/src/apple/templates.js +2 -2
  20. package/dist/src/apple/templates.js.map +1 -1
  21. package/dist/src/nextjs/nextjs-wizard.js +1 -0
  22. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  23. package/dist/src/nuxt/nuxt-wizard.d.ts +3 -0
  24. package/dist/src/nuxt/nuxt-wizard.js +220 -0
  25. package/dist/src/nuxt/nuxt-wizard.js.map +1 -0
  26. package/dist/src/nuxt/sdk-example.d.ts +8 -0
  27. package/dist/src/nuxt/sdk-example.js +179 -0
  28. package/dist/src/nuxt/sdk-example.js.map +1 -0
  29. package/dist/src/nuxt/sdk-setup.d.ts +8 -0
  30. package/dist/src/nuxt/sdk-setup.js +275 -0
  31. package/dist/src/nuxt/sdk-setup.js.map +1 -0
  32. package/dist/src/nuxt/templates.d.ts +22 -0
  33. package/dist/src/nuxt/templates.js +84 -0
  34. package/dist/src/nuxt/templates.js.map +1 -0
  35. package/dist/src/nuxt/utils.d.ts +1 -0
  36. package/dist/src/nuxt/utils.js +71 -0
  37. package/dist/src/nuxt/utils.js.map +1 -0
  38. package/dist/src/remix/remix-wizard.js +2 -1
  39. package/dist/src/remix/remix-wizard.js.map +1 -1
  40. package/dist/src/run.d.ts +1 -1
  41. package/dist/src/run.js +30 -23
  42. package/dist/src/run.js.map +1 -1
  43. package/dist/src/sourcemaps/tools/rollup.js +1 -1
  44. package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
  45. package/dist/src/sveltekit/sveltekit-wizard.js +2 -1
  46. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  47. package/dist/src/utils/clack-utils.d.ts +6 -2
  48. package/dist/src/utils/clack-utils.js +30 -10
  49. package/dist/src/utils/clack-utils.js.map +1 -1
  50. package/dist/test/nuxt/templates.test.d.ts +1 -0
  51. package/dist/test/nuxt/templates.test.js +70 -0
  52. package/dist/test/nuxt/templates.test.js.map +1 -0
  53. package/e2e-tests/README.md +59 -0
  54. package/e2e-tests/test-applications/nuxt-3-test-app/README.md +75 -0
  55. package/e2e-tests/test-applications/nuxt-3-test-app/nuxt.config.ts +5 -0
  56. package/e2e-tests/test-applications/nuxt-3-test-app/package.json +18 -0
  57. package/e2e-tests/test-applications/nuxt-3-test-app/public/favicon.ico +0 -0
  58. package/e2e-tests/test-applications/nuxt-3-test-app/public/robots.txt +1 -0
  59. package/e2e-tests/tests/nuxt-3.test.ts +169 -0
  60. package/e2e-tests/tests/nuxt-4.test.ts +168 -0
  61. package/e2e-tests/tests/remix.test.ts +163 -50
  62. package/e2e-tests/tests/sveltekit.test.ts +180 -79
  63. package/e2e-tests/utils/index.ts +31 -1
  64. package/lib/Constants.ts +1 -0
  65. package/package.json +1 -1
  66. package/src/apple/templates.ts +14 -2
  67. package/src/nextjs/nextjs-wizard.ts +1 -0
  68. package/src/nuxt/nuxt-wizard.ts +166 -0
  69. package/src/nuxt/sdk-example.ts +135 -0
  70. package/src/nuxt/sdk-setup.ts +209 -0
  71. package/src/nuxt/templates.ts +296 -0
  72. package/src/nuxt/utils.ts +32 -0
  73. package/src/remix/remix-wizard.ts +2 -1
  74. package/src/run.ts +7 -0
  75. package/src/sourcemaps/tools/rollup.ts +1 -1
  76. package/src/sveltekit/sveltekit-wizard.ts +2 -1
  77. package/src/utils/clack-utils.ts +32 -8
  78. package/test/nuxt/templates.test.ts +228 -0
@@ -1 +1 @@
1
- {"version":3,"file":"clack-utils.js","sourceRoot":"","sources":["../../../src/utils/clack-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,gDAA0B;AAC1B,0DAA8C;AAC9C,qCAAyB;AACzB,yCAA6B;AAC7B,qCAAyB;AACzB,iCAAqC;AACrC,2BAA0B;AAC1B,mDAAuC;AACvC,+CAAqE;AAErE,0CAAyC;AACzC,qDAI2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAKc,CAAC;AAE3B,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AACjD,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,IAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC,IAAM,gBAAgB,GAAG,0BAA0B,CAAC;AA+BvC,QAAA,gBAAgB,GAAmB;IAC9C,QAAQ,EAAE,0BAAkB;IAC5B,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,IAAI;IACf,yBAAyB,EAAE,UAAU,QAAgB;QACnD,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,I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;;;qBAClE,CAAC,EAAC;;;CACJ;AA/BD,wDA+BC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport axios from 'axios';\nimport chalk from 'chalk';\nimport * as childProcess from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { setInterval } from 'timers';\nimport { URL } from 'url';\nimport * as Sentry from '@sentry/node';\nimport { hasPackageInstalled, PackageDotJson } from './package-json';\nimport { Feature, SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\n options?: {\n wait?: boolean;\n },\n) => Promise<childProcess.ChildProcess>;\n\nexport const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';\nexport const SENTRY_CLI_RC_FILE = '.sentryclirc';\nexport const SENTRY_PROPERTIES_FILE = 'sentry.properties';\n\nconst SAAS_URL = 'https://sentry.io/';\n\nconst DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';\n\ninterface WizardProjectData {\n apiKeys?: {\n token?: string;\n };\n projects?: SentryProjectData[];\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport const rcCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_CLI_RC_FILE,\n name: 'source maps',\n gitignore: true,\n likelyAlreadyHasAuthToken: function (contents: string): boolean {\n return !!(contents.includes('[auth]') && contents.match(/token=./g));\n },\n tokenContent: function (authToken: string): string {\n return `[auth]\\ntoken=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject: function (contents: string): boolean {\n return !!(\n contents.includes('[defaults]') &&\n contents.match(/org=./g) &&\n contents.match(/project=./g)\n );\n },\n orgAndProjContent: function (org: string, project: string): string {\n return `[defaults]\\norg=${org}\\nproject=${project}`;\n },\n};\n\nexport const propertiesCliSetupConfig: Required<CliSetupConfig> = {\n filename: SENTRY_PROPERTIES_FILE,\n gitignore: true,\n name: 'debug files',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n likelyAlreadyHasUrl(contents: string): boolean {\n return !!contents.match(/defaults\\.url=./g);\n },\n urlContent(url: string): string {\n return `defaults.url=${url}`;\n },\n};\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n clack.outro(message ?? 'Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('aborted');\n sentryTransaction?.finish();\n const sentrySession = sentryHub.getScope().getSession();\n if (sentrySession) {\n sentrySession.status = status === 0 ? 'abnormal' : 'crashed';\n sentryHub.captureSession(true);\n }\n await Sentry.flush(3000);\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n): Promise<Exclude<T, symbol>> {\n if (clack.isCancel(await input)) {\n clack.cancel('Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('cancelled');\n sentryTransaction?.finish();\n sentryHub.captureSession(true);\n await Sentry.flush(3000);\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: {\n wizardName: string;\n promoCode?: string;\n message?: string;\n telemetryEnabled?: boolean;\n}): void {\n let wizardPackage: { version?: string } = {};\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n } catch {\n // We don't need to have this\n }\n\n // eslint-disable-next-line no-console\n console.log('');\n clack.intro(chalk.inverse(` ${options.wizardName} `));\n\n let welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up Sentry for your application.\\nThank you for using Sentry :)`;\n\n if (options.promoCode) {\n welcomeText = `${welcomeText}\\n\\nUsing promo-code: ${options.promoCode}`;\n }\n\n if (wizardPackage.version) {\n welcomeText = `${welcomeText}\\n\\nVersion: ${wizardPackage.version}`;\n }\n\n if (options.telemetryEnabled) {\n welcomeText = `${welcomeText}\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ${chalk.cyanBright(\n 'sentry-wizard --disable-telemetry',\n )}.`;\n }\n\n clack.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n const continueWithoutGit = await abortIfCancelled(\n clack.confirm({\n message:\n 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n clack.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe wizard will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport function isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1')\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askToInstallSentryCLI(): Promise<boolean> {\n return await abortIfCancelled(\n clack.confirm({\n message:\n \"You don't have Sentry CLI installed. Do you want to install it?\",\n }),\n );\n}\n\nexport async function askForItemSelection(\n items: string[],\n message: string,\n): Promise<{ value: string; index: number }> {\n const selection: { value: string; index: number } | symbol =\n await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection;\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n clack.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n clack.note(\n note ??\n `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`,\n );\n const continueWithUnsupportedVersion = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n Sentry.setTag(\n `${packageName.toLowerCase()}-continue-with-unsupported-version`,\n continueWithUnsupportedVersion,\n );\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n}: {\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n}): Promise<{ packageManager?: PackageManager }> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n clack.confirm({\n message: `The ${chalk.bold.cyan(\n packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return {};\n }\n }\n\n const sdkInstallSpinner = clack.spinner();\n\n const packageManager = await getPackageManager();\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `${packageManager.installCommand} ${packageName} ${packageManager.flags}`,\n (err, stdout, stderr) => {\n if (err) {\n // Write a log file so we can better troubleshoot issues\n fs.writeFileSync(\n path.join(\n process.cwd(),\n `sentry-wizard-installation-error-${Date.now()}.log`,\n ),\n JSON.stringify({\n stdout,\n stderr,\n }),\n { encoding: 'utf8' },\n );\n\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n \"The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\\nhttps://github.com/getsentry/sentry-wizard/issues\",\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n return { packageManager };\n });\n}\n\nexport async function addSentryCliConfig(\n { authToken, org, project, url }: CliSetupConfigContent,\n setupConfig: CliSetupConfig = rcCliSetupConfig,\n): Promise<void> {\n return traceStep('add-sentry-cli-config', async () => {\n const configPath = path.join(process.cwd(), setupConfig.filename);\n const configExists = fs.existsSync(configPath);\n\n let configContents =\n (configExists && fs.readFileSync(configPath, 'utf8')) || '';\n configContents = addAuthTokenToSentryConfig(\n configContents,\n authToken,\n setupConfig,\n );\n configContents = addOrgAndProjectToSentryConfig(\n configContents,\n org,\n project,\n setupConfig,\n );\n configContents = addUrlToSentryConfig(configContents, url, setupConfig);\n\n try {\n await fs.promises.writeFile(configPath, configContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `${configExists ? 'Saved' : 'Created'} ${chalk.cyan(\n setupConfig.filename,\n )}.`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.cyan(\n setupConfig.filename,\n )}. Uploading ${\n setupConfig.name\n } during build will likely not work locally.`,\n );\n }\n\n if (setupConfig.gitignore) {\n await addCliConfigFileToGitIgnore(setupConfig.filename);\n } else {\n clack.log.warn(\n chalk.yellow('DO NOT commit auth token to your repository!'),\n );\n }\n });\n}\n\nfunction addAuthTokenToSentryConfig(\n configContents: string,\n authToken: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!authToken) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has auth token. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.tokenContent(\n authToken,\n )}\\n`;\n clack.log.success(\n `Added auth token to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addOrgAndProjectToSentryConfig(\n configContents: string,\n org: string | undefined,\n project: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!org || !project) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has org and project. Will not add them.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.orgAndProjContent(\n org,\n project,\n )}\\n`;\n clack.log.success(\n `Added default org and project to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addUrlToSentryConfig(\n configContents: string,\n url: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!url || !setupConfig.urlContent || !setupConfig.likelyAlreadyHasUrl) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasUrl(configContents)) {\n clack.log.warn(\n `${chalk.cyan(setupConfig.filename)} already has url. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.urlContent(url)}\\n`;\n clack.log.success(\n `Added default url to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nexport async function addDotEnvSentryBuildPluginFile(\n authToken: string,\n): Promise<void> {\n const envVarContent = `# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own \\`.env\\` files and remove this file.\nSENTRY_AUTH_TOKEN=${authToken}\n`;\n\n const dotEnvFilePath = path.join(process.cwd(), SENTRY_DOT_ENV_FILE);\n const dotEnvFileExists = fs.existsSync(dotEnvFilePath);\n\n if (dotEnvFileExists) {\n const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');\n\n const hasAuthToken = !!dotEnvFileContent.match(\n /^\\s*SENTRY_AUTH_TOKEN\\s*=/g,\n );\n\n if (hasAuthToken) {\n clack.log.warn(\n `${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} already has auth token. Will not add one.`,\n );\n } else {\n try {\n await fs.promises.writeFile(\n dotEnvFilePath,\n `${dotEnvFileContent}\\n${envVarContent}`,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added auth token to ${chalk.bold(SENTRY_DOT_ENV_FILE)}`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )}. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n } else {\n try {\n await fs.promises.writeFile(dotEnvFilePath, envVarContent, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `Created ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token for you to test source map uploading locally.`,\n );\n } catch {\n clack.log.warning(\n `Failed to create ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n\n await addCliConfigFileToGitIgnore(SENTRY_DOT_ENV_FILE);\n}\n\nasync function addCliConfigFileToGitIgnore(filename: string): Promise<void> {\n const gitignorePath = path.join(process.cwd(), '.gitignore');\n\n try {\n const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');\n if (gitignoreContent.split(/\\r?\\n/).includes(filename)) {\n clack.log.info(\n `${chalk.bold('.gitignore')} already has ${chalk.bold(\n filename,\n )}. Will not add it again.`,\n );\n return;\n }\n\n await fs.promises.appendFile(\n gitignorePath,\n `\\n# Sentry Config File\\n${filename}\\n`,\n { encoding: 'utf8' },\n );\n clack.log.success(\n `Added ${chalk.cyan(filename)} to ${chalk.cyan('.gitignore')}.`,\n );\n } catch {\n clack.log.error(\n `Failed adding ${chalk.cyan(filename)} to ${chalk.cyan(\n '.gitignore',\n )}. Please add it manually!`,\n );\n }\n}\n\nexport async function runPrettierIfInstalled(): Promise<void> {\n return traceStep('run-prettier', async () => {\n if (!isInGitRepo()) {\n // We only run formatting on changed files. If we're not in a git repo, we can't find\n // changed files. So let's early-return without showing any formatting-related messages.\n return;\n }\n\n const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()\n .map((filename) => {\n return filename.startsWith('- ') ? filename.slice(2) : filename;\n })\n .join(' ');\n\n if (!changedOrUntrackedFiles.length) {\n // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.\n return;\n }\n\n const packageJson = await getPackageDotJson();\n const prettierInstalled = hasPackageInstalled('prettier', packageJson);\n\n Sentry.setTag('prettier-installed', prettierInstalled);\n\n if (!prettierInstalled) {\n return;\n }\n\n // prompt the user if they want to run prettier\n const shouldRunPrettier = await abortIfCancelled(\n clack.confirm({\n message:\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n }),\n );\n\n if (!shouldRunPrettier) {\n return;\n }\n\n const prettierSpinner = clack.spinner();\n prettierSpinner.start('Running Prettier on your files.');\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`,\n (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n prettierSpinner.stop('Prettier failed to run.');\n clack.log.warn(\n 'Prettier failed to run. There may be formatting issues in your updated files.',\n );\n return;\n }\n\n prettierSpinner.stop('Prettier has formatted your files.');\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);\n const continueWithoutPackage = await abortIfCancelled(\n clack.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson(): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises\n .readFile(path.join(process.cwd(), 'package.json'), 'utf8')\n .catch(() => {\n clack.log.error(\n 'Could not find package.json. Make sure to run the wizard in the root of your app!',\n );\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'package.json',\n )}. Make sure it has a valid format!`,\n );\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function getPackageManager(): Promise<PackageManager> {\n const detectedPackageManager = detectPackageManger();\n\n if (detectedPackageManager) {\n return detectedPackageManager;\n }\n\n const selectedPackageManager: PackageManager | symbol =\n await abortIfCancelled(\n clack.select({\n message: 'Please select your package manager.',\n options: packageManagers.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n Sentry.setTag('package-manager', selectedPackageManager.name);\n\n return selectedPackageManager;\n}\n\nexport function isUsingTypeScript() {\n try {\n return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if we already got project data from a previous wizard invocation.\n * If yes, this data is returned.\n * Otherwise, we start the login flow and ask the user to select a project.\n *\n * Use this function to get project data for the wizard.\n *\n * @param options wizard options\n * @param platform the platform of the wizard\n * @returns project data (org, project, token, url)\n */\nexport async function getOrAskForProjectData(\n options: WizardOptions,\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native',\n): Promise<{\n sentryUrl: string;\n selfHosted: boolean;\n selectedProject: SentryProjectData;\n authToken: string;\n}> {\n if (options.preSelectedProject) {\n return {\n selfHosted: options.preSelectedProject.selfHosted,\n sentryUrl: options.url ?? SAAS_URL,\n authToken: options.preSelectedProject.authToken,\n selectedProject: options.preSelectedProject.project,\n };\n }\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url, options.saas),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\n orgSlug: options.orgSlug,\n projectSlug: options.projectSlug,\n }),\n );\n\n if (!projects || !projects.length) {\n clack.log.error(\n 'No projects found. Please create a project in Sentry and try again.',\n );\n Sentry.setTag('no-projects-found', true);\n await abort();\n // This rejection won't return due to the abort call but TS doesn't know that\n return Promise.reject();\n }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects, options.orgSlug, options.projectSlug),\n );\n\n const { token } = apiKeys ?? {};\n\n if (!token) {\n clack.log.error(`Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n${chalk.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);\n\n clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk.cyan(\n `\"${DUMMY_AUTH_TOKEN}\"`,\n )}) for you to replace later.\nCreate your auth token here:\n${chalk.cyan(\n selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`\n : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`,\n)}`);\n }\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,\n selectedProject,\n };\n}\n\n/**\n * Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.\n *\n * If users started the wizard with a --url arg, that URL is used as the default and we skip\n * the self-hosted question. However, the passed url is still validated and in case it's\n * invalid, users are asked to enter a new one until it is valid.\n *\n * @param urlFromArgs the url passed via the --url arg\n */\nasync function askForSelfHosted(\n urlFromArgs?: string,\n saas?: boolean,\n): Promise<{\n url: string;\n selfHosted: boolean;\n}> {\n if (saas) {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n\n if (!urlFromArgs) {\n const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(\n clack.select({\n message: 'Are you using Sentry SaaS or self-hosted Sentry?',\n options: [\n { value: 'saas', label: 'Sentry SaaS (sentry.io)' },\n {\n value: 'self-hosted',\n label: 'Self-hosted/on-premise/single-tenant',\n },\n ],\n }),\n );\n\n if (choice === 'saas') {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n }\n\n let validUrl: string | undefined;\n let tmpUrlFromArgs = urlFromArgs;\n\n while (validUrl === undefined) {\n const url =\n tmpUrlFromArgs ||\n (await abortIfCancelled(\n clack.text({\n message: `Please enter the URL of your ${\n urlFromArgs ? '' : 'self-hosted '\n }Sentry instance.`,\n placeholder: 'https://sentry.io/',\n }),\n ));\n tmpUrlFromArgs = undefined;\n\n try {\n validUrl = new URL(url).toString();\n\n // We assume everywhere else that the URL ends in a slash\n if (!validUrl.endsWith('/')) {\n validUrl += '/';\n }\n } catch {\n clack.log.error(\n `Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ${url})`,\n );\n }\n }\n\n const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;\n\n Sentry.setTag('url', validUrl);\n Sentry.setTag('self-hosted', isSelfHostedUrl);\n\n return { url: validUrl, selfHosted: true };\n}\n\nasync function askForWizardLogin(options: {\n url: string;\n promoCode?: string;\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native';\n orgSlug?: string;\n projectSlug?: string;\n}): Promise<WizardProjectData> {\n Sentry.setTag('has-promo-code', !!options.promoCode);\n\n let hasSentryAccount = await clack.confirm({\n message: 'Do you already have a Sentry account?',\n });\n\n hasSentryAccount = await abortIfCancelled(hasSentryAccount);\n\n Sentry.setTag('already-has-sentry-account', hasSentryAccount);\n\n let wizardHash: string;\n try {\n wizardHash = (\n await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)\n ).data.hash;\n } catch (e: unknown) {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please check your configuration and try again.\\n\\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n } else {\n clack.log.error('Loading Wizard failed.');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n }\n }\n\n const loginUrl = new URL(\n `${options.url}account/settings/wizard/${wizardHash!}/`,\n );\n\n if (options.orgSlug) {\n loginUrl.searchParams.set('org_slug', options.orgSlug);\n }\n\n if (options.projectSlug) {\n loginUrl.searchParams.set('project_slug', options.projectSlug);\n }\n\n if (!hasSentryAccount) {\n loginUrl.searchParams.set('signup', '1');\n if (options.platform) {\n loginUrl.searchParams.set('project_platform', options.platform);\n }\n }\n\n if (options.promoCode) {\n loginUrl.searchParams.set('code', options.promoCode);\n }\n\n const urlToOpen = loginUrl.toString();\n clack.log.info(\n `${chalk.bold(\n `If the browser window didn't open automatically, please open the following link to ${\n hasSentryAccount ? 'log' : 'sign'\n } into Sentry:`,\n )}\\n\\n${chalk.cyan(urlToOpen)}`,\n );\n\n opn(urlToOpen, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n\n const loginSpinner = clack.spinner();\n\n loginSpinner.start('Waiting for you to log in using the link above');\n\n const data = await new Promise<WizardProjectData>((resolve) => {\n const pollingInterval = setInterval(() => {\n axios\n .get<WizardProjectData>(`${options.url}api/0/wizard/${wizardHash}/`, {\n headers: {\n 'Accept-Encoding': 'deflate',\n },\n })\n .then((result) => {\n resolve(result.data);\n clearTimeout(timeout);\n clearInterval(pollingInterval);\n void axios.delete(`${options.url}api/0/wizard/${wizardHash}/`);\n })\n .catch(() => {\n // noop - just try again\n });\n }, 500);\n\n const timeout = setTimeout(() => {\n clearInterval(pollingInterval);\n loginSpinner.stop(\n 'Login timed out. No worries - it happens to the best of us.',\n );\n\n Sentry.setTag('opened-wizard-link', false);\n void abort('Please restart the Wizard and log in to complete the setup.');\n }, 180_000);\n });\n\n loginSpinner.stop('Login complete.');\n Sentry.setTag('opened-wizard-link', true);\n\n return data;\n}\n\nasync function askForProjectSelection(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n\n const filteredProjects = filterProjectsBySlugs(\n projects,\n orgSlug,\n projectSlug,\n );\n\n if (filteredProjects.length === 1) {\n const selection = filteredProjects[0];\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n clack.log.step(`Selected project ${label(selection)}`);\n\n return selection;\n }\n\n if (filteredProjects.length === 0) {\n clack.log.warn('Could not find a project with the provided slugs.');\n }\n\n const sortedProjects = filteredProjects.length ? filteredProjects : projects;\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\n });\n\n const selection: SentryProjectData | symbol = await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: 'Select your Sentry project.',\n options: sortedProjects.map((project) => {\n return {\n value: project,\n label: label(project),\n };\n }),\n }),\n );\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n\n return selection;\n}\n\nfunction filterProjectsBySlugs(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): SentryProjectData[] {\n if (!orgSlug && !projectSlug) {\n return projects;\n }\n if (orgSlug && !projectSlug) {\n return projects.filter((p) => p.organization.slug === orgSlug);\n }\n if (!orgSlug && projectSlug) {\n return projects.filter((p) => p.slug === projectSlug);\n }\n\n return projects.filter(\n (p) => p.organization.slug === orgSlug && p.slug === projectSlug,\n );\n}\n\n/**\n * Asks users if they have a config file for @param tool (e.g. Vite).\n * If yes, asks users to specify the path to their config file.\n *\n * Use this helper function as a fallback mechanism if the lookup for\n * a config file with its most usual location/name fails.\n *\n * @param toolName Name of the tool for which we're looking for the config file\n * @param configFileName Name of the most common config file name (e.g. vite.config.js)\n *\n * @returns a user path to the config file or undefined if the user doesn't have a config file\n */\nexport async function askForToolConfigPath(\n toolName: string,\n configFileName: string,\n): Promise<string | undefined> {\n const hasConfig = await abortIfCancelled(\n clack.confirm({\n message: `Do you have a ${toolName} config file (e.g. ${chalk.cyan(\n configFileName,\n )})?`,\n initialValue: true,\n }),\n );\n\n if (!hasConfig) {\n return undefined;\n }\n\n return await abortIfCancelled(\n clack.text({\n message: `Please enter the path to your ${toolName} config file:`,\n placeholder: path.join('.', configFileName),\n validate: (value) => {\n if (!value) {\n return 'Please enter a path.';\n }\n\n try {\n fs.accessSync(value);\n } catch {\n return 'Could not access the file at this path.';\n }\n },\n }),\n );\n}\n\n/**\n * Prints copy/paste-able instructions to the console.\n * Afterwards asks the user if they added the code snippet to their file.\n *\n * While there's no point in providing a \"no\" answer here, it gives users time to fulfill the\n * task before the wizard continues with additional steps.\n *\n * Use this function if you want to show users instructions on how to add/modify\n * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.\n *\n * @param filename the name of the file to which the code snippet should be applied.\n * If a path is provided, only the filename will be used.\n *\n * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the\n * diff-like format for visually highlighting unchanged or modified lines of code.\n *\n * @param hint (optional) a hint to be printed after the main instruction to add\n * the code from @param codeSnippet to their @param filename.\n *\n * More guidelines on copy/paste instructions:\n * @see {@link https://develop.sentry.dev/sdk/setup-wizards/#copy--paste-snippets}\n *\n * TODO: refactor copy paste instructions across different wizards to use this function.\n * this might require adding a custom message parameter to the function\n */\nexport async function showCopyPasteInstructions(\n filename: string,\n codeSnippet: string,\n hint?: string,\n): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.cyan(\n path.basename(filename),\n )} file:${hint ? chalk.dim(` (${chalk.dim(hint)})`) : ''}`,\n );\n\n // Padding the code snippet to be printed with a \\n at the beginning and end\n // This makes it easier to distinguish the snippet from the rest of the output\n // Intentionally logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(`\\n${codeSnippet}\\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you apply the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\n/**\n * Callback that exposes formatting helpers for a code snippet.\n * @param unchanged - Formats text as old code.\n * @param plus - Formats text as new code.\n * @param minus - Formats text as removed code.\n */\ntype CodeSnippetFormatter = (\n unchanged: (txt: string) => string,\n plus: (txt: string) => string,\n minus: (txt: string) => string,\n) => string;\n\n/**\n * Crafts a code snippet that can be used to e.g.\n * - print copy/paste instructions to the console\n * - create a new config file.\n *\n * @param colors set this to true if you want the final snippet to be colored.\n * This is useful for printing the snippet to the console as part of copy/paste instructions.\n *\n * @param callback the callback that returns the formatted code snippet.\n * It exposes takes the helper functions for marking code as unchanged, new or removed.\n * These functions no-op if no special formatting should be applied\n * and otherwise apply the appropriate formatting/coloring.\n * (@see {@link CodeSnippetFormatter})\n *\n * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.\n *\n * @returns a string containing the final, formatted code snippet.\n */\nexport function makeCodeSnippet(\n colors: boolean,\n callback: CodeSnippetFormatter,\n): string {\n const unchanged = (txt: string) => (colors ? chalk.grey(txt) : txt);\n const plus = (txt: string) => (colors ? chalk.greenBright(txt) : txt);\n const minus = (txt: string) => (colors ? chalk.redBright(txt) : txt);\n\n return callback(unchanged, plus, minus);\n}\n\n/**\n * Creates a new config file with the given @param filepath and @param codeSnippet.\n *\n * Use this function to create a new config file for users. This is useful\n * when users answered that they don't yet have a config file for a tool.\n *\n * (This doesn't mean that they don't yet have some other way of configuring\n * their tool but we can leave it up to them to figure out how to merge configs\n * here.)\n *\n * @param filepath absolute path to the new config file\n * @param codeSnippet the snippet to be inserted into the file\n * @param moreInformation (optional) the message to be printed after the file was created\n * For example, this can be a link to more information about configuring the tool.\n *\n * @returns true on success, false otherwise\n */\nexport async function createNewConfigFile(\n filepath: string,\n codeSnippet: string,\n moreInformation?: string,\n): Promise<boolean> {\n if (!path.isAbsolute(filepath)) {\n debug(`createNewConfigFile: filepath is not absolute: ${filepath}`);\n return false;\n }\n\n const prettyFilename = chalk.cyan(path.relative(process.cwd(), filepath));\n\n try {\n await fs.promises.writeFile(filepath, codeSnippet);\n\n clack.log.success(`Added new ${prettyFilename} file.`);\n\n if (moreInformation) {\n clack.log.info(chalk.gray(moreInformation));\n }\n\n return true;\n } catch (e) {\n debug(e);\n clack.log.warn(\n `Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`,\n );\n }\n\n return false;\n}\n\nexport async function askShouldCreateExamplePage(\n customRoute?: string,\n): Promise<boolean> {\n const route = chalk.cyan(customRoute ?? '/sentry-example-page');\n return traceStep('ask-create-example-page', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example page (\"${route}\") to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(\n features: F,\n): Promise<{ [key in F[number]['id']]: boolean }> {\n return traceStep('feature-selection', async () => {\n const selectedFeatures: Record<string, boolean> = {};\n\n for (const feature of features) {\n const selected = await abortIfCancelled(\n clack.select({\n message: feature.prompt,\n initialValue: true,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: feature.enabledHint,\n },\n {\n value: false,\n label: 'No',\n hint: feature.disabledHint,\n },\n ],\n }),\n );\n\n selectedFeatures[feature.id] = selected;\n }\n\n return selectedFeatures as { [key in F[number]['id']]: boolean };\n });\n}\n"]}
1
+ {"version":3,"file":"clack-utils.js","sourceRoot":"","sources":["../../../src/utils/clack-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,gDAA0B;AAC1B,0DAA8C;AAC9C,qCAAyB;AACzB,yCAA6B;AAC7B,qCAAyB;AACzB,iCAAqC;AACrC,2BAA0B;AAC1B,mDAAuC;AACvC,+CAAqE;AAErE,0CAAyC;AACzC,qDAI2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAKc,CAAC;AAE3B,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AACjD,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,IAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC,IAAM,gBAAgB,GAAG,0BAA0B,CAAC;AA+BvC,QAAA,gBAAgB,GAAmB;IAC9C,QAAQ,EAAE,0BAAkB;IAC5B,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,IAAI;IACf,yBAAyB,EAAE,UAAU,QAAgB;QACnD,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,YAAY,EAAE,UAAU,SAAiB;QACvC,OAAO,wBAAiB,SAAS,CAAE,CAAC;IACtC,CAAC;IACD,6BAA6B,EAAE,UAAU,QAAgB;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AAM;wCACvB,YAAY,EAAE,IAAI;wCAClB,OAAO,EAAE;4CACP;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,OAAO,CAAC,WAAW;6CAC1B;4CACD;gDACE,KAAK,EAAE,KAAK;gDACZ,KAAK,EAAE,IAAI;gDACX,IAAI,EAAE,OAAO,CAAC,YAAY;6CAC3B;yCACF;qCACF,CAAC,CACH,EAAA;;gCAjBK,QAAQ,GAAG,SAiBhB;gCAED,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;;;gCApBpB,IAAQ,CAAA;;oCAuB9B,sBAAO,gBAAyD,EAAC;;;qBAClE,CAAC,EAAC;;;CACJ;AA/BD,wDA+BC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport axios from 'axios';\nimport chalk from 'chalk';\nimport * as childProcess from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { setInterval } from 'timers';\nimport { URL } from 'url';\nimport * as Sentry from '@sentry/node';\nimport { hasPackageInstalled, PackageDotJson } from './package-json';\nimport { Feature, SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\n options?: {\n wait?: boolean;\n },\n) => Promise<childProcess.ChildProcess>;\n\nexport const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';\nexport const SENTRY_CLI_RC_FILE = '.sentryclirc';\nexport const SENTRY_PROPERTIES_FILE = 'sentry.properties';\n\nconst SAAS_URL = 'https://sentry.io/';\n\nconst DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';\n\ninterface WizardProjectData {\n apiKeys?: {\n token?: string;\n };\n projects?: SentryProjectData[];\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport const rcCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_CLI_RC_FILE,\n name: 'source maps',\n gitignore: true,\n likelyAlreadyHasAuthToken: function (contents: string): boolean {\n return !!(contents.includes('[auth]') && contents.match(/token=./g));\n },\n tokenContent: function (authToken: string): string {\n return `[auth]\\ntoken=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject: function (contents: string): boolean {\n return !!(\n contents.includes('[defaults]') &&\n contents.match(/org=./g) &&\n contents.match(/project=./g)\n );\n },\n orgAndProjContent: function (org: string, project: string): string {\n return `[defaults]\\norg=${org}\\nproject=${project}`;\n },\n};\n\nexport const propertiesCliSetupConfig: Required<CliSetupConfig> = {\n filename: SENTRY_PROPERTIES_FILE,\n gitignore: true,\n name: 'debug files',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n likelyAlreadyHasUrl(contents: string): boolean {\n return !!contents.match(/defaults\\.url=./g);\n },\n urlContent(url: string): string {\n return `defaults.url=${url}`;\n },\n};\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n clack.outro(message ?? 'Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('aborted');\n sentryTransaction?.finish();\n const sentrySession = sentryHub.getScope().getSession();\n if (sentrySession) {\n sentrySession.status = status === 0 ? 'abnormal' : 'crashed';\n sentryHub.captureSession(true);\n }\n await Sentry.flush(3000);\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n): Promise<Exclude<T, symbol>> {\n if (clack.isCancel(await input)) {\n clack.cancel('Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('cancelled');\n sentryTransaction?.finish();\n sentryHub.captureSession(true);\n await Sentry.flush(3000);\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: {\n wizardName: string;\n promoCode?: string;\n message?: string;\n telemetryEnabled?: boolean;\n}): void {\n let wizardPackage: { version?: string } = {};\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n } catch {\n // We don't need to have this\n }\n\n // eslint-disable-next-line no-console\n console.log('');\n clack.intro(chalk.inverse(` ${options.wizardName} `));\n\n let welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up Sentry for your application.\\nThank you for using Sentry :)`;\n\n if (options.promoCode) {\n welcomeText = `${welcomeText}\\n\\nUsing promo-code: ${options.promoCode}`;\n }\n\n if (wizardPackage.version) {\n welcomeText = `${welcomeText}\\n\\nVersion: ${wizardPackage.version}`;\n }\n\n if (options.telemetryEnabled) {\n welcomeText = `${welcomeText}\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ${chalk.cyanBright(\n 'sentry-wizard --disable-telemetry',\n )}.`;\n }\n\n clack.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n const continueWithoutGit = await abortIfCancelled(\n clack.confirm({\n message:\n 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n clack.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe wizard will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport function isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1')\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askToInstallSentryCLI(): Promise<boolean> {\n return await abortIfCancelled(\n clack.confirm({\n message:\n \"You don't have Sentry CLI installed. Do you want to install it?\",\n }),\n );\n}\n\nexport async function askForItemSelection(\n items: string[],\n message: string,\n): Promise<{ value: string; index: number }> {\n const selection: { value: string; index: number } | symbol =\n await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection;\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n clack.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n clack.note(\n note ??\n `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`,\n );\n const continueWithUnsupportedVersion = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n Sentry.setTag(\n `${packageName.toLowerCase()}-continue-with-unsupported-version`,\n continueWithUnsupportedVersion,\n );\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n packageNameDisplayLabel,\n}: {\n /** The string that is passed to the package manager CLI as identifier to install (e.g. `@sentry/nextjs`, or `@sentry/nextjs@^8`) */\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n /** Overrides what is shown in the installation logs in place of the `packageName` option. Useful if the `packageName` is ugly (e.g. `@sentry/nextjs@^8`) */\n packageNameDisplayLabel?: string;\n}): Promise<{ packageManager?: PackageManager }> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n clack.confirm({\n message: `The ${chalk.bold.cyan(\n packageNameDisplayLabel ?? packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return {};\n }\n }\n\n const sdkInstallSpinner = clack.spinner();\n\n const packageManager = await getPackageManager();\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageNameDisplayLabel ?? packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `${packageManager.installCommand} ${packageName} ${packageManager.flags}`,\n (err, stdout, stderr) => {\n if (err) {\n // Write a log file so we can better troubleshoot issues\n fs.writeFileSync(\n path.join(\n process.cwd(),\n `sentry-wizard-installation-error-${Date.now()}.log`,\n ),\n JSON.stringify({\n stdout,\n stderr,\n }),\n { encoding: 'utf8' },\n );\n\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n \"The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\\nhttps://github.com/getsentry/sentry-wizard/issues\",\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageNameDisplayLabel ?? packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n return { packageManager };\n });\n}\n\nexport async function addSentryCliConfig(\n { authToken, org, project, url }: CliSetupConfigContent,\n setupConfig: CliSetupConfig = rcCliSetupConfig,\n): Promise<void> {\n return traceStep('add-sentry-cli-config', async () => {\n const configPath = path.join(process.cwd(), setupConfig.filename);\n const configExists = fs.existsSync(configPath);\n\n let configContents =\n (configExists && fs.readFileSync(configPath, 'utf8')) || '';\n configContents = addAuthTokenToSentryConfig(\n configContents,\n authToken,\n setupConfig,\n );\n configContents = addOrgAndProjectToSentryConfig(\n configContents,\n org,\n project,\n setupConfig,\n );\n configContents = addUrlToSentryConfig(configContents, url, setupConfig);\n\n try {\n await fs.promises.writeFile(configPath, configContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `${configExists ? 'Saved' : 'Created'} ${chalk.cyan(\n setupConfig.filename,\n )}.`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.cyan(\n setupConfig.filename,\n )}. Uploading ${\n setupConfig.name\n } during build will likely not work locally.`,\n );\n }\n\n if (setupConfig.gitignore) {\n await addCliConfigFileToGitIgnore(setupConfig.filename);\n } else {\n clack.log.warn(\n chalk.yellow('DO NOT commit auth token to your repository!'),\n );\n }\n });\n}\n\nfunction addAuthTokenToSentryConfig(\n configContents: string,\n authToken: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!authToken) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has auth token. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.tokenContent(\n authToken,\n )}\\n`;\n clack.log.success(\n `Added auth token to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addOrgAndProjectToSentryConfig(\n configContents: string,\n org: string | undefined,\n project: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!org || !project) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has org and project. Will not add them.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.orgAndProjContent(\n org,\n project,\n )}\\n`;\n clack.log.success(\n `Added default org and project to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addUrlToSentryConfig(\n configContents: string,\n url: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!url || !setupConfig.urlContent || !setupConfig.likelyAlreadyHasUrl) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasUrl(configContents)) {\n clack.log.warn(\n `${chalk.cyan(setupConfig.filename)} already has url. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.urlContent(url)}\\n`;\n clack.log.success(\n `Added default url to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nexport async function addDotEnvSentryBuildPluginFile(\n authToken: string,\n): Promise<void> {\n const envVarContent = `# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own \\`.env\\` files and remove this file.\nSENTRY_AUTH_TOKEN=${authToken}\n`;\n\n const dotEnvFilePath = path.join(process.cwd(), SENTRY_DOT_ENV_FILE);\n const dotEnvFileExists = fs.existsSync(dotEnvFilePath);\n\n if (dotEnvFileExists) {\n const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');\n\n const hasAuthToken = !!dotEnvFileContent.match(\n /^\\s*SENTRY_AUTH_TOKEN\\s*=/g,\n );\n\n if (hasAuthToken) {\n clack.log.warn(\n `${chalk.bold.cyan(\n SENTRY_DOT_ENV_FILE,\n )} already has auth token. Will not add one.`,\n );\n } else {\n try {\n await fs.promises.writeFile(\n dotEnvFilePath,\n `${dotEnvFileContent}\\n${envVarContent}`,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added auth token to ${chalk.bold.cyan(SENTRY_DOT_ENV_FILE)}`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.bold.cyan(\n SENTRY_DOT_ENV_FILE,\n )}. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n } else {\n try {\n await fs.promises.writeFile(dotEnvFilePath, envVarContent, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `Created ${chalk.bold.cyan(\n SENTRY_DOT_ENV_FILE,\n )} with auth token for you to test source map uploading locally.`,\n );\n } catch {\n clack.log.warning(\n `Failed to create ${chalk.bold.cyan(\n SENTRY_DOT_ENV_FILE,\n )} with auth token. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n\n await addCliConfigFileToGitIgnore(SENTRY_DOT_ENV_FILE);\n}\n\nasync function addCliConfigFileToGitIgnore(filename: string): Promise<void> {\n const gitignorePath = path.join(process.cwd(), '.gitignore');\n\n try {\n const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');\n if (gitignoreContent.split(/\\r?\\n/).includes(filename)) {\n clack.log.info(\n `${chalk.bold('.gitignore')} already has ${chalk.bold(\n filename,\n )}. Will not add it again.`,\n );\n return;\n }\n\n await fs.promises.appendFile(\n gitignorePath,\n `\\n# Sentry Config File\\n${filename}\\n`,\n { encoding: 'utf8' },\n );\n clack.log.success(\n `Added ${chalk.cyan(filename)} to ${chalk.cyan('.gitignore')}.`,\n );\n } catch {\n clack.log.error(\n `Failed adding ${chalk.cyan(filename)} to ${chalk.cyan(\n '.gitignore',\n )}. Please add it manually!`,\n );\n }\n}\n\nexport async function runPrettierIfInstalled(): Promise<void> {\n return traceStep('run-prettier', async () => {\n if (!isInGitRepo()) {\n // We only run formatting on changed files. If we're not in a git repo, we can't find\n // changed files. So let's early-return without showing any formatting-related messages.\n return;\n }\n\n const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()\n .map((filename) => {\n return filename.startsWith('- ') ? filename.slice(2) : filename;\n })\n .join(' ');\n\n if (!changedOrUntrackedFiles.length) {\n // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.\n return;\n }\n\n const packageJson = await getPackageDotJson();\n const prettierInstalled = hasPackageInstalled('prettier', packageJson);\n\n Sentry.setTag('prettier-installed', prettierInstalled);\n\n if (!prettierInstalled) {\n return;\n }\n\n // prompt the user if they want to run prettier\n const shouldRunPrettier = await abortIfCancelled(\n clack.confirm({\n message:\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n }),\n );\n\n if (!shouldRunPrettier) {\n return;\n }\n\n const prettierSpinner = clack.spinner();\n prettierSpinner.start('Running Prettier on your files.');\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`,\n (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n prettierSpinner.stop('Prettier failed to run.');\n clack.log.warn(\n 'Prettier failed to run. There may be formatting issues in your updated files.',\n );\n return;\n }\n\n prettierSpinner.stop('Prettier has formatted your files.');\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);\n const continueWithoutPackage = await abortIfCancelled(\n clack.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson(): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises\n .readFile(path.join(process.cwd(), 'package.json'), 'utf8')\n .catch(() => {\n clack.log.error(\n 'Could not find package.json. Make sure to run the wizard in the root of your app!',\n );\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'package.json',\n )}. Make sure it has a valid format!`,\n );\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function getPackageManager(): Promise<PackageManager> {\n const detectedPackageManager = detectPackageManger();\n\n if (detectedPackageManager) {\n return detectedPackageManager;\n }\n\n const selectedPackageManager: PackageManager | symbol =\n await abortIfCancelled(\n clack.select({\n message: 'Please select your package manager.',\n options: packageManagers.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n Sentry.setTag('package-manager', selectedPackageManager.name);\n\n return selectedPackageManager;\n}\n\nexport function isUsingTypeScript() {\n try {\n return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if we already got project data from a previous wizard invocation.\n * If yes, this data is returned.\n * Otherwise, we start the login flow and ask the user to select a project.\n *\n * Use this function to get project data for the wizard.\n *\n * @param options wizard options\n * @param platform the platform of the wizard\n * @returns project data (org, project, token, url)\n */\nexport async function getOrAskForProjectData(\n options: WizardOptions,\n platform?:\n | 'javascript-nextjs'\n | 'javascript-nuxt'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native',\n): Promise<{\n sentryUrl: string;\n selfHosted: boolean;\n selectedProject: SentryProjectData;\n authToken: string;\n}> {\n if (options.preSelectedProject) {\n return {\n selfHosted: options.preSelectedProject.selfHosted,\n sentryUrl: options.url ?? SAAS_URL,\n authToken: options.preSelectedProject.authToken,\n selectedProject: options.preSelectedProject.project,\n };\n }\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url, options.saas),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\n orgSlug: options.orgSlug,\n projectSlug: options.projectSlug,\n }),\n );\n\n if (!projects || !projects.length) {\n clack.log.error(\n 'No projects found. Please create a project in Sentry and try again.',\n );\n Sentry.setTag('no-projects-found', true);\n await abort();\n // This rejection won't return due to the abort call but TS doesn't know that\n return Promise.reject();\n }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects, options.orgSlug, options.projectSlug),\n );\n\n const { token } = apiKeys ?? {};\n\n if (!token) {\n clack.log.error(`Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n${chalk.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);\n\n clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk.cyan(\n `\"${DUMMY_AUTH_TOKEN}\"`,\n )}) for you to replace later.\nCreate your auth token here:\n${chalk.cyan(\n selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`\n : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`,\n)}`);\n }\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,\n selectedProject,\n };\n}\n\n/**\n * Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.\n *\n * If users started the wizard with a --url arg, that URL is used as the default and we skip\n * the self-hosted question. However, the passed url is still validated and in case it's\n * invalid, users are asked to enter a new one until it is valid.\n *\n * @param urlFromArgs the url passed via the --url arg\n */\nasync function askForSelfHosted(\n urlFromArgs?: string,\n saas?: boolean,\n): Promise<{\n url: string;\n selfHosted: boolean;\n}> {\n if (saas) {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n\n if (!urlFromArgs) {\n const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(\n clack.select({\n message: 'Are you using Sentry SaaS or self-hosted Sentry?',\n options: [\n { value: 'saas', label: 'Sentry SaaS (sentry.io)' },\n {\n value: 'self-hosted',\n label: 'Self-hosted/on-premise/single-tenant',\n },\n ],\n }),\n );\n\n if (choice === 'saas') {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n }\n\n let validUrl: string | undefined;\n let tmpUrlFromArgs = urlFromArgs;\n\n while (validUrl === undefined) {\n const url =\n tmpUrlFromArgs ||\n (await abortIfCancelled(\n clack.text({\n message: `Please enter the URL of your ${\n urlFromArgs ? '' : 'self-hosted '\n }Sentry instance.`,\n placeholder: 'https://sentry.io/',\n }),\n ));\n tmpUrlFromArgs = undefined;\n\n try {\n validUrl = new URL(url).toString();\n\n // We assume everywhere else that the URL ends in a slash\n if (!validUrl.endsWith('/')) {\n validUrl += '/';\n }\n } catch {\n clack.log.error(\n `Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ${url})`,\n );\n }\n }\n\n const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;\n\n Sentry.setTag('url', validUrl);\n Sentry.setTag('self-hosted', isSelfHostedUrl);\n\n return { url: validUrl, selfHosted: true };\n}\n\nasync function askForWizardLogin(options: {\n url: string;\n promoCode?: string;\n platform?:\n | 'javascript-nextjs'\n | 'javascript-nuxt'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native';\n orgSlug?: string;\n projectSlug?: string;\n}): Promise<WizardProjectData> {\n Sentry.setTag('has-promo-code', !!options.promoCode);\n\n let hasSentryAccount = await clack.confirm({\n message: 'Do you already have a Sentry account?',\n });\n\n hasSentryAccount = await abortIfCancelled(hasSentryAccount);\n\n Sentry.setTag('already-has-sentry-account', hasSentryAccount);\n\n let wizardHash: string;\n try {\n wizardHash = (\n await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)\n ).data.hash;\n } catch (e: unknown) {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please check your configuration and try again.\\n\\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n } else {\n clack.log.error('Loading Wizard failed.');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n }\n }\n\n const loginUrl = new URL(\n `${options.url}account/settings/wizard/${wizardHash!}/`,\n );\n\n if (options.orgSlug) {\n loginUrl.searchParams.set('org_slug', options.orgSlug);\n }\n\n if (options.projectSlug) {\n loginUrl.searchParams.set('project_slug', options.projectSlug);\n }\n\n if (!hasSentryAccount) {\n loginUrl.searchParams.set('signup', '1');\n if (options.platform) {\n loginUrl.searchParams.set('project_platform', options.platform);\n }\n }\n\n if (options.promoCode) {\n loginUrl.searchParams.set('code', options.promoCode);\n }\n\n const urlToOpen = loginUrl.toString();\n clack.log.info(\n `${chalk.bold(\n `If the browser window didn't open automatically, please open the following link to ${\n hasSentryAccount ? 'log' : 'sign'\n } into Sentry:`,\n )}\\n\\n${chalk.cyan(urlToOpen)}`,\n );\n\n opn(urlToOpen, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n\n const loginSpinner = clack.spinner();\n\n loginSpinner.start('Waiting for you to log in using the link above');\n\n const data = await new Promise<WizardProjectData>((resolve) => {\n const pollingInterval = setInterval(() => {\n axios\n .get<WizardProjectData>(`${options.url}api/0/wizard/${wizardHash}/`, {\n headers: {\n 'Accept-Encoding': 'deflate',\n },\n })\n .then((result) => {\n resolve(result.data);\n clearTimeout(timeout);\n clearInterval(pollingInterval);\n void axios.delete(`${options.url}api/0/wizard/${wizardHash}/`);\n })\n .catch(() => {\n // noop - just try again\n });\n }, 500);\n\n const timeout = setTimeout(() => {\n clearInterval(pollingInterval);\n loginSpinner.stop(\n 'Login timed out. No worries - it happens to the best of us.',\n );\n\n Sentry.setTag('opened-wizard-link', false);\n void abort('Please restart the Wizard and log in to complete the setup.');\n }, 180_000);\n });\n\n loginSpinner.stop('Login complete.');\n Sentry.setTag('opened-wizard-link', true);\n\n return data;\n}\n\nasync function askForProjectSelection(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n\n const filteredProjects = filterProjectsBySlugs(\n projects,\n orgSlug,\n projectSlug,\n );\n\n if (filteredProjects.length === 1) {\n const selection = filteredProjects[0];\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n clack.log.step(`Selected project ${label(selection)}`);\n\n return selection;\n }\n\n if (filteredProjects.length === 0) {\n clack.log.warn('Could not find a project with the provided slugs.');\n }\n\n const sortedProjects = filteredProjects.length ? filteredProjects : projects;\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\n });\n\n const selection: SentryProjectData | symbol = await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: 'Select your Sentry project.',\n options: sortedProjects.map((project) => {\n return {\n value: project,\n label: label(project),\n };\n }),\n }),\n );\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n\n return selection;\n}\n\nfunction filterProjectsBySlugs(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): SentryProjectData[] {\n if (!orgSlug && !projectSlug) {\n return projects;\n }\n if (orgSlug && !projectSlug) {\n return projects.filter((p) => p.organization.slug === orgSlug);\n }\n if (!orgSlug && projectSlug) {\n return projects.filter((p) => p.slug === projectSlug);\n }\n\n return projects.filter(\n (p) => p.organization.slug === orgSlug && p.slug === projectSlug,\n );\n}\n\n/**\n * Asks users if they have a config file for @param tool (e.g. Vite).\n * If yes, asks users to specify the path to their config file.\n *\n * Use this helper function as a fallback mechanism if the lookup for\n * a config file with its most usual location/name fails.\n *\n * @param toolName Name of the tool for which we're looking for the config file\n * @param configFileName Name of the most common config file name (e.g. vite.config.js)\n *\n * @returns a user path to the config file or undefined if the user doesn't have a config file\n */\nexport async function askForToolConfigPath(\n toolName: string,\n configFileName: string,\n): Promise<string | undefined> {\n const hasConfig = await abortIfCancelled(\n clack.confirm({\n message: `Do you have a ${toolName} config file (e.g. ${chalk.cyan(\n configFileName,\n )})?`,\n initialValue: true,\n }),\n );\n\n if (!hasConfig) {\n return undefined;\n }\n\n return await abortIfCancelled(\n clack.text({\n message: `Please enter the path to your ${toolName} config file:`,\n placeholder: path.join('.', configFileName),\n validate: (value) => {\n if (!value) {\n return 'Please enter a path.';\n }\n\n try {\n fs.accessSync(value);\n } catch {\n return 'Could not access the file at this path.';\n }\n },\n }),\n );\n}\n\n/**\n * Prints copy/paste-able instructions to the console.\n * Afterwards asks the user if they added the code snippet to their file.\n *\n * While there's no point in providing a \"no\" answer here, it gives users time to fulfill the\n * task before the wizard continues with additional steps.\n *\n * Use this function if you want to show users instructions on how to add/modify\n * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.\n *\n * @param filename the name of the file to which the code snippet should be applied.\n * If a path is provided, only the filename will be used.\n *\n * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the\n * diff-like format for visually highlighting unchanged or modified lines of code.\n *\n * @param hint (optional) a hint to be printed after the main instruction to add\n * the code from @param codeSnippet to their @param filename.\n *\n * More guidelines on copy/paste instructions:\n * @see {@link https://develop.sentry.dev/sdk/setup-wizards/#copy--paste-snippets}\n *\n * TODO: refactor copy paste instructions across different wizards to use this function.\n * this might require adding a custom message parameter to the function\n */\nexport async function showCopyPasteInstructions(\n filename: string,\n codeSnippet: string,\n hint?: string,\n): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.cyan(\n path.basename(filename),\n )} file:${hint ? chalk.dim(` (${chalk.dim(hint)})`) : ''}`,\n );\n\n // Padding the code snippet to be printed with a \\n at the beginning and end\n // This makes it easier to distinguish the snippet from the rest of the output\n // Intentionally logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(`\\n${codeSnippet}\\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you apply the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\n/**\n * Callback that exposes formatting helpers for a code snippet.\n * @param unchanged - Formats text as old code.\n * @param plus - Formats text as new code.\n * @param minus - Formats text as removed code.\n */\ntype CodeSnippetFormatter = (\n unchanged: (txt: string) => string,\n plus: (txt: string) => string,\n minus: (txt: string) => string,\n) => string;\n\n/**\n * Crafts a code snippet that can be used to e.g.\n * - print copy/paste instructions to the console\n * - create a new config file.\n *\n * @param colors set this to true if you want the final snippet to be colored.\n * This is useful for printing the snippet to the console as part of copy/paste instructions.\n *\n * @param callback the callback that returns the formatted code snippet.\n * It exposes takes the helper functions for marking code as unchanged, new or removed.\n * These functions no-op if no special formatting should be applied\n * and otherwise apply the appropriate formatting/coloring.\n * (@see {@link CodeSnippetFormatter})\n *\n * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.\n *\n * @returns a string containing the final, formatted code snippet.\n */\nexport function makeCodeSnippet(\n colors: boolean,\n callback: CodeSnippetFormatter,\n): string {\n const unchanged = (txt: string) => (colors ? chalk.grey(txt) : txt);\n const plus = (txt: string) => (colors ? chalk.greenBright(txt) : txt);\n const minus = (txt: string) => (colors ? chalk.redBright(txt) : txt);\n\n return callback(unchanged, plus, minus);\n}\n\n/**\n * Creates a new config file with the given @param filepath and @param codeSnippet.\n *\n * Use this function to create a new config file for users. This is useful\n * when users answered that they don't yet have a config file for a tool.\n *\n * (This doesn't mean that they don't yet have some other way of configuring\n * their tool but we can leave it up to them to figure out how to merge configs\n * here.)\n *\n * @param filepath absolute path to the new config file\n * @param codeSnippet the snippet to be inserted into the file\n * @param moreInformation (optional) the message to be printed after the file was created\n * For example, this can be a link to more information about configuring the tool.\n *\n * @returns true on success, false otherwise\n */\nexport async function createNewConfigFile(\n filepath: string,\n codeSnippet: string,\n moreInformation?: string,\n): Promise<boolean> {\n if (!path.isAbsolute(filepath)) {\n debug(`createNewConfigFile: filepath is not absolute: ${filepath}`);\n return false;\n }\n\n const prettyFilename = chalk.cyan(path.relative(process.cwd(), filepath));\n\n try {\n await fs.promises.writeFile(filepath, codeSnippet);\n\n clack.log.success(`Added new ${prettyFilename} file.`);\n\n if (moreInformation) {\n clack.log.info(chalk.gray(moreInformation));\n }\n\n return true;\n } catch (e) {\n debug(e);\n clack.log.warn(\n `Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`,\n );\n }\n\n return false;\n}\n\nexport async function askShouldCreateExamplePage(\n customRoute?: string,\n): Promise<boolean> {\n const route = chalk.cyan(customRoute ?? '/sentry-example-page');\n return traceStep('ask-create-example-page', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example page (\"${route}\") to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function askShouldCreateExampleComponent(): Promise<boolean> {\n return traceStep('ask-create-example-component', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example component to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(\n features: F,\n): Promise<{ [key in F[number]['id']]: boolean }> {\n return traceStep('feature-selection', async () => {\n const selectedFeatures: Record<string, boolean> = {};\n\n for (const feature of features) {\n const selected = await abortIfCancelled(\n clack.select({\n message: feature.prompt,\n initialValue: true,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: feature.enabledHint,\n },\n {\n value: false,\n label: 'No',\n hint: feature.disabledHint,\n },\n ],\n }),\n );\n\n selectedFeatures[feature.id] = selected;\n }\n\n return selectedFeatures as { [key in F[number]['id']]: boolean };\n });\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var templates_1 = require("../../src/nuxt/templates");
4
+ describe('Nuxt code templates', function () {
5
+ describe('getDefaultNuxtConfig', function () {
6
+ it('returns a default nuxt config', function () {
7
+ expect((0, templates_1.getDefaultNuxtConfig)()).toMatchInlineSnapshot("\n \"// https://nuxt.com/docs/api/configuration/nuxt-config\n export default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n })\n \"\n");
8
+ });
9
+ });
10
+ describe('getSentryConfigContents', function () {
11
+ describe('client config', function () {
12
+ it('generates Sentry config with all features enabled', function () {
13
+ var template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
14
+ performance: true,
15
+ replay: true,
16
+ });
17
+ expect(template).toMatchInlineSnapshot("\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n ");
18
+ });
19
+ it('generates Sentry config with performance monitoring disabled', function () {
20
+ var template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
21
+ performance: false,
22
+ replay: true,
23
+ });
24
+ expect(template).toMatchInlineSnapshot("\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n ");
25
+ });
26
+ it('generates Sentry config with session replay disabled', function () {
27
+ var template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
28
+ performance: true,
29
+ replay: false,
30
+ });
31
+ expect(template).toMatchInlineSnapshot("\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n ");
32
+ });
33
+ it('generates Sentry config with performance monitoring and session replay disabled', function () {
34
+ var template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
35
+ performance: false,
36
+ replay: false,
37
+ });
38
+ expect(template).toMatchInlineSnapshot("\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n ");
39
+ });
40
+ });
41
+ describe('server config', function () {
42
+ it('generates Sentry config with all features enabled', function () {
43
+ var template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
44
+ performance: true,
45
+ replay: true,
46
+ });
47
+ expect(template).toMatchInlineSnapshot("\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n ");
48
+ });
49
+ it('generates Sentry config with performance monitoring disabled', function () {
50
+ var template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
51
+ performance: false,
52
+ replay: true,
53
+ });
54
+ expect(template).toMatchInlineSnapshot("\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n ");
55
+ });
56
+ });
57
+ });
58
+ describe('getNuxtModuleFallbackTemplate', function () {
59
+ it('generates configuration options for the nuxt config', function () {
60
+ var template = (0, templates_1.getNuxtModuleFallbackTemplate)({
61
+ org: 'my-org',
62
+ project: 'my-project',
63
+ url: 'https://sentry.io',
64
+ selfHosted: false,
65
+ });
66
+ expect(template).toMatchInlineSnapshot("\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"my-org\",\n project: \"my-project\",\n },\n },\n sourcemap: { client: \"hidden\" },\"\n ");
67
+ });
68
+ });
69
+ });
70
+ //# sourceMappingURL=templates.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nuxt/templates.test.ts"],"names":[],"mappings":";;AAAA,sDAIkC;AAElC,QAAQ,CAAC,qBAAqB,EAAE;IAC9B,QAAQ,CAAC,sBAAsB,EAAE;QAC/B,EAAE,CAAC,+BAA+B,EAAE;YAClC,MAAM,CAAC,IAAA,gCAAoB,GAAE,CAAC,CAAC,qBAAqB,CAAC,gNAO1D,CAAC,CAAC;QACC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,yBAAyB,EAAE;QAClC,QAAQ,CAAC,eAAe,EAAE;YACxB,EAAE,CAAC,mDAAmD,EAAE;gBACtD,IAAM,QAAQ,GAAG,IAAA,mCAAuB,EACtC,uBAAuB,EACvB,QAAQ,EACR;oBACE,WAAW,EAAE,IAAI;oBACjB,M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AC,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,8DAA8D,EAAE;gBACjE,IAAM,QAAQ,GAAG,IAAA,mCAAuB,EACtC,uBAAuB,EACvB,QAAQ,EACR;oBACE,WAAW,EAAE,KAAK;oBAClB,MAAM,EAAE,IAAI;iBACb,CACF,CAAC;gBAEF,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,mVAUxC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,+BAA+B,EAAE;QACxC,EAAE,CAAC,qDAAqD,EAAE;YACxD,IAAM,QAAQ,GAAG,IAAA,yCAA6B,EAAC;gBAC7C,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,YAAY;gBACrB,GAAG,EAAE,mBAAmB;gBACxB,UAAU,EAAE,KAAK;aAClB,CAAC,CAAC;YAEH,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,8QAStC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from '../../src/nuxt/templates';\n\ndescribe('Nuxt code templates', () => {\n describe('getDefaultNuxtConfig', () => {\n it('returns a default nuxt config', () => {\n expect(getDefaultNuxtConfig()).toMatchInlineSnapshot(`\n \"// https://nuxt.com/docs/api/configuration/nuxt-config\n export default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n })\n \"\n`);\n });\n });\n\n describe('getSentryConfigContents', () => {\n describe('client config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring and session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('server config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getNuxtModuleFallbackTemplate', () => {\n it('generates configuration options for the nuxt config', () => {\n const template = getNuxtModuleFallbackTemplate({\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"my-org\",\n project: \"my-project\",\n },\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n });\n});\n"]}
@@ -0,0 +1,59 @@
1
+ # End-to-end Tests for Sentry Wizard
2
+
3
+ ## Structure
4
+
5
+ ```
6
+ test-applications/
7
+ |---- nextjs-test-app/
8
+ |---- remix-test-app/
9
+ |---- sveltekit-test-app/
10
+ tests/
11
+ |---- nextjs.test.ts
12
+ |---- remix.test.ts
13
+ |---- sveltekit.test.ts
14
+ ```
15
+
16
+ ### Utilities
17
+
18
+ `utils/` contains helpers such as the wizard runner, assertion tools and file modifiers that can be used in (`*.test.ts`).
19
+
20
+ #### Helpers
21
+
22
+ - `startWizardInstance` - Starts a new instance of `WizardTestEnv`.
23
+
24
+ - `initGit` - Initializes a temporary git repository in the test project.
25
+ - `cleanupGit` - Cleans up the temporary git repository in the test project.
26
+ - `revertLocalChanges` - Reverts local changes (git tracked or untracked) in the test project.
27
+
28
+ - `createFile` - Creates a file (optionally with content) in the test project.
29
+ - `modifyFile` - Modifies a file in the test project.
30
+
31
+ - `checkFileExists` - Checks if a file exists in the test project.
32
+ - `checkPackageJson` - Checks if the `@sentry/[integration]` package exists in the dependencies of the test project's `package.json`.
33
+ - `checkSentryCliConfig` - Checks if the `.sentryclirc` file contains the Sentry auth token.
34
+ - `checkEnvBuildPlugin` - Cheks if `.env.sentry-build-plugin` contains the Sentry auth token.
35
+
36
+ - `checkIfBuilds` - Checks if the test project builds successfully.
37
+ - `checkIfRunsOnDevMode` - Checks if the test project runs on dev mode successfully.
38
+ - `checkIfRunsOnProdMode` - Checks if the test project runs on prod mode successfully.
39
+
40
+
41
+ #### `WizardTestEnv`
42
+
43
+ `WizardTestEnv` is a class that can be used to run the Sentry Wizard in a test environment. It provides methods to run the wizard with specific arguments and stdio.
44
+
45
+ ## Running Tests Locally
46
+
47
+ First, you need to create a `.env` file set the environment variables from the `.env.example` file in the root of the project.
48
+
49
+ Tests can be run locally from the root of the project with:
50
+
51
+ `yarn test:e2e`
52
+
53
+ To run a specific test application
54
+
55
+ `yarn test:e2e [Remix | NextJS | SvelteKit]`
56
+
57
+ ## Writing Tests
58
+
59
+ Each test file should contain a single test suite that tests the Sentry Wizard for a specific framework. The test suite should contain a `beforeAll` and `afterAll` function that starts and stops the test application respectively.
@@ -0,0 +1,75 @@
1
+ # Nuxt Minimal Starter
2
+
3
+ Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4
+
5
+ ## Setup
6
+
7
+ Make sure to install dependencies:
8
+
9
+ ```bash
10
+ # npm
11
+ npm install
12
+
13
+ # pnpm
14
+ pnpm install
15
+
16
+ # yarn
17
+ yarn install
18
+
19
+ # bun
20
+ bun install
21
+ ```
22
+
23
+ ## Development Server
24
+
25
+ Start the development server on `http://localhost:3000`:
26
+
27
+ ```bash
28
+ # npm
29
+ npm run dev
30
+
31
+ # pnpm
32
+ pnpm dev
33
+
34
+ # yarn
35
+ yarn dev
36
+
37
+ # bun
38
+ bun run dev
39
+ ```
40
+
41
+ ## Production
42
+
43
+ Build the application for production:
44
+
45
+ ```bash
46
+ # npm
47
+ npm run build
48
+
49
+ # pnpm
50
+ pnpm build
51
+
52
+ # yarn
53
+ yarn build
54
+
55
+ # bun
56
+ bun run build
57
+ ```
58
+
59
+ Locally preview production build:
60
+
61
+ ```bash
62
+ # npm
63
+ npm run preview
64
+
65
+ # pnpm
66
+ pnpm preview
67
+
68
+ # yarn
69
+ yarn preview
70
+
71
+ # bun
72
+ bun run preview
73
+ ```
74
+
75
+ Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
@@ -0,0 +1,5 @@
1
+ // https://nuxt.com/docs/api/configuration/nuxt-config
2
+ export default defineNuxtConfig({
3
+ compatibilityDate: '2024-11-01',
4
+ devtools: { enabled: true }
5
+ })