@sentry/wizard 3.7.1 → 3.8.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 (83) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  3. package/dist/lib/Steps/ChooseIntegration.js +12 -26
  4. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  5. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  6. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  7. package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
  8. package/dist/lib/Steps/Integrations/ReactNative.js +2 -2
  9. package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
  10. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +5 -6
  11. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +1 -1
  12. package/dist/package.json +3 -3
  13. package/dist/src/apple/apple-wizard.js +31 -2
  14. package/dist/src/apple/apple-wizard.js.map +1 -1
  15. package/dist/src/apple/cocoapod.d.ts +2 -0
  16. package/dist/src/apple/cocoapod.js +122 -0
  17. package/dist/src/apple/cocoapod.js.map +1 -0
  18. package/dist/src/apple/code-tools.js +22 -12
  19. package/dist/src/apple/code-tools.js.map +1 -1
  20. package/dist/src/apple/fastlane.d.ts +2 -0
  21. package/dist/src/apple/fastlane.js +179 -0
  22. package/dist/src/apple/fastlane.js.map +1 -0
  23. package/dist/src/apple/templates.d.ts +1 -0
  24. package/dist/src/apple/templates.js +7 -3
  25. package/dist/src/apple/templates.js.map +1 -1
  26. package/dist/src/apple/xcode-manager.d.ts +1 -1
  27. package/dist/src/apple/xcode-manager.js +35 -28
  28. package/dist/src/apple/xcode-manager.js.map +1 -1
  29. package/dist/src/nextjs/nextjs-wizard.js +71 -81
  30. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  31. package/dist/src/sourcemaps/sourcemaps-wizard.js +61 -46
  32. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  33. package/dist/src/sourcemaps/tools/nextjs.d.ts +3 -0
  34. package/dist/src/sourcemaps/tools/nextjs.js +135 -0
  35. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -0
  36. package/dist/src/sourcemaps/tools/sentry-cli.js +120 -16
  37. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  38. package/dist/src/sourcemaps/utils/detect-tool.d.ts +1 -1
  39. package/dist/src/sourcemaps/utils/detect-tool.js +1 -0
  40. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  41. package/dist/src/sourcemaps/utils/other-wizards.js +35 -12
  42. package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
  43. package/dist/src/sveltekit/sentry-cli-setup.d.ts +1 -1
  44. package/dist/src/sveltekit/sentry-cli-setup.js.map +1 -1
  45. package/dist/src/sveltekit/sveltekit-wizard.js +14 -8
  46. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  47. package/dist/src/utils/bash.d.ts +2 -1
  48. package/dist/src/utils/bash.js +14 -2
  49. package/dist/src/utils/bash.js.map +1 -1
  50. package/dist/src/utils/clack-utils.d.ts +7 -14
  51. package/dist/src/utils/clack-utils.js +46 -2
  52. package/dist/src/utils/clack-utils.js.map +1 -1
  53. package/dist/src/utils/package-json.d.ts +1 -1
  54. package/dist/src/utils/package-json.js.map +1 -1
  55. package/dist/src/utils/types.d.ts +24 -0
  56. package/dist/src/utils/types.js.map +1 -1
  57. package/lib/Helper/__tests__/MergeConfig.ts +9 -4
  58. package/lib/Steps/ChooseIntegration.ts +13 -3
  59. package/lib/Steps/Integrations/Cordova.ts +3 -3
  60. package/lib/Steps/Integrations/Electron.ts +1 -2
  61. package/lib/Steps/Integrations/MobileProject.ts +1 -1
  62. package/lib/Steps/Integrations/ReactNative.ts +16 -14
  63. package/lib/Steps/Integrations/__tests__/ReactNative.ts +24 -15
  64. package/package-lock.json +2 -2
  65. package/package.json +3 -3
  66. package/src/apple/apple-wizard.ts +35 -3
  67. package/src/apple/cocoapod.ts +57 -0
  68. package/src/apple/code-tools.ts +80 -57
  69. package/src/apple/fastlane.ts +160 -0
  70. package/src/apple/templates.ts +26 -10
  71. package/src/apple/xcode-manager.ts +137 -120
  72. package/src/nextjs/nextjs-wizard.ts +4 -13
  73. package/src/sourcemaps/sourcemaps-wizard.ts +40 -28
  74. package/src/sourcemaps/tools/nextjs.ts +114 -0
  75. package/src/sourcemaps/tools/sentry-cli.ts +134 -8
  76. package/src/sourcemaps/utils/detect-tool.ts +3 -1
  77. package/src/sourcemaps/utils/other-wizards.ts +32 -13
  78. package/src/sveltekit/sentry-cli-setup.ts +1 -1
  79. package/src/sveltekit/sveltekit-wizard.ts +3 -0
  80. package/src/utils/bash.ts +43 -30
  81. package/src/utils/clack-utils.ts +42 -14
  82. package/src/utils/package-json.ts +1 -1
  83. package/src/utils/types.ts +22 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-cli.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/sentry-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AACvC,yCAA6B;AAC7B,qCAAyB;AACzB,uDAKiC;AAGjC,yDAA+E;AAE/E,IAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C,SAAsB,kBAAkB,CACtC,OAAgD,EAChD,gCAA+F;IAA/F,iDAAA,EAAA,0EAA+F;;;;;wBAExE,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAA1C,cAAc,GAAG,SAAyB;oBAEhD,qBAAM,IAAA,4BAAc,EAAC;4BACnB,WAAW,EAAE,aAAa;4BAC1B,gBAAgB,EAAE,IAAA,kCAAmB,EAAC,aAAa,EAAE,cAAc,CAAC;yBACrE,CAAC,EAAA;;oBAHF,SAGE,CAAC;oBA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AAW,cACjB,yBAAyB,CAAE,CAAC;oBAEhC,cAAc,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC;oBACtD,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,kBAAkB,CAAC;oBAE7D,qBAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CACxC,EAAA;;oBAHD,SAGC,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,kBAAW,eAAK,CAAC,IAAI,CAAC,eAAe,CAAC,6BAAmB,eAAK,CAAC,IAAI,CACjE,cAAc,CACf,4CAAkC,eAAK,CAAC,IAAI,CAC3C,OAAO,CACR,4CAAkC,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAa,CACrE,CAAC;;;;;CACH;AAED,SAAe,uCAAuC;;;;wBACpD,qBAAM,IAAA,8BAAgB,EACpB,iBAAK,CAAC,MAAM,CAAC;wBACX,OAAO,EAAE,iEAA0D,eAAK,CAAC,GAAG,CAC1E,uEAAuE,CACxE,CAAE;wBACH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACzD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;oBARD,SAQC,CAAC;;;;;CACH","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport {\n abortIfCancelled,\n addSentryCliRc,\n getPackageDotJson,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport { SourceMapUploadToolConfigurationOptions } from './types';\nimport { hasPackageInstalled, PackageDotJson } from '../../utils/package-json';\n\nconst NPM_SCRIPT_NAME = 'sentry:sourcemaps';\n\nexport async function configureSentryCLI(\n options: SourceMapUploadToolConfigurationOptions,\n configureSourcemapGenerationFlow: () => Promise<void> = defaultConfigureSourcemapGenerationFlow,\n): Promise<void> {\n const packageDotJson = await getPackageDotJson();\n\n await installPackage({\n packageName: '@sentry/cli',\n alreadyInstalled: hasPackageInstalled('@sentry/cli', packageDotJson),\n });\n\n let validPath = false;\n let relativeArtifactPath;\n do {\n const rawArtifactPath = await abortIfCancelled(\n clack.text({\n message: 'Where are your build artifacts located?',\n placeholder: `.${path.sep}out`,\n validate(value) {\n if (!value) {\n return 'Please enter a path.';\n }\n },\n }),\n );\n\n if (path.isAbsolute(rawArtifactPath)) {\n relativeArtifactPath = path.relative(process.cwd(), rawArtifactPath);\n } else {\n relativeArtifactPath = rawArtifactPath;\n }\n\n try {\n await fs.promises.access(path.join(process.cwd(), relativeArtifactPath));\n validPath = true;\n } catch {\n validPath = await abortIfCancelled(\n clack.select({\n message: `We couldn't find artifacts at ${relativeArtifactPath}. Are you sure that this is the location that contains your build artifacts?`,\n options: [\n {\n label: 'No, let me verify.',\n value: false,\n },\n { label: 'Yes, I am sure!', value: true },\n ],\n initialValue: false,\n }),\n );\n }\n } while (!validPath);\n\n const relativePosixArtifactPath = relativeArtifactPath\n .split(path.sep)\n .join(path.posix.sep);\n\n await configureSourcemapGenerationFlow();\n\n await createAndAddNpmScript(\n packageDotJson,\n options,\n relativePosixArtifactPath,\n );\n\n await addSentryCliRc(options.authToken);\n}\n\nexport async function setupNpmScriptInCI(): Promise<void> {\n const addedToCI = await abortIfCancelled(\n clack.select({\n message: `Add a step to your CI pipeline that runs the ${chalk.cyan(\n NPM_SCRIPT_NAME,\n )} script ${chalk.bold('right after')} building your application.`,\n options: [\n { label: 'I did, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to run the command after each build for source maps to work properly.',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-ci-script', addedToCI);\n\n if (!addedToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n}\n\nasync function createAndAddNpmScript(\n packageDotJson: PackageDotJson,\n options: SourceMapUploadToolConfigurationOptions,\n relativePosixArtifactPath: string,\n): Promise<void> {\n const sentryCliNpmScript = `sentry-cli sourcemaps inject --org ${\n options.orgSlug\n } --project ${\n options.projectSlug\n } ${relativePosixArtifactPath} && sentry-cli${\n options.selfHosted ? ` --url ${options.url}` : ''\n } sourcemaps upload --org ${options.orgSlug} --project ${\n options.projectSlug\n } ${relativePosixArtifactPath}`;\n\n packageDotJson.scripts = packageDotJson.scripts || {};\n packageDotJson.scripts[NPM_SCRIPT_NAME] = sentryCliNpmScript;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageDotJson, null, 2),\n );\n\n clack.log.info(\n `Added a ${chalk.cyan(NPM_SCRIPT_NAME)} script to your ${chalk.cyan(\n 'package.json',\n )}. Make sure to run this script ${chalk.bold(\n 'after',\n )} building your application but ${chalk.bold('before')} deploying!`,\n );\n}\n\nasync function defaultConfigureSourcemapGenerationFlow(): Promise<void> {\n await abortIfCancelled(\n clack.select({\n message: `Verify that your build tool is generating source maps. ${chalk.dim(\n '(Your build output folder should contain .js.map files after a build)',\n )}`,\n options: [{ label: 'I checked. Continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n"]}
1
+ {"version":3,"file":"sentry-cli.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/sentry-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AACvC,yCAA6B;AAC7B,qCAAyB;AACzB,uDAMiC;AAGjC,yDAA+E;AAC/E,6CAA4C;AAE5C,IAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD,IAAI,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IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CACxC,EAAA;;oBAHD,SAGC,CAAC;oBAEF,mBAAmB,GAAG,IAAI,CAAC;oBAE3B,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,gBAAS,eAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAAmB,eAAK,CAAC,IAAI,CACtE,YAAY,CACb,cAAW,CACb,CAAC;;;;;CACH;AAED,SAAe,uCAAuC;;;;wBACpD,qBAAM,IAAA,8BAAgB,EACpB,iBAAK,CAAC,MAAM,CAAC;wBACX,OAAO,EAAE,iEAA0D,eAAK,CAAC,GAAG,CAC1E,uEAAuE,CACxE,CAAE;wBACH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACzD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;oBARD,SAQC,CAAC;;;;;CACH","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport {\n abortIfCancelled,\n addSentryCliRc,\n detectPackageManager,\n getPackageDotJson,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport { SourceMapUploadToolConfigurationOptions } from './types';\nimport { hasPackageInstalled, PackageDotJson } from '../../utils/package-json';\nimport { traceStep } from '../../telemetry';\n\nconst SENTRY_NPM_SCRIPT_NAME = 'sentry:sourcemaps';\n\nlet addedToBuildCommand = false;\n\nexport async function configureSentryCLI(\n options: SourceMapUploadToolConfigurationOptions,\n configureSourcemapGenerationFlow: () => Promise<void> = defaultConfigureSourcemapGenerationFlow,\n): Promise<void> {\n const packageDotJson = await getPackageDotJson();\n\n await installPackage({\n packageName: '@sentry/cli',\n alreadyInstalled: hasPackageInstalled('@sentry/cli', packageDotJson),\n });\n\n let validPath = false;\n let relativeArtifactPath;\n do {\n const rawArtifactPath = await abortIfCancelled(\n clack.text({\n message: 'Where are your build artifacts located?',\n placeholder: `.${path.sep}out`,\n validate(value) {\n if (!value) {\n return 'Please enter a path.';\n }\n },\n }),\n );\n\n if (path.isAbsolute(rawArtifactPath)) {\n relativeArtifactPath = path.relative(process.cwd(), rawArtifactPath);\n } else {\n relativeArtifactPath = rawArtifactPath;\n }\n\n try {\n await fs.promises.access(path.join(process.cwd(), relativeArtifactPath));\n validPath = true;\n } catch {\n validPath = await abortIfCancelled(\n clack.select({\n message: `We couldn't find artifacts at ${relativeArtifactPath}. Are you sure that this is the location that contains your build artifacts?`,\n options: [\n {\n label: 'No, let me verify.',\n value: false,\n },\n { label: 'Yes, I am sure!', value: true },\n ],\n initialValue: false,\n }),\n );\n }\n } while (!validPath);\n\n const relativePosixArtifactPath = relativeArtifactPath\n .split(path.sep)\n .join(path.posix.sep);\n\n await configureSourcemapGenerationFlow();\n\n await createAndAddNpmScript(\n packageDotJson,\n options,\n relativePosixArtifactPath,\n );\n\n if (await askShouldAddToBuildCommand()) {\n await traceStep('sentry-cli-add-to-build-cmd', () =>\n addSentryCommandToBuildCommand(packageDotJson),\n );\n } else {\n clack.log.info(\n `No problem, just make sure to run this script ${chalk.bold(\n 'after',\n )} building your application but ${chalk.bold('before')} deploying!`,\n );\n }\n\n await addSentryCliRc(options.authToken);\n}\n\nexport async function setupNpmScriptInCI(): Promise<void> {\n if (addedToBuildCommand) {\n // No need to tell users to add it manually to their CI\n // if the script is already added to the build command\n return;\n }\n\n const addedToCI = await abortIfCancelled(\n clack.select({\n message: `Add a step to your CI pipeline that runs the ${chalk.cyan(\n SENTRY_NPM_SCRIPT_NAME,\n )} script ${chalk.bold('right after')} building your application.`,\n options: [\n { label: 'I did, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n `You need to run ${chalk.cyan(\n SENTRY_NPM_SCRIPT_NAME,\n )} after each build for source maps to work properly.`,\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-ci-script', addedToCI);\n\n if (!addedToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n}\n\nasync function createAndAddNpmScript(\n packageDotJson: PackageDotJson,\n options: SourceMapUploadToolConfigurationOptions,\n relativePosixArtifactPath: string,\n): Promise<void> {\n const sentryCliNpmScript = `sentry-cli sourcemaps inject --org ${\n options.orgSlug\n } --project ${\n options.projectSlug\n } ${relativePosixArtifactPath} && sentry-cli${\n options.selfHosted ? ` --url ${options.url}` : ''\n } sourcemaps upload --org ${options.orgSlug} --project ${\n options.projectSlug\n } ${relativePosixArtifactPath}`;\n\n packageDotJson.scripts = packageDotJson.scripts || {};\n packageDotJson.scripts[SENTRY_NPM_SCRIPT_NAME] = sentryCliNpmScript;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageDotJson, null, 2),\n );\n\n clack.log.info(\n `Added a ${chalk.cyan(SENTRY_NPM_SCRIPT_NAME)} script to your ${chalk.cyan(\n 'package.json',\n )}.`,\n );\n}\n\nasync function askShouldAddToBuildCommand(): Promise<boolean> {\n const shouldAddToBuildCommand = await abortIfCancelled(\n clack.select({\n message: `Do you want to automatically run the ${chalk.cyan(\n SENTRY_NPM_SCRIPT_NAME,\n )} script after each production build?`,\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'This will modify your prod build comamnd',\n },\n { label: 'No', value: false },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('modify-build-command', shouldAddToBuildCommand);\n\n return shouldAddToBuildCommand;\n}\n\n/**\n * Add the sentry:sourcemaps command to the prod build command in the package.json\n * - Detect the user's build command\n * - Append the sentry:sourcemaps command to it\n *\n * @param packageDotJson The package.json which will be modified.\n */\nasync function addSentryCommandToBuildCommand(\n packageDotJson: PackageDotJson,\n): Promise<void> {\n // This usually shouldn't happen because earlier we added the\n // SENTRY_NPM_SCRIPT_NAME script but just to be sure\n packageDotJson.scripts = packageDotJson.scripts || {};\n\n const allNpmScripts = Object.keys(packageDotJson.scripts).filter(\n (s) => s !== SENTRY_NPM_SCRIPT_NAME,\n );\n\n const pacMan = detectPackageManager() || 'npm';\n\n // Heuristic to pre-select the build command:\n // Often, 'build' is the prod build command, so we favour it.\n // If it's not there, commands that include 'build' might be the prod build command.\n let buildCommand =\n packageDotJson.scripts.build ||\n allNpmScripts.find((s) => s.toLocaleLowerCase().includes('build'));\n\n const isProdBuildCommand =\n !!buildCommand &&\n (await abortIfCancelled(\n clack.confirm({\n message: `Is ${chalk.cyan(\n `${pacMan} run ${buildCommand}`,\n )} your production build command?`,\n }),\n ));\n\n if (allNpmScripts.length && (!buildCommand || !isProdBuildCommand)) {\n buildCommand = await abortIfCancelled(\n clack.select({\n message: `Which ${pacMan} command in your ${chalk.cyan(\n 'package.json',\n )} builds your application for production?`,\n options: allNpmScripts\n .map((script) => ({\n label: script,\n value: script,\n }))\n .concat({ label: 'None of the above', value: 'none' }),\n }),\n );\n }\n\n if (!buildCommand || buildCommand === 'none') {\n clack.log.warn(\n `We can only add the ${chalk.cyan(\n SENTRY_NPM_SCRIPT_NAME,\n )} script to another \\`script\\` in your ${chalk.cyan('package.json')}.\nPlease add it manually to your prod build command.`,\n );\n return;\n }\n\n packageDotJson.scripts[\n buildCommand\n ] = `${buildCommand} && ${pacMan} run ${SENTRY_NPM_SCRIPT_NAME}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageDotJson, null, 2),\n );\n\n addedToBuildCommand = true;\n\n clack.log.info(\n `Added ${chalk.cyan(SENTRY_NPM_SCRIPT_NAME)} script to your ${chalk.cyan(\n buildCommand,\n )} command.`,\n );\n}\n\nasync function defaultConfigureSourcemapGenerationFlow(): Promise<void> {\n await abortIfCancelled(\n clack.select({\n message: `Verify that your build tool is generating source maps. ${chalk.dim(\n '(Your build output folder should contain .js.map files after a build)',\n )}`,\n options: [{ label: 'I checked. Continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n"]}
@@ -1,3 +1,3 @@
1
- export type SupportedTools = 'webpack' | 'vite' | 'rollup' | 'esbuild' | 'tsc' | 'sentry-cli' | 'create-react-app' | 'angular';
1
+ export type SupportedTools = 'webpack' | 'vite' | 'rollup' | 'esbuild' | 'tsc' | 'sentry-cli' | 'create-react-app' | 'angular' | 'nextjs';
2
2
  export declare const TOOL_PACKAGE_MAP: Record<string, SupportedTools>;
3
3
  export declare function detectUsedTool(): Promise<SupportedTools>;
@@ -46,6 +46,7 @@ var package_json_1 = require("../../utils/package-json");
46
46
  exports.TOOL_PACKAGE_MAP = {
47
47
  '@angular/core': 'angular',
48
48
  'create-react-app': 'create-react-app',
49
+ next: 'nextjs',
49
50
  webpack: 'webpack',
50
51
  vite: 'vite',
51
52
  esbuild: 'esbuild',
@@ -1 +1 @@
1
- {"version":3,"file":"detect-tool.js","sourceRoot":"","sources":["../../../../src/sourcemaps/utils/detect-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA4D;AAC5D,yDAAwE;AAYxE,oDAAoD;AACpD,kFAAkF;AAClF,sEAAsE;AACtE,YAAY;AACC,QAAA,gBAAgB,GAAmC;IAC9D,eAAe,EAAE,SAAS;IAC1B,kBAAkB,EAAE,kBAAkB;IACtC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,SAAsB,cAAc;;;;;wBACd,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAEvC,gBAAgB,GAAG,IAAA,2CAA4B,EACnD,MAAM,CAAC,IAAI,CAAC,wBAAgB,CAAC,EAC7B,WAAW,CACZ,CAAC;oBAEF,IAAI,gBAAgB,EAAE;wBACpB,sBAAO,wBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAC;qBAChD;oBAED,sBAAO,YAAY,EAAC;;;;CACrB;AAbD,wCAaC","sourcesContent":["import { getPackageDotJson } from '../../utils/clack-utils';\nimport { findInstalledPackageFromList } from '../../utils/package-json';\n\nexport type SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli'\n | 'create-react-app'\n | 'angular';\n\n// A map of package names pointing to the tool slug.\n// The order is important, because we want to detect the most specific tool first.\n// For instance, webpack needs to come before tsc because typescript c\n// Similarly\nexport const TOOL_PACKAGE_MAP: Record<string, SupportedTools> = {\n '@angular/core': 'angular',\n 'create-react-app': 'create-react-app',\n webpack: 'webpack',\n vite: 'vite',\n esbuild: 'esbuild',\n rollup: 'rollup',\n typescript: 'tsc',\n};\n\nexport async function detectUsedTool(): Promise<SupportedTools> {\n const packageJson = await getPackageDotJson();\n\n const foundToolPackage = findInstalledPackageFromList(\n Object.keys(TOOL_PACKAGE_MAP),\n packageJson,\n );\n\n if (foundToolPackage) {\n return TOOL_PACKAGE_MAP[foundToolPackage.name];\n }\n\n return 'sentry-cli';\n}\n"]}
1
+ {"version":3,"file":"detect-tool.js","sourceRoot":"","sources":["../../../../src/sourcemaps/utils/detect-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA4D;AAC5D,yDAAwE;AAaxE,oDAAoD;AACpD,kFAAkF;AAClF,sEAAsE;AACtE,YAAY;AACC,QAAA,gBAAgB,GAAmC;IAC9D,eAAe,EAAE,SAAS;IAC1B,kBAAkB,EAAE,kBAAkB;IACtC,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,SAAsB,cAAc;;;;;wBACd,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAEvC,gBAAgB,GAAG,IAAA,2CAA4B,EACnD,MAAM,CAAC,IAAI,CAAC,wBAAgB,CAAC,EAC7B,WAAW,CACZ,CAAC;oBAEF,IAAI,gBAAgB,EAAE;wBACpB,sBAAO,wBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAC;qBAChD;oBAED,sBAAO,YAAY,EAAC;;;;CACrB;AAbD,wCAaC","sourcesContent":["import { getPackageDotJson } from '../../utils/clack-utils';\nimport { findInstalledPackageFromList } from '../../utils/package-json';\n\nexport type SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli'\n | 'create-react-app'\n | 'angular'\n | 'nextjs';\n\n// A map of package names pointing to the tool slug.\n// The order is important, because we want to detect the most specific tool first.\n// For instance, webpack needs to come before tsc because typescript c\n// Similarly\nexport const TOOL_PACKAGE_MAP: Record<string, SupportedTools> = {\n '@angular/core': 'angular',\n 'create-react-app': 'create-react-app',\n next: 'nextjs',\n webpack: 'webpack',\n vite: 'vite',\n esbuild: 'esbuild',\n rollup: 'rollup',\n typescript: 'tsc',\n};\n\nexport async function detectUsedTool(): Promise<SupportedTools> {\n const packageJson = await getPackageDotJson();\n\n const foundToolPackage = findInstalledPackageFromList(\n Object.keys(TOOL_PACKAGE_MAP),\n packageJson,\n );\n\n if (foundToolPackage) {\n return TOOL_PACKAGE_MAP[foundToolPackage.name];\n }\n\n return 'sentry-cli';\n}\n"]}
@@ -58,6 +58,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
58
58
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
59
  }
60
60
  };
61
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
62
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
63
+ if (ar || !(i in from)) {
64
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
65
+ ar[i] = from[i];
66
+ }
67
+ }
68
+ return to.concat(ar || Array.prototype.slice.call(from));
69
+ };
61
70
  var __importDefault = (this && this.__importDefault) || function (mod) {
62
71
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
72
  };
@@ -66,26 +75,26 @@ exports.checkIfMoreSuitableWizardExistsAndAskForRedirect = void 0;
66
75
  // @ts-ignore - clack is ESM and TS complains about that. It works though
67
76
  var prompts_1 = __importDefault(require("@clack/prompts"));
68
77
  var chalk_1 = __importDefault(require("chalk"));
69
- var nextjs_wizard_1 = require("../../nextjs/nextjs-wizard");
70
78
  var sveltekit_wizard_1 = require("../../sveltekit/sveltekit-wizard");
71
79
  var clack_utils_1 = require("../../utils/clack-utils");
72
80
  var package_json_1 = require("../../utils/package-json");
73
81
  var Sentry = __importStar(require("@sentry/node"));
82
+ var childProcess = __importStar(require("child_process"));
74
83
  var sdkMap = {
75
- '@sentry/nextjs': {
76
- frameworkName: 'Next.js',
77
- frameworkSlug: 'nextjs',
78
- frameworkPackage: 'next',
79
- sourcemapsDocsLink: 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-source-maps',
80
- wizard: nextjs_wizard_1.runNextjsWizard,
81
- },
82
84
  '@sentry/sveltekit': {
83
85
  frameworkName: 'SvelteKit',
84
- frameworkSlug: 'sveltekit',
85
86
  frameworkPackage: '@sveltejs/kit',
86
87
  sourcemapsDocsLink: 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/manual-setup/#configure-source-maps-upload',
88
+ troubleshootingDocsLink: 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/sourcemaps/troubleshooting_js/',
87
89
  wizard: sveltekit_wizard_1.runSvelteKitWizard,
88
90
  },
91
+ '@sentry/react-native': {
92
+ frameworkName: 'React Native',
93
+ frameworkPackage: 'react-native',
94
+ sourcemapsDocsLink: 'https://docs.sentry.io/platforms/react-native/sourcemaps/',
95
+ troubleshootingDocsLink: 'https://docs.sentry.io/platforms/react-native/troubleshooting/#source-maps',
96
+ wizard: runReactNativeWizard,
97
+ },
89
98
  };
90
99
  function checkIfMoreSuitableWizardExistsAndAskForRedirect() {
91
100
  return __awaiter(this, void 0, void 0, function () {
@@ -135,12 +144,12 @@ function checkIfMoreSuitableWizardExists() {
135
144
  }
136
145
  function askForRedirect(sdkName) {
137
146
  return __awaiter(this, void 0, void 0, function () {
138
- var _a, frameworkName, sourcemapsDocsLink, frameworkSlug, wizard, nextStep, _b;
147
+ var _a, frameworkName, sourcemapsDocsLink, troubleshootingDocsLink, wizard, nextStep, _b;
139
148
  return __generator(this, function (_c) {
140
149
  switch (_c.label) {
141
150
  case 0:
142
- _a = sdkMap[sdkName], frameworkName = _a.frameworkName, sourcemapsDocsLink = _a.sourcemapsDocsLink, frameworkSlug = _a.frameworkSlug, wizard = _a.wizard;
143
- prompts_1.default.log.warn("".concat(chalk_1.default.yellow("It seems like you're using this wizard in a ".concat(frameworkName, " project.")), "\n\nWe recommend using our dedicated ").concat(frameworkName, " wizard instead of this wizard.\nThe ").concat(frameworkName, " wizard will set up our ").concat(sdkName, " SDK and also configure uploading source maps for you.\n\nIf you already tried the ").concat(frameworkName, " wizard and it didn't work for you, check out the following guides:\n\nManual source maps configuration for ").concat(frameworkName, ":\n").concat(sourcemapsDocsLink, "\n\nTroubleshooting Source Maps:\nhttps://docs.sentry.io/platforms/javascript/guides/").concat(frameworkSlug, "/sourcemaps/troubleshooting_js/\n"));
151
+ _a = sdkMap[sdkName], frameworkName = _a.frameworkName, sourcemapsDocsLink = _a.sourcemapsDocsLink, troubleshootingDocsLink = _a.troubleshootingDocsLink, wizard = _a.wizard;
152
+ prompts_1.default.log.warn("".concat(chalk_1.default.yellow("It seems like you're using this wizard in a ".concat(frameworkName, " project.")), "\n\nWe recommend using our dedicated ").concat(frameworkName, " wizard instead of this wizard.\nThe ").concat(frameworkName, " wizard will set up our ").concat(sdkName, " SDK and also configure uploading source maps for you.\n\nIf you already tried the ").concat(frameworkName, " wizard and it didn't work for you, check out the following guides:\n\nManual source maps configuration for ").concat(frameworkName, ":\n").concat(sourcemapsDocsLink, "\n\nTroubleshooting Source Maps:\n").concat(troubleshootingDocsLink, "\n"));
144
153
  return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
145
154
  message: "Do you want to run the ".concat(frameworkName, " wizard now?"),
146
155
  options: [
@@ -180,4 +189,18 @@ function askForRedirect(sdkName) {
180
189
  });
181
190
  });
182
191
  }
192
+ function runReactNativeWizard() {
193
+ var _a = __spreadArray([], process.argv, true), runner = _a[0], wizardArgs = _a.slice(1);
194
+ wizardArgs.push('--integration', 'reactNative');
195
+ try {
196
+ childProcess.spawnSync(runner, wizardArgs, {
197
+ cwd: process.cwd(),
198
+ stdio: 'inherit',
199
+ });
200
+ }
201
+ catch (_b) {
202
+ return Promise.reject();
203
+ }
204
+ return Promise.resolve();
205
+ }
183
206
  //# sourceMappingURL=other-wizards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"other-wizards.js","sourceRoot":"","sources":["../../../../src/sourcemaps/utils/other-wizards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,4DAA6D;AAC7D,qEAAsE;AAEtE,uDAIiC;AACjC,yDAGkC;AAElC,mDAAuC;AAavC,IAAM,MAAM,GAAkC;IAC5C,gBAAgB,EAAE;QAChB,aAAa,EAAE,SAAS;QACxB,aAAa,EAAE,QAAQ;QACvB,gBAAgB,EAAE,MAAM;QACxB,kBAAkB,EAChB,+FAA+F;QACjG,MAAM,EAAE,+BAAe;KACxB;IACD,mBAAmB,EAAE;QACnB,aAAa,EAAE,WAAW;QAC1B,aAAa,EAAE,WAAW;QAC1B,gBAAgB,EAAE,eAAe;QACjC,kBAAkB,EAChB,yGAAyG;QAC3G,MAAM,EAAE,qCAAkB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AAa,kDAC1C,aAAa,qCAA2B,OAAO,gGAE1B,aAAa,yHAED,aAAa,gBAClD,kBAAkB,kGAGiC,aAAa,sCACjE,CACE,CAAC;oBAEiD,qBAAM,IAAA,8BAAgB,EACvE,iBAAK,CAAC,MAAM,CAAC;4BACX,OAAO,EAAE,iCAA0B,aAAa,iBAAc;4BAC9D,OAAO,EAAE;gCACP;oCACE,KAAK,EAAE,KAAK;oCACZ,KAAK,EAAE,UAAU;oCACjB,IAAI,EAAE,UAAG,eAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAE;iCACtC;gCACD;oCACE,KAAK,EAAE,+BAA+B;oCACtC,KAAK,EAAE,UAAU;iCAClB;gCACD;oCACE,KAAK,EAAE,gCAAgC;oCACvC,KAAK,EAAE,MAAM;oCACb,IAAI,EAAE,kBAAkB;iCACzB;6BACF;yBACF,CAAC,CACH,EAAA;;oBApBK,QAAQ,GAAqC,SAoBlD;oBAED,MAAM,CAAC,MAAM,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC;oBAEzC,KAAA,QAAQ,CAAA;;6BACT,UAAU,CAAC,CAAX,wBAAU;6BAEV,MAAM,CAAC,CAAP,wBAAM;;;wBADT,sBAAO,MAAM,EAAC;wBAEd,qBAAM,IAAA,mBAAK,EAAC,gBAAgB,EAAE,CAAC,CAAC,EAAA;;oBAAhC,SAAgC,CAAC;oBACjC,wBAAM;wBAEN,sBAAO,SAAS,EAAC;;;;;CAEtB","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { runNextjsWizard } from '../../nextjs/nextjs-wizard';\nimport { runSvelteKitWizard } from '../../sveltekit/sveltekit-wizard';\n\nimport {\n abort,\n abortIfCancelled,\n getPackageDotJson,\n} from '../../utils/clack-utils';\nimport {\n findInstalledPackageFromList,\n hasPackageInstalled,\n} from '../../utils/package-json';\n\nimport * as Sentry from '@sentry/node';\nimport { WizardOptions } from '../../utils/types';\n\ntype WizardFunction = (options: WizardOptions) => Promise<void>;\n\ntype FrameworkInfo = {\n frameworkName: string;\n frameworkSlug: string;\n frameworkPackage: string;\n sourcemapsDocsLink: string;\n wizard: WizardFunction;\n};\n\nconst sdkMap: Record<string, FrameworkInfo> = {\n '@sentry/nextjs': {\n frameworkName: 'Next.js',\n frameworkSlug: 'nextjs',\n frameworkPackage: 'next',\n sourcemapsDocsLink:\n 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-source-maps',\n wizard: runNextjsWizard,\n },\n '@sentry/sveltekit': {\n frameworkName: 'SvelteKit',\n frameworkSlug: 'sveltekit',\n frameworkPackage: '@sveltejs/kit',\n sourcemapsDocsLink:\n 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/manual-setup/#configure-source-maps-upload',\n wizard: runSvelteKitWizard,\n },\n};\n\nexport async function checkIfMoreSuitableWizardExistsAndAskForRedirect(): Promise<\n WizardFunction | undefined\n> {\n const sdkName = await checkIfMoreSuitableWizardExists();\n\n if (!sdkName) {\n return undefined;\n }\n\n return await askForRedirect(sdkName);\n}\n\nasync function checkIfMoreSuitableWizardExists(): Promise<string | undefined> {\n Sentry.setTag('using-wrong-wizard', false);\n\n const packageJson = await getPackageDotJson();\n\n const installedSdkPackage = findInstalledPackageFromList(\n Object.keys(sdkMap),\n packageJson,\n );\n\n if (!installedSdkPackage) {\n return undefined;\n }\n\n const sdkPackageName = installedSdkPackage.name;\n\n const { frameworkPackage } = sdkMap[sdkPackageName];\n\n if (!hasPackageInstalled(frameworkPackage, packageJson)) {\n // The user has installed the SDK but not the framework.\n // Maybe it's a false positive and the user is using a different framework.\n // Let's not redirect them to the framework wizard in that case.\n return undefined;\n }\n\n Sentry.setTag('using-wrong-wizard', true);\n\n return sdkPackageName;\n}\n\nasync function askForRedirect(\n sdkName: string,\n): Promise<WizardFunction | undefined> {\n const { frameworkName, sourcemapsDocsLink, frameworkSlug, wizard } =\n sdkMap[sdkName];\n\n clack.log.warn(\n `${chalk.yellow(\n `It seems like you're using this wizard in a ${frameworkName} project.`,\n )}\n\nWe recommend using our dedicated ${frameworkName} wizard instead of this wizard.\nThe ${frameworkName} wizard will set up our ${sdkName} SDK and also configure uploading source maps for you.\n\nIf you already tried the ${frameworkName} wizard and it didn't work for you, check out the following guides:\n\nManual source maps configuration for ${frameworkName}:\n${sourcemapsDocsLink}\n\nTroubleshooting Source Maps:\nhttps://docs.sentry.io/platforms/javascript/guides/${frameworkSlug}/sourcemaps/troubleshooting_js/\n`,\n );\n\n const nextStep: 'redirect' | 'continue' | 'stop' = await abortIfCancelled(\n clack.select({\n message: `Do you want to run the ${frameworkName} wizard now?`,\n options: [\n {\n label: 'Yes',\n value: 'redirect',\n hint: `${chalk.green('Recommended')}`,\n },\n {\n label: 'No, continue with this wizard',\n value: 'continue',\n },\n {\n label: \"No, I'll check out the guides \",\n value: 'stop',\n hint: 'Exit this wizard',\n },\n ],\n }),\n );\n\n Sentry.setTag('wrong-wizard-decision', nextStep);\n\n switch (nextStep) {\n case 'redirect':\n return wizard;\n case 'stop':\n await abort('Exiting Wizard', 0);\n break;\n default:\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"other-wizards.js","sourceRoot":"","sources":["../../../../src/sourcemaps/utils/other-wizards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qEAAsE;AAEtE,uDAIiC;AACjC,yDAGkC;AAElC,mDAAuC;AAGvC,0DAA8C;AAY9C,IAAM,MAAM,GAAkC;IAC5C,mBAAmB,EAAE;QACnB,aAAa,EAAE,WAAW;QAC1B,gBAAgB,EAAE,eAAe;QACjC,kBAAkB,EAChB,yGAAyG;QAC3G,uBAAuB,EACrB,6FAA6F;QAC/F,MAAM,EAAE,qCAAkB;KAC3B;IACD,sBAAsB,EAAE;QACtB,aAAa,EAAE,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C,MAAM,EAAE,UAAU,EAAE;YACzC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;KACJ;IAAC,WAAM;QACN,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;KACzB;IAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { runSvelteKitWizard } from '../../sveltekit/sveltekit-wizard';\n\nimport {\n abort,\n abortIfCancelled,\n getPackageDotJson,\n} from '../../utils/clack-utils';\nimport {\n findInstalledPackageFromList,\n hasPackageInstalled,\n} from '../../utils/package-json';\n\nimport * as Sentry from '@sentry/node';\nimport { WizardOptions } from '../../utils/types';\n\nimport * as childProcess from 'child_process';\n\ntype WizardFunction = (options: WizardOptions) => Promise<void>;\n\ntype FrameworkInfo = {\n frameworkName: string;\n frameworkPackage: string;\n troubleshootingDocsLink: string;\n sourcemapsDocsLink: string;\n wizard: WizardFunction;\n};\n\nconst sdkMap: Record<string, FrameworkInfo> = {\n '@sentry/sveltekit': {\n frameworkName: 'SvelteKit',\n frameworkPackage: '@sveltejs/kit',\n sourcemapsDocsLink:\n 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/manual-setup/#configure-source-maps-upload',\n troubleshootingDocsLink:\n 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/sourcemaps/troubleshooting_js/',\n wizard: runSvelteKitWizard,\n },\n '@sentry/react-native': {\n frameworkName: 'React Native',\n frameworkPackage: 'react-native',\n sourcemapsDocsLink:\n 'https://docs.sentry.io/platforms/react-native/sourcemaps/',\n troubleshootingDocsLink:\n 'https://docs.sentry.io/platforms/react-native/troubleshooting/#source-maps',\n wizard: runReactNativeWizard,\n },\n};\n\nexport async function checkIfMoreSuitableWizardExistsAndAskForRedirect(): Promise<\n WizardFunction | undefined\n> {\n const sdkName = await checkIfMoreSuitableWizardExists();\n\n if (!sdkName) {\n return undefined;\n }\n\n return await askForRedirect(sdkName);\n}\n\nasync function checkIfMoreSuitableWizardExists(): Promise<string | undefined> {\n Sentry.setTag('using-wrong-wizard', false);\n\n const packageJson = await getPackageDotJson();\n\n const installedSdkPackage = findInstalledPackageFromList(\n Object.keys(sdkMap),\n packageJson,\n );\n\n if (!installedSdkPackage) {\n return undefined;\n }\n\n const sdkPackageName = installedSdkPackage.name;\n\n const { frameworkPackage } = sdkMap[sdkPackageName];\n\n if (!hasPackageInstalled(frameworkPackage, packageJson)) {\n // The user has installed the SDK but not the framework.\n // Maybe it's a false positive and the user is using a different framework.\n // Let's not redirect them to the framework wizard in that case.\n return undefined;\n }\n\n Sentry.setTag('using-wrong-wizard', true);\n\n return sdkPackageName;\n}\n\nasync function askForRedirect(\n sdkName: string,\n): Promise<WizardFunction | undefined> {\n const { frameworkName, sourcemapsDocsLink, troubleshootingDocsLink, wizard } =\n sdkMap[sdkName];\n\n clack.log.warn(\n `${chalk.yellow(\n `It seems like you're using this wizard in a ${frameworkName} project.`,\n )}\n\nWe recommend using our dedicated ${frameworkName} wizard instead of this wizard.\nThe ${frameworkName} wizard will set up our ${sdkName} SDK and also configure uploading source maps for you.\n\nIf you already tried the ${frameworkName} wizard and it didn't work for you, check out the following guides:\n\nManual source maps configuration for ${frameworkName}:\n${sourcemapsDocsLink}\n\nTroubleshooting Source Maps:\n${troubleshootingDocsLink}\n`,\n );\n\n const nextStep: 'redirect' | 'continue' | 'stop' = await abortIfCancelled(\n clack.select({\n message: `Do you want to run the ${frameworkName} wizard now?`,\n options: [\n {\n label: 'Yes',\n value: 'redirect',\n hint: `${chalk.green('Recommended')}`,\n },\n {\n label: 'No, continue with this wizard',\n value: 'continue',\n },\n {\n label: \"No, I'll check out the guides \",\n value: 'stop',\n hint: 'Exit this wizard',\n },\n ],\n }),\n );\n\n Sentry.setTag('wrong-wizard-decision', nextStep);\n\n switch (nextStep) {\n case 'redirect':\n return wizard;\n case 'stop':\n await abort('Exiting Wizard', 0);\n break;\n default:\n return undefined;\n }\n}\n\nfunction runReactNativeWizard(): Promise<void> {\n const [runner, ...wizardArgs] = [...process.argv];\n wizardArgs.push('--integration', 'reactNative');\n\n try {\n childProcess.spawnSync(runner, wizardArgs, {\n cwd: process.cwd(),\n stdio: 'inherit',\n });\n } catch {\n return Promise.reject();\n }\n\n return Promise.resolve();\n}\n"]}
@@ -1,2 +1,2 @@
1
- import { SentryProjectData } from '../utils/clack-utils';
1
+ import { SentryProjectData } from '../utils/types';
2
2
  export declare function setupCLIConfig(authToken: string, selectedProject: SentryProjectData, sentryUrl: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-cli-setup.js","sourceRoot":"","sources":["../../../src/sveltekit/sentry-cli-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAuD;AAGvD,SAAsB,cAAc,CAClC,SAAiB,EACjB,eAAkC,EAClC,SAAiB;;;;;;oBAEX,GAAG,GAAG,IAAI,qBAAS,CAAC,EAAE,GAAG,EAAE,SAAS,EAAU,CAAC,CAAC;oBAEhD,OAAO,GAAG;wBACd,MAAM,EAAE;4BACN,YAAY,EAAE;gCACZ,IAAI,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;6BACxC;4BACD,OAAO,EAAE;gCACP,IAAI,EAAE,eAAe,CAAC,IAAI;6BAC3B;4BACD,IAAI,EAAE;gCACJ,KAAK,EAAE,SAAS;6BACjB;yBACF;qBACF,CAAC;oBACI,KAAK,GAAG,GAAG,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;oBACtD,qBAAM,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAA;;oBAAtC,SAAsC,CAAC;;;;;CACxC;AAtBD,wCAsBC","sourcesContent":["import { Args } from '../../lib/Constants';\nimport { SentryCli } from '../../lib/Helper/SentryCli';\nimport { SentryProjectData } from '../utils/clack-utils';\n\nexport async function setupCLIConfig(\n authToken: string,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n): Promise<void> {\n const cli = new SentryCli({ url: sentryUrl } as Args);\n\n const answers = {\n config: {\n organization: {\n slug: selectedProject.organization.slug,\n },\n project: {\n slug: selectedProject.slug,\n },\n auth: {\n token: authToken,\n },\n },\n };\n const props = cli.convertAnswersToProperties(answers);\n await cli.createSentryCliConfig(props);\n}\n"]}
1
+ {"version":3,"file":"sentry-cli-setup.js","sourceRoot":"","sources":["../../../src/sveltekit/sentry-cli-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAuD;AAGvD,SAAsB,cAAc,CAClC,SAAiB,EACjB,eAAkC,EAClC,SAAiB;;;;;;oBAEX,GAAG,GAAG,IAAI,qBAAS,CAAC,EAAE,GAAG,EAAE,SAAS,EAAU,CAAC,CAAC;oBAEhD,OAAO,GAAG;wBACd,MAAM,EAAE;4BACN,YAAY,EAAE;gCACZ,IAAI,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;6BACxC;4BACD,OAAO,EAAE;gCACP,IAAI,EAAE,eAAe,CAAC,IAAI;6BAC3B;4BACD,IAAI,EAAE;gCACJ,KAAK,EAAE,SAAS;6BACjB;yBACF;qBACF,CAAC;oBACI,KAAK,GAAG,GAAG,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;oBACtD,qBAAM,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAA;;oBAAtC,SAAsC,CAAC;;;;;CACxC;AAtBD,wCAsBC","sourcesContent":["import { Args } from '../../lib/Constants';\nimport { SentryCli } from '../../lib/Helper/SentryCli';\nimport { SentryProjectData } from '../utils/types';\n\nexport async function setupCLIConfig(\n authToken: string,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n): Promise<void> {\n const cli = new SentryCli({ url: sentryUrl } as Args);\n\n const answers = {\n config: {\n organization: {\n slug: selectedProject.organization.slug,\n },\n project: {\n slug: selectedProject.slug,\n },\n auth: {\n token: authToken,\n },\n },\n };\n const props = cli.convertAnswersToProperties(answers);\n await cli.createSentryCliConfig(props);\n}\n"]}
@@ -95,11 +95,11 @@ function runSvelteKitWizard(options) {
95
95
  svelteConfig = _c.sent();
96
96
  _c.label = 10;
97
97
  case 10:
98
- _c.trys.push([10, 12, , 13]);
98
+ _c.trys.push([10, 12, , 14]);
99
99
  return [4 /*yield*/, (0, sdk_setup_1.createOrMergeSvelteKitFiles)(dsn, svelteConfig)];
100
100
  case 11:
101
101
  _c.sent();
102
- return [3 /*break*/, 13];
102
+ return [3 /*break*/, 14];
103
103
  case 12:
104
104
  e_1 = _c.sent();
105
105
  prompts_1.default.log.error('Error while setting up the SvelteKit SDK:');
@@ -108,19 +108,22 @@ function runSvelteKitWizard(options) {
108
108
  : typeof e_1 === 'string'
109
109
  ? e_1
110
110
  : 'Unknown error'));
111
- return [2 /*return*/];
111
+ return [4 /*yield*/, (0, clack_utils_1.abort)('Exiting Wizard')];
112
112
  case 13:
113
- _c.trys.push([13, 15, , 16]);
113
+ _c.sent();
114
+ return [2 /*return*/];
115
+ case 14:
116
+ _c.trys.push([14, 16, , 18]);
114
117
  return [4 /*yield*/, (0, sdk_example_1.createExamplePage)(svelteConfig, {
115
118
  selfHosted: selfHosted,
116
119
  url: sentryUrl,
117
120
  orgSlug: selectedProject.organization.slug,
118
121
  projectId: selectedProject.id,
119
122
  })];
120
- case 14:
121
- _c.sent();
122
- return [3 /*break*/, 16];
123
123
  case 15:
124
+ _c.sent();
125
+ return [3 /*break*/, 18];
126
+ case 16:
124
127
  e_2 = _c.sent();
125
128
  prompts_1.default.log.error('Error while creating an example page to test Sentry:');
126
129
  prompts_1.default.log.info(chalk_1.default.dim(typeof e_2 === 'object' && e_2 != null && 'toString' in e_2
@@ -128,8 +131,11 @@ function runSvelteKitWizard(options) {
128
131
  : typeof e_2 === 'string'
129
132
  ? e_2
130
133
  : 'Unknown error'));
134
+ return [4 /*yield*/, (0, clack_utils_1.abort)('Exiting Wizard')];
135
+ case 17:
136
+ _c.sent();
131
137
  return [2 /*return*/];
132
- case 16:
138
+ case 18:
133
139
  prompts_1.default.outro("\n".concat(chalk_1.default.green('Successfully installed the Sentry SvelteKit SDK!'), "\n\n").concat(chalk_1.default.cyan('You can validate your setup by starting your dev environment (`npm run dev`) and visiting "/sentry-example".'), "\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/\n "));
134
140
  return [2 /*return*/];
135
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAE1B,oDAS8B;AAC9B,sDAA4D;AAE5D,6CAAkD;AAClD,yCAA4E;AAE5E,uDAAoD;AAEpD,SAAsB,kBAAkB,CACtC,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,yBAAyB;wBACrC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,gDAAkC,GAAE,EAAA;;oBAA1C,SAA0C,CAAC;oBAEvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAC7C,qBAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,eAAe,EAAE,WAAW,CAAC,EAAA;;oBAAzE,SAAyE,CAAC;oBAEnC,qBAAM,IAAA,8BAAgB,EAAC,OAAO,CAAC,GAAG,CAAC,EAAA;;oBAApE,KAAiC,SAAmC,EAA7D,SAAS,SAAA,EAAE,UAAU,gBAAA;oBAEJ,qBAAM,IAAA,+BAAiB,EAAC;4BACpD,SAAS,EAAE,OAAO,CAAC,SAAS;4BAC5B,GAAG,EAAE,SAAS;4BACd,QAAQ,EAAE,sBAAsB;y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AAe,CAAC,EAAE;yBAC9B,CAAC,EAAA;;oBALF,SAKE,CAAC;;;;oBAEH,iBAAK,CAAC,GAAG,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;oBACxE,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAK,CAAC,GAAG,CACP,OAAO,GAAC,KAAK,QAAQ,IAAI,GAAC,IAAI,IAAI,IAAI,UAAU,IAAI,GAAC;wBACnD,CAAC,CAAC,GAAC,CAAC,QAAQ,EAAE;wBACd,CAAC,CAAC,OAAO,GAAC,KAAK,QAAQ;4BACvB,CAAC,CAAC,GAAC;4BACH,CAAC,CAAC,eAAe,CACpB,CACF,CAAC;oBACF,sBAAO;;oBAGT,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,iBAE/D,eAAK,CAAC,IAAI,CACV,8GAA8G,CAC/G,sIAIE,CAAC,CAAC;;;;;CACJ;AAjFD,gDAiFC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n ensurePackageIsInstalled,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';\n\nimport { setupCLIConfig } from './sentry-cli-setup';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const packageJson = await getPackageDotJson();\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted(options.url);\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: 'javascript-sveltekit',\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n await installPackage({\n packageName: '@sentry/sveltekit',\n alreadyInstalled: hasPackageInstalled('@sentry/sveltekit', packageJson),\n });\n\n await setupCLIConfig(apiKeys.token, selectedProject, sentryUrl);\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const svelteConfig = await loadSvelteConfig();\n\n try {\n await createOrMergeSvelteKitFiles(dsn, svelteConfig);\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n return;\n }\n\n try {\n await createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n });\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n return;\n }\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry SvelteKit SDK!')}\n\n${chalk.cyan(\n 'You can validate your setup by starting your dev environment (`npm run dev`) and visiting \"/sentry-example\".',\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/\n `);\n}\n"]}
1
+ {"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAE1B,oDAU8B;AAC9B,sDAA4D;AAE5D,6CAAkD;AAClD,yCAA4E;AAE5E,uDAAoD;AAEpD,SAAs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iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,iBAE/D,eAAK,CAAC,IAAI,CACV,8GAA8G,CAC/G,sIAIE,CAAC,CAAC;;;;;CACJ;AAnFD,gDAmFC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n abort,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n ensurePackageIsInstalled,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';\n\nimport { setupCLIConfig } from './sentry-cli-setup';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const packageJson = await getPackageDotJson();\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted(options.url);\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: 'javascript-sveltekit',\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n await installPackage({\n packageName: '@sentry/sveltekit',\n alreadyInstalled: hasPackageInstalled('@sentry/sveltekit', packageJson),\n });\n\n await setupCLIConfig(apiKeys.token, selectedProject, sentryUrl);\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const svelteConfig = await loadSvelteConfig();\n\n try {\n await createOrMergeSvelteKitFiles(dsn, svelteConfig);\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n await abort('Exiting Wizard');\n return;\n }\n\n try {\n await createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n });\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n await abort('Exiting Wizard');\n return;\n }\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry SvelteKit SDK!')}\n\n${chalk.cyan(\n 'You can validate your setup by starting your dev environment (`npm run dev`) and visiting \"/sentry-example\".',\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/\n `);\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  export declare function hasSentryCLI(): boolean;
2
2
  export declare function installSentryCLI(): Promise<void>;
3
- export declare function execute(command: string): string;
3
+ export declare function executeSync(command: string): string;
4
+ export declare function execute(command: string): Promise<string>;
@@ -59,7 +59,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
59
59
  }
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.execute = exports.installSentryCLI = exports.hasSentryCLI = void 0;
62
+ exports.execute = exports.executeSync = exports.installSentryCLI = exports.hasSentryCLI = void 0;
63
63
  var child_process = __importStar(require("child_process"));
64
64
  var https = __importStar(require("https"));
65
65
  var fs = __importStar(require("fs"));
@@ -110,9 +110,21 @@ function installSentryCLI() {
110
110
  });
111
111
  }
112
112
  exports.installSentryCLI = installSentryCLI;
113
- function execute(command) {
113
+ function executeSync(command) {
114
114
  var output = child_process.execSync(command);
115
115
  return output.toString();
116
116
  }
117
+ exports.executeSync = executeSync;
118
+ function execute(command) {
119
+ return new Promise(function (resolve, reject) {
120
+ child_process.exec(command, function (error, stdout, _) {
121
+ if (error) {
122
+ reject(error);
123
+ return;
124
+ }
125
+ resolve(stdout);
126
+ });
127
+ });
128
+ }
117
129
  exports.execute = execute;
118
130
  //# sourceMappingURL=bash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/utils/bash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA+C;AAC/C,2CAA+B;AAC/B,qCAAyB;AAEzB,SAAgB,YAAY;IACxB,IAAI;QACA,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;KACf;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,KAAK,CAAC;KAChB;AACL,CAAC;AAPD,oCAOC;AAED,SAAsB,gBAAgB;;;;;;oBAC5B,SAAS,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBAC1C,IAAM,IAAI,GAAG,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;wBACnD,KAAK,CAAC,GAAG,CAAC,4BAA4B,EAAE,UAAC,QAAQ;4BAC7C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;4BACpB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;gCACd,IAAI,CAAC,KAAK,EAAE,CAAC;gCACb,IAAI;oCACA,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;iCAClD;gCAAC,OAAO,CAAC,EAAE;oCACR,MAAM,CAAC,CAAC,CAAC,CAAC;oCACV,OAAM;iCACT;gCACD,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;gCAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;4BAClB,CAAC,CAAC,CAAC;4BAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,GAAG;gCACjB,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;gCAC/B,MAAM,CAAC,GAAG,CAAC,CAAC;4BAChB,CAAC,CAAC,CAAC;wBACP,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;oBAEH,qBAAM,SAAS,EAAA;;oBAAf,SAAe,CAAC;;;;;CACnB;AAzBD,4CAyBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACnC,IAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAHD,0BAGC","sourcesContent":["import * as child_process from 'child_process';\nimport * as https from 'https';\nimport * as fs from 'fs';\n\nexport function hasSentryCLI(): boolean {\n try {\n child_process.execSync('sentry-cli --version');\n return true;\n } catch (e) {\n return false;\n }\n}\n\nexport async function installSentryCLI(): Promise<void> {\n const httpAsync = new Promise((resolve, reject) => {\n const file = fs.createWriteStream('installcli.sh');\n https.get('https://sentry.io/get-cli/', (response) => {\n response.pipe(file);\n file.on('finish', () => {\n file.close();\n try {\n child_process.execSync('bash ./installcli.sh');\n } catch (e) {\n reject(e);\n return\n }\n fs.unlinkSync('installcli.sh');\n resolve(null);\n });\n\n file.on('error', (err) => {\n fs.unlinkSync('installcli.sh');\n reject(err);\n });\n });\n });\n\n await httpAsync;\n}\n\nexport function execute(command: string): string {\n const output = child_process.execSync(command);\n return output.toString();\n}\n"]}
1
+ {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/utils/bash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA+C;AAC/C,2CAA+B;AAC/B,qCAAyB;AAEzB,SAAgB,YAAY;IAC1B,IAAI;QACF,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;AACH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AAE,MAAM,EAAE,CAAC;YAC3C,IAAI,KAAK,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;aACR;YAED,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,0BAWC","sourcesContent":["import * as child_process from 'child_process';\nimport * as https from 'https';\nimport * as fs from 'fs';\n\nexport function hasSentryCLI(): boolean {\n try {\n child_process.execSync('sentry-cli --version');\n return true;\n } catch (e) {\n return false;\n }\n}\n\nexport async function installSentryCLI(): Promise<void> {\n const httpAsync = new Promise((resolve, reject) => {\n const file = fs.createWriteStream('installcli.sh');\n https.get('https://sentry.io/get-cli/', (response) => {\n response.pipe(file);\n file.on('finish', () => {\n file.close();\n try {\n child_process.execSync('bash ./installcli.sh');\n } catch (e) {\n reject(e);\n return;\n }\n fs.unlinkSync('installcli.sh');\n resolve(null);\n });\n\n file.on('error', (err) => {\n fs.unlinkSync('installcli.sh');\n reject(err);\n });\n });\n });\n\n await httpAsync;\n}\n\nexport function executeSync(command: string): string {\n const output = child_process.execSync(command);\n return output.toString();\n}\n\nexport function execute(command: string): Promise<string> {\n return new Promise((resolve, reject) => {\n child_process.exec(command, (error, stdout, _) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve(stdout);\n });\n });\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { PackageDotJson } from './package-json';
2
+ import { SentryProjectData, WizardOptions } from './types';
2
3
  export declare const SENTRY_DOT_ENV_FILE = ".env.sentry-build-plugin";
3
4
  export declare const SENTRY_CLI_RC_FILE = ".sentryclirc";
4
5
  interface WizardProjectData {
@@ -7,20 +8,6 @@ interface WizardProjectData {
7
8
  };
8
9
  projects: SentryProjectData[];
9
10
  }
10
- export interface SentryProjectData {
11
- id: string;
12
- slug: string;
13
- name: string;
14
- platform: string;
15
- organization: {
16
- slug: string;
17
- };
18
- keys: [{
19
- dsn: {
20
- public: string;
21
- };
22
- }];
23
- }
24
11
  export declare function abort(message?: string, status?: number): Promise<never>;
25
12
  export declare function abortIfCancelled<T>(input: T | Promise<T>): Promise<Exclude<T, symbol>>;
26
13
  export declare function printWelcome(options: {
@@ -64,4 +51,10 @@ export declare function ensurePackageIsInstalled(packageJson: PackageDotJson, pa
64
51
  export declare function getPackageDotJson(): Promise<PackageDotJson>;
65
52
  export declare function detectPackageManager(): 'yarn' | 'npm' | 'pnpm' | undefined;
66
53
  export declare function isUsingTypeScript(): boolean;
54
+ export declare function getOrAskForProjectData(options: WizardOptions): Promise<{
55
+ sentryUrl: string;
56
+ selfHosted: boolean;
57
+ selectedProject: SentryProjectData;
58
+ authToken: string;
59
+ }>;
67
60
  export {};
@@ -62,7 +62,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
62
62
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
63
  };
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.isUsingTypeScript = exports.detectPackageManager = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliRc = exports.askForSelfHosted = exports.installPackage = exports.askForProjectSelection = exports.askForItemSelection = exports.askForWizardLogin = exports.askToInstallSentryCLI = exports.confirmContinueEvenThoughNoGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
65
+ exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.detectPackageManager = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliRc = exports.askForSelfHosted = exports.installPackage = exports.askForProjectSelection = exports.askForItemSelection = exports.askForWizardLogin = exports.askToInstallSentryCLI = exports.confirmContinueEvenThoughNoGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
66
66
  // @ts-ignore - clack is ESM and TS complains about that. It works though
67
67
  var clack = __importStar(require("@clack/prompts"));
68
68
  var axios_1 = __importDefault(require("axios"));
@@ -76,6 +76,7 @@ var util_1 = require("util");
76
76
  var Sentry = __importStar(require("@sentry/node"));
77
77
  var clack_custom_select_1 = require("./vendor/clack-custom-select");
78
78
  var package_json_1 = require("./package-json");
79
+ var telemetry_1 = require("../telemetry");
79
80
  var opn = require('opn');
80
81
  exports.SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';
81
82
  exports.SENTRY_CLI_RC_FILE = '.sentryclirc';
@@ -255,7 +256,7 @@ function askForWizardLogin(options) {
255
256
  // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
256
257
  });
257
258
  loginSpinner = clack.spinner();
258
- loginSpinner.start("Waiting for you to log in using the link above. Once you're logged in, return to this wizard.");
259
+ loginSpinner.start('Waiting for you to log in using the link above');
259
260
  return [4 /*yield*/, new Promise(function (resolve) {
260
261
  var pollingInterval = (0, timers_1.setInterval)(function () {
261
262
  axios_1.default
@@ -692,4 +693,47 @@ function isUsingTypeScript() {
692
693
  }
693
694
  }
694
695
  exports.isUsingTypeScript = isUsingTypeScript;
696
+ function getOrAskForProjectData(options) {
697
+ var _a;
698
+ return __awaiter(this, void 0, void 0, function () {
699
+ var _b, sentryUrl, selfHosted, _c, projects, apiKeys, selectedProject;
700
+ return __generator(this, function (_d) {
701
+ switch (_d.label) {
702
+ case 0:
703
+ if (options.preSelectedProject) {
704
+ return [2 /*return*/, {
705
+ selfHosted: options.preSelectedProject.selfHosted,
706
+ sentryUrl: (_a = options.url) !== null && _a !== void 0 ? _a : SAAS_URL,
707
+ authToken: options.preSelectedProject.authToken,
708
+ selectedProject: options.preSelectedProject.project,
709
+ }];
710
+ }
711
+ return [4 /*yield*/, (0, telemetry_1.traceStep)('ask-self-hosted', function () { return askForSelfHosted(options.url); })];
712
+ case 1:
713
+ _b = _d.sent(), sentryUrl = _b.url, selfHosted = _b.selfHosted;
714
+ return [4 /*yield*/, (0, telemetry_1.traceStep)('login', function () {
715
+ return askForWizardLogin({
716
+ promoCode: options.promoCode,
717
+ url: sentryUrl,
718
+ platform: 'javascript-nextjs',
719
+ });
720
+ })];
721
+ case 2:
722
+ _c = _d.sent(), projects = _c.projects, apiKeys = _c.apiKeys;
723
+ return [4 /*yield*/, (0, telemetry_1.traceStep)('select-project', function () {
724
+ return askForProjectSelection(projects);
725
+ })];
726
+ case 3:
727
+ selectedProject = _d.sent();
728
+ return [2 /*return*/, {
729
+ sentryUrl: sentryUrl,
730
+ selfHosted: selfHosted,
731
+ authToken: apiKeys.token,
732
+ selectedProject: selectedProject,
733
+ }];
734
+ }
735
+ });
736
+ });
737
+ }
738
+ exports.getOrAskForProjectData = getOrAskForProjectData;
695
739
  //# sourceMappingURL=clack-utils.js.map