@sentry/wizard 3.15.0 → 3.16.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 (95) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/lib/Steps/ChooseIntegration.js +1 -1
  3. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  4. package/dist/lib/Steps/Integrations/ReactNative.d.ts +7 -32
  5. package/dist/lib/Steps/Integrations/ReactNative.js +17 -485
  6. package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
  7. package/dist/package.json +1 -1
  8. package/dist/src/android/android-wizard.js +13 -18
  9. package/dist/src/android/android-wizard.js.map +1 -1
  10. package/dist/src/apple/apple-wizard.js +11 -4
  11. package/dist/src/apple/apple-wizard.js.map +1 -1
  12. package/dist/src/apple/cocoapod.d.ts +1 -0
  13. package/dist/src/apple/cocoapod.js +36 -13
  14. package/dist/src/apple/cocoapod.js.map +1 -1
  15. package/dist/src/nextjs/nextjs-wizard.js +1 -1
  16. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  17. package/dist/src/react-native/glob.d.ts +3 -0
  18. package/dist/src/react-native/glob.js +18 -0
  19. package/dist/src/react-native/glob.js.map +1 -0
  20. package/dist/src/react-native/gradle.d.ts +4 -0
  21. package/dist/src/react-native/gradle.js +49 -0
  22. package/dist/src/react-native/gradle.js.map +1 -0
  23. package/dist/src/react-native/javascript.d.ts +8 -0
  24. package/dist/src/react-native/javascript.js +25 -0
  25. package/dist/src/react-native/javascript.js.map +1 -0
  26. package/dist/src/react-native/options.d.ts +4 -0
  27. package/dist/src/react-native/options.js +3 -0
  28. package/dist/src/react-native/options.js.map +1 -0
  29. package/dist/src/react-native/react-native-wizard.d.ts +9 -0
  30. package/dist/src/react-native/react-native-wizard.js +356 -0
  31. package/dist/src/react-native/react-native-wizard.js.map +1 -0
  32. package/dist/src/react-native/uninstall.d.ts +2 -0
  33. package/dist/src/react-native/uninstall.js +130 -0
  34. package/dist/src/react-native/uninstall.js.map +1 -0
  35. package/dist/src/react-native/xcode.d.ts +18 -0
  36. package/dist/src/react-native/xcode.js +170 -0
  37. package/dist/src/react-native/xcode.js.map +1 -0
  38. package/dist/src/remix/remix-wizard.js +1 -1
  39. package/dist/src/remix/remix-wizard.js.map +1 -1
  40. package/dist/src/sourcemaps/tools/nextjs.js +3 -3
  41. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
  42. package/dist/src/sourcemaps/tools/sentry-cli.js +1 -1
  43. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  44. package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
  45. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  46. package/dist/src/utils/clack-utils.d.ts +19 -3
  47. package/dist/src/utils/clack-utils.js +141 -39
  48. package/dist/src/utils/clack-utils.js.map +1 -1
  49. package/dist/src/utils/semver.d.ts +5 -0
  50. package/dist/src/utils/semver.js +27 -0
  51. package/dist/src/utils/semver.js.map +1 -0
  52. package/dist/src/utils/sentrycli-utils.js +4 -1
  53. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  54. package/dist/src/utils/types.d.ts +3 -0
  55. package/dist/src/utils/types.js.map +1 -1
  56. package/dist/test/react-native/gradle.test.js +57 -0
  57. package/dist/test/react-native/gradle.test.js.map +1 -0
  58. package/dist/test/react-native/javascript.test.js +47 -0
  59. package/dist/test/react-native/javascript.test.js.map +1 -0
  60. package/dist/test/react-native/xcode.test.d.ts +1 -0
  61. package/dist/test/react-native/xcode.test.js +144 -0
  62. package/dist/test/react-native/xcode.test.js.map +1 -0
  63. package/lib/Steps/ChooseIntegration.ts +1 -1
  64. package/lib/Steps/Integrations/ReactNative.ts +17 -573
  65. package/package.json +1 -1
  66. package/src/android/android-wizard.ts +3 -18
  67. package/src/apple/apple-wizard.ts +12 -3
  68. package/src/apple/cocoapod.ts +20 -9
  69. package/src/nextjs/nextjs-wizard.ts +1 -1
  70. package/src/react-native/glob.ts +13 -0
  71. package/src/react-native/gradle.ts +26 -0
  72. package/src/react-native/javascript.ts +33 -0
  73. package/src/react-native/options.ts +5 -0
  74. package/src/react-native/react-native-wizard.ts +369 -0
  75. package/src/react-native/uninstall.ts +107 -0
  76. package/src/react-native/xcode.ts +228 -0
  77. package/src/remix/remix-wizard.ts +2 -2
  78. package/src/sourcemaps/tools/nextjs.ts +6 -6
  79. package/src/sourcemaps/tools/sentry-cli.ts +1 -1
  80. package/src/sveltekit/sveltekit-wizard.ts +1 -1
  81. package/src/utils/clack-utils.ts +229 -74
  82. package/src/utils/semver.ts +33 -0
  83. package/src/utils/sentrycli-utils.ts +3 -1
  84. package/src/utils/types.ts +3 -0
  85. package/test/react-native/gradle.test.ts +310 -0
  86. package/test/react-native/javascript.test.ts +131 -0
  87. package/test/react-native/xcode.test.ts +238 -0
  88. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +0 -198
  89. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +0 -1
  90. package/dist/lib/__tests__/Setup.js +0 -57
  91. package/dist/lib/__tests__/Setup.js.map +0 -1
  92. package/lib/Steps/Integrations/__tests__/ReactNative.ts +0 -136
  93. package/lib/__tests__/Setup.ts +0 -42
  94. /package/dist/{lib/Steps/Integrations/__tests__/ReactNative.d.ts → test/react-native/gradle.test.d.ts} +0 -0
  95. /package/dist/{lib/__tests__/Setup.d.ts → test/react-native/javascript.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+CAAqC;AACrC,qCAAyB;AAEzB,qCAAkC;AAClC,wCAA4B;AAC5B,yCAA6B;AAC7B,6BAAiC;AAGjC,0CAK2B;AAC3B,gDAA8D;AAC9D,gDAA2D;AAC3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gEAAgE;gBAChE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpB,gEAAgE;gBAChE,OAAO,OAAO,CAAC,UAAG,GAAG,aAAU,CAAC,CAAC;gBACjC,IAAM,MAAM,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC;gBACtD,IAAI,MAAM,EAAE;oBACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,EAAE;4BAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;4BACpB,MAAM;yBACP;qBACF;iBACF;gBACD,SAAS;aACV;SACF;IACH,CAAC;IAEO,uCAAiB,GAAzB,UACE,SAAiB,EACjB,QAAgB;QAFlB,iBAgBC;QAZC,IAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAI,CAAC,KAAK,CAAC,UAAC,GAAQ;gBAClB,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IA/hBD;;OAEG;IACY,+CAAmC,GAAG,aAAa,CAAC;IA6hBrE,kBAAC;CAAA,AAjiBD,CAAiC,6BAAa,GAiiB7C","sourcesContent":["/* eslint-disable max-lines */\nimport { exec } from 'child_process';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\nimport { promisify } from 'util';\n\nimport type { Args } from '../../Constants';\nimport {\n exists,\n matchesContent,\n matchFiles,\n patchMatchingFile,\n} from '../../Helper/File';\nimport { dim, green, l, nl, red } from '../../Helper/Logging';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport {\n detectPackageManger,\n installPackageWithPackageManager,\n} from '../../../src/utils/package-manager';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\nimport { BottomBar } from '../../Helper/BottomBar';\nimport { URL } from 'url';\n\nconst xcode = require('xcode');\n\nexport const COMPATIBLE_REACT_NATIVE_VERSIONS = '>=0.69.0';\nexport const COMPATIBLE_SDK_VERSION = '>= 5.0.0';\n\nexport const SENTRY_REACT_NATIVE_PACKAGE = '@sentry/react-native';\nexport const REACT_NATIVE_PACKAGE = 'react-native';\n\nexport const DOCS_MANUAL_STEPS =\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/';\n\nexport class ReactNative extends MobileProject {\n /**\n * All React Native versions have app/build.gradle with android section.\n */\n private static _buildGradleAndroidSectionBeginning = /^android {/m;\n\n private url: string | undefined;\n\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this.url = _argv.url;\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n if (this._argv.uninstall) {\n return this.uninstall(answers);\n }\n if (!(await this.shouldEmit(answers))) {\n return {};\n }\n nl();\n\n let userAnswers: Answers = { continue: true };\n const packageManager = detectPackageManger();\n\n const hasCompatibleReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n REACT_NATIVE_PACKAGE,\n COMPATIBLE_REACT_NATIVE_VERSIONS,\n true,\n );\n if (!hasCompatibleReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n \"Your version of React Native is not compatible with Sentry's React Native SDK. Do you want to continue?\",\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_REACT_NATIVE_VERSIONS}. Or use ${DOCS_MANUAL_STEPS}`,\n );\n }\n\n if (packageManager) {\n BottomBar.show(`Adding ${SENTRY_REACT_NATIVE_PACKAGE}...`);\n await installPackageWithPackageManager(\n packageManager,\n SENTRY_REACT_NATIVE_PACKAGE,\n );\n BottomBar.hide();\n green(`✓ Added \\`${SENTRY_REACT_NATIVE_PACKAGE}\\``);\n }\n const hasCompatibleSentryReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n SENTRY_REACT_NATIVE_PACKAGE,\n COMPATIBLE_SDK_VERSION,\n true,\n );\n if (!hasCompatibleSentryReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message: `Your version of ${SENTRY_REACT_NATIVE_PACKAGE} is not compatible with this wizard. Do you want to continue?`,\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_SDK_VERSION}.`,\n );\n }\n\n const sentryCliProperties =\n this._sentryCli.convertAnswersToProperties(answers);\n\n const promises = this.getPlatforms(answers).map(\n async (platform: string) => {\n try {\n if (platform === 'ios') {\n await patchMatchingFile(\n 'ios/*.xcodeproj/project.pbxproj',\n this._patchXcodeProj.bind(this),\n );\n green('✓ Patched build script in Xcode project.');\n BottomBar.show('Adding Sentry pods...');\n await this._podInstall();\n BottomBar.hide();\n green('✓ Pods installed.');\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n green('✓ Patched build.gradle file.');\n }\n await this._patchJsSentryInit(platform, answers);\n await this._addSentryProperties(platform, sentryCliProperties);\n green(`✓ Added sentry.properties file to ${platform}`);\n } catch (e) {\n red(e);\n }\n },\n );\n\n await Promise.all(promises);\n\n let host: string | null = null;\n try {\n host = new URL(this.url || '').host;\n } catch (_error) {\n // ignore\n }\n const orgSlug = _.get(answers, 'config.organization.slug', null);\n const projectId = _.get(answers, 'config.project.id', null);\n const projectIssuesUrl =\n host && orgSlug && projectId\n ? `https://${orgSlug}.${host}/issues/?project=${projectId}`\n : null;\n\n l(`\nTo make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n`);\n\n if (projectIssuesUrl) {\n l(`After that check your project issues:`);\n l(projectIssuesUrl);\n nl();\n }\n\n l(\n `<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>`,\n );\n nl();\n\n if (!this._argv.quiet) {\n await prompt({\n message: 'Have you successfully sent a test event?',\n name: 'snippet',\n default: true,\n type: 'confirm',\n });\n }\n\n return answers;\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n await patchMatchingFile(\n '**/app/build.gradle',\n this._unpatchBuildGradle.bind(this),\n );\n return {};\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {\n let result = false;\n\n if (!exists(`${platform}/sentry.properties`)) {\n result = true;\n this.debug(`${platform}/sentry.properties not exists`);\n }\n\n if (!matchesContent('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj not matched');\n }\n\n if (!matchesContent('**/app/build.gradle', /sentry\\.gradle/gi)) {\n result = true;\n this.debug('**/app/build.gradle not matched');\n }\n\n const regex = /Sentry/gi;\n if (\n exists(`index.${platform}.js`) &&\n !matchesContent(`index.${platform}.js`, regex)\n ) {\n result = true;\n this.debug(`index.${platform}.js not matched`);\n }\n if (exists('App.js') && !matchesContent('App.js', regex)) {\n result = true;\n this.debug('index.js or App.js not matched');\n }\n\n if (this._argv.uninstall) {\n // if we uninstall we need to invert the result so we remove already patched\n // but leave untouched platforms as they are\n return !result;\n }\n\n return result;\n }\n\n private _readAppPackage(): Record<string, unknown> {\n let appPackage: Record<string, unknown> = {};\n\n try {\n appPackage = JSON.parse(\n fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'),\n );\n } catch {\n // We don't need to have this\n }\n\n return appPackage;\n }\n\n private async _podInstall(): Promise<void> {\n await promisify(exec)('npx --yes pod-install --non-interactive --quiet');\n }\n\n private async _patchJsSentryInit(\n platform: string,\n answers: Answers,\n ): Promise<void> {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const platformGlob = `index.${platform}.${suffixGlob}`;\n // rm 0.49 introduced an App.js for both platforms\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;\n\n const jsFileToPatch = matchFiles(jsFileGlob);\n if (jsFileToPatch.length !== 0) {\n await patchMatchingFile(\n jsFileGlob,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n green(`✓ Patched ${jsFileToPatch.join(', ')} file(s).`);\n } else {\n red(`✗ Could not find ${platformGlob} nor ${universalGlob} files.`);\n red('✗ Please, visit https://docs.sentry.io/platforms/react-native');\n }\n }\n\n private _addSentryProperties(\n platform: string,\n properties: any,\n ): Promise<void> {\n let rv = Promise.resolve();\n\n // This will create the ios/android folder before trying to write\n // sentry.properties in it which would fail otherwise\n if (!fs.existsSync(platform)) {\n dim(`${platform} folder did not exist, creating it.`);\n fs.mkdirSync(platform);\n }\n const fn = path.join(platform, 'sentry.properties');\n\n if (platform === 'android' && properties['cli/executable']) {\n // We don't need to write the sentry-cli path in the properties file\n // since our gradle plugins already pick it up on the correct spot\n delete properties['cli/executable'];\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n\n private _patchJs(\n contents: string,\n _filename: string,\n answers: Answers,\n platform?: string,\n ): Promise<string | null> {\n // since the init call could live in other places too, we really only\n // want to do this if we managed to patch any of the other files as well.\n if (contents.match(/Sentry.config\\(/)) {\n return Promise.resolve(null);\n }\n\n // if we match @sentry\\/react-native somewhere, we already patched the file\n // and no longer need to\n if (contents.match('@sentry/react-native')) {\n return Promise.resolve(contents);\n }\n\n let dsn = '__DSN__';\n this.getPlatforms(answers).forEach((selectedPlatform: string) => {\n if (platform && selectedPlatform === platform) {\n dsn = _.get(answers, 'config.dsn.public', null);\n } else if (platform === undefined) {\n dsn = _.get(answers, 'config.dsn.public', null);\n }\n });\n\n return Promise.resolve(\n contents.replace(\n /^([^]*)(import\\s+[^;]*?;$)/m,\n (match) =>\n // eslint-disable-next-line prefer-template\n match +\n \"\\n\\nimport * as Sentry from '@sentry/react-native';\\n\\n\" +\n 'Sentry.init({ \\n' +\n ` dsn: '${dsn}', \\n` +\n '});\\n',\n ),\n );\n }\n\n // ANDROID -----------------------------------------\n\n private _patchBuildGradle(contents: string): Promise<string | null> {\n const applyFrom =\n 'apply from: \"../../node_modules/@sentry/react-native/sentry.gradle\"';\n if (contents.indexOf(applyFrom) >= 0) {\n return Promise.resolve(null);\n }\n\n return Promise.resolve(\n contents.replace(\n ReactNative._buildGradleAndroidSectionBeginning,\n // eslint-disable-next-line prefer-template\n (match) => applyFrom + '\\n' + match,\n ),\n );\n }\n\n private _unpatchBuildGradle(contents: string): Promise<string> {\n return Promise.resolve(\n contents.replace(\n /^\\s*apply from: [\"']..\\/..\\/node_modules\\/@sentry\\/react-native\\/sentry.gradle[\"'];?\\s*?\\r?\\n/m,\n '',\n ),\n );\n }\n\n // IOS -----------------------------------------\n\n private _patchExistingXcodeBuildScripts(buildScripts: any): void {\n for (const script of buildScripts) {\n if (\n !script.shellScript.match(/\\/scripts\\/react-native-xcode\\.sh/i) ||\n script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)\n ) {\n continue;\n }\n let code = JSON.parse(script.shellScript);\n code =\n // eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n code.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"',\n ) +\n '\\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\\n';\n script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (\n script.shellScript.match(\n /sentry-cli\\s+(upload-dsym|debug-files upload)/,\n )\n ) {\n return;\n }\n }\n\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi \nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n`,\n },\n );\n }\n\n private _patchXcodeProj(\n contents: string,\n filename: string,\n ): Promise<string | undefined> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n const buildScripts = [];\n for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||\n {}) {\n if (\n // eslint-disable-next-line no-prototype-builtins\n proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(\n key,\n )\n ) {\n const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];\n if (val.isa) {\n buildScripts.push(val);\n }\n }\n }\n\n try {\n this._patchExistingXcodeBuildScripts(buildScripts);\n } catch (e) {\n red(e);\n }\n try {\n this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n } catch (e) {\n red(e);\n }\n\n // we always modify the xcode file in memory but we only want to save it\n // in case the user wants configuration for ios. This is why we check\n // here first if changes are made before we might prompt the platform\n // continue prompt.\n const newContents = proj.writeSync();\n if (newContents === contents) {\n resolve(undefined);\n } else {\n resolve(newContents);\n }\n });\n });\n }\n\n private _unpatchXcodeBuildScripts(proj: any): void {\n const scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};\n const firstTarget = proj.getFirstTarget().uuid;\n const nativeTargets = proj.hash.project.objects.PBXNativeTarget;\n\n // scripts to patch partially. Run this first so that we don't\n // accidentally delete some scripts later entirely that we only want to\n // rewrite.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments\n if (typeof script === 'string') {\n continue;\n }\n\n // ignore scripts that do not invoke the react-native-xcode command.\n if (!script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)) {\n continue;\n }\n\n script.shellScript = JSON.stringify(\n JSON.parse(script.shellScript)\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n .replace(\n /^\\/bin\\/sh .*?..\\/node_modules\\/@sentry\\/react-native\\/scripts\\/collect-modules.sh\"?\\r?\\n/m,\n '',\n )\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n ),\n );\n }\n\n // scripts to kill entirely.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments and keys that got deleted\n if (typeof script === 'string' || script === undefined) {\n continue;\n }\n\n if (\n script.shellScript.match(\n /@sentry\\/cli\\/bin\\/sentry-cli\\s+(upload-dsym|debug-files upload)\\b/,\n )\n ) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[key];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[`${key}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === key) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n continue;\n }\n }\n }\n\n private _unpatchXcodeProj(\n _contents: string,\n filename: string,\n ): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAoD;AACpD,qFAAqF;AAErF;IAAiC,+BAAe;IAE9C,qBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAEb;QAH4B,WAAK,GAAL,KAAK,CAAM;QAEtC,KAAI,CAAC,IAAI,GAAG,KAAK,CAAC;;IACpB,CAAC;IAEY,0BAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,0CAAoB,EAAC;4BACzB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;4BAC/B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;4BACnB,gBAAgB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;4BAC9C,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;4BAC/B,sCAAsC;yBACvC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAA;;wBANvB,SAMuB,CAAC;wBAExB,sBAAO,EAAE,EAAC;;;;KACX;IAEY,qCAAe,GAA5B,UAA6B,QAAiB;;;gBAC5C,sBAAO,IAAI,CAAC,gBAAgB,EAAC;;;KAC9B;IACH,kBAAC;AAAD,CAAC,AAtBD,CAAiC,iCAAe,GAsB/C;AAtBY,kCAAW","sourcesContent":["import { Answers } from 'inquirer';\nimport { type Args } from '../../Constants';\nimport { BaseIntegration } from './BaseIntegration';\nimport { runReactNativeWizard } from '../../../src/react-native/react-native-wizard';\n\nexport class ReactNative extends BaseIntegration {\n argv: Args;\n public constructor(protected _argv: Args) {\n super(_argv);\n this.argv = _argv;\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runReactNativeWizard({\n promoCode: this._argv.promoCode,\n url: this._argv.url,\n telemetryEnabled: !this._argv.disableTelemetry,\n uninstall: this._argv.uninstall,\n // eslint-disable-next-line no-console\n }).catch(console.error);\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n return this._shouldConfigure;\n }\n}\n"]}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -75,23 +86,7 @@ var codetools = __importStar(require("./code-tools"));
75
86
  var clack_utils_1 = require("../utils/clack-utils");
76
87
  var telemetry_1 = require("../telemetry");
77
88
  var chalk_1 = __importDefault(require("chalk"));
78
- var proguardMappingCliSetupConfig = {
79
- filename: clack_utils_1.SENTRY_PROPERTIES_FILE,
80
- name: 'proguard mappings',
81
- likelyAlreadyHasAuthToken: function (contents) {
82
- return !!contents.match(/auth\.token=./g);
83
- },
84
- tokenContent: function (authToken) {
85
- return "auth.token=".concat(authToken);
86
- },
87
- likelyAlreadyHasOrgAndProject: function (contents) {
88
- return !!(contents.match(/defaults\.org=./g) &&
89
- contents.match(/defaults\.project=./g));
90
- },
91
- orgAndProjContent: function (org, project) {
92
- return "defaults.org=".concat(org, "\ndefaults.project=").concat(project);
93
- },
94
- };
89
+ var proguardMappingCliSetupConfig = __assign(__assign({}, clack_utils_1.propertiesCliSetupConfig), { name: 'proguard mappings' });
95
90
  function runAndroidWizard(options) {
96
91
  return __awaiter(this, void 0, void 0, function () {
97
92
  return __generator(this, function (_a) {
@@ -190,7 +185,7 @@ function runAndroidWizardWithTelemetry(options) {
190
185
  }
191
186
  // ======== STEP 4. Add sentry-cli config file ============
192
187
  clack.log.step("Configuring ".concat(chalk_1.default.bold('proguard mappings upload'), " via the ").concat(chalk_1.default.cyan('sentry.properties'), " file."));
193
- return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)(authToken, proguardMappingCliSetupConfig)];
188
+ return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)({ authToken: authToken }, proguardMappingCliSetupConfig)];
194
189
  case 7:
195
190
  _b.sent();
196
191
  issuesPageLink = selfHosted
@@ -1 +1 @@
1
- {"version":3,"file":"android-wizard.js","sourceRoot":"","sources":["../../../src/android/android-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,qCAAyB;AACzB,yEAAyE;AACzE,oDAAwC;AACxC,yC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kHAIE,CAAC,CAAC;;;;;CACJ;AAED,qCAAqC;AACrC,SAAS,uBAAuB,CAC9B,GAAW,EACX,UAAoB,EACpB,mBAAkC;IAAlC,oCAAA,EAAA,wBAAkC;IAElC,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,IAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;4BAChD,IAAI;QACb,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,uBAAuB,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;SACpE;aAAM,IAAI,UAAU,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAvB,CAAuB,CAAC,EAAE;YAC5D,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzE;;IANH,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK;QAAnB,IAAM,IAAI,cAAA;gBAAJ,IAAI;KAOd;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport * as fs from 'fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as path from 'path';\nimport * as Sentry from '@sentry/node';\nimport * as gradle from './gradle';\nimport * as manifest from './manifest';\nimport * as codetools from './code-tools';\nimport {\n CliSetupConfig,\n SENTRY_PROPERTIES_FILE,\n abort,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport chalk from 'chalk';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_PROPERTIES_FILE,\n name: 'proguard mappings',\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};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n },\n () => runAndroidWizardWithTelemetry(options),\n );\n}\n\nasync function runAndroidWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Android Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const projectDir = process.cwd();\n const buildGradleFiles = findFilesWithExtensions(projectDir, [\n '.gradle',\n 'gradle.kts',\n ]);\n\n if (!buildGradleFiles || buildGradleFiles.length === 0) {\n clack.log.error(\n 'No Gradle project found. Please run this command from the root of your project.',\n );\n Sentry.captureException('No Gradle project found');\n await abort();\n return;\n }\n\n const appFile = await traceStep('Select App File', () =>\n gradle.selectAppFile(buildGradleFiles),\n );\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'android');\n\n // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============\n clack.log.step(\n `Adding ${chalk.bold('Sentry Gradle plugin')} to your app's ${chalk.cyan(\n 'build.gradle',\n )} file.`,\n );\n const pluginAdded = await traceStep('Add Gradle Plugin', () =>\n gradle.addGradlePlugin(\n appFile,\n selectedProject.organization.slug,\n selectedProject.slug,\n ),\n );\n if (!pluginAdded) {\n clack.log.warn(\n \"Could not add Sentry Gradle plugin to your app's build.gradle file. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#install\",\n );\n }\n Sentry.setTag('gradle-plugin-added', pluginAdded);\n\n // ======== STEP 2. Configure Sentry SDK via AndroidManifest ============\n clack.log.step(\n `Configuring Sentry SDK via ${chalk.cyan('AndroidManifest.xml')}`,\n );\n const appDir = path.dirname(appFile);\n const manifestFile = path.join(appDir, 'src', 'main', 'AndroidManifest.xml');\n\n const manifestUpdated = traceStep('Update Android Manifest', () =>\n manifest.addManifestSnippet(\n manifestFile,\n selectedProject.keys[0].dsn.public,\n ),\n );\n if (!manifestUpdated) {\n clack.log.warn(\n \"Could not configure the Sentry SDK. You'll have to do it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#configure\",\n );\n }\n Sentry.setTag('android-manifest-updated', manifestUpdated);\n\n // ======== STEP 3. Patch Main Activity with a test error snippet ============\n clack.log.step(\n `Patching ${chalk.bold('Main Activity')} with a test error snippet.`,\n );\n const mainActivity = traceStep('Find Main Activity', () =>\n manifest.getMainActivity(manifestFile),\n );\n let packageName = mainActivity.packageName;\n if (!packageName) {\n // if no package name in AndroidManifest, look into gradle script\n packageName = gradle.getNamespace(appFile);\n }\n const activityName = mainActivity.activityName;\n Sentry.setTag('has-activity-name', !!activityName);\n Sentry.setTag('has-package-name', !!packageName);\n if (!activityName || !packageName) {\n clack.log.warn(\n \"Could not find Activity with intent action MAIN. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n Sentry.captureException('Could not find Main Activity');\n } else {\n const packageNameStable = packageName;\n const activityFile = traceStep('Find Main Activity Source File', () =>\n codetools.findActivitySourceFile(appDir, packageNameStable, activityName),\n );\n\n const activityPatched = traceStep('Patch Main Activity', () =>\n codetools.patchMainActivity(activityFile),\n );\n if (!activityPatched) {\n clack.log.warn(\n \"Could not patch main activity. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n }\n Sentry.setTag('main-activity-patched', activityPatched);\n }\n\n // ======== STEP 4. Add sentry-cli config file ============\n clack.log.step(\n `Configuring ${chalk.bold('proguard mappings upload')} via the ${chalk.cyan(\n 'sentry.properties',\n )} file.`,\n );\n\n await addSentryCliConfig(authToken, proguardMappingCliSetupConfig);\n\n // ======== OUTRO ========\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n${chalk.greenBright('Successfully installed the Sentry Android SDK!')}\n\n${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n${issuesPageLink}`,\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n `);\n}\n\n//find files with the given extension\nfunction findFilesWithExtensions(\n dir: string,\n extensions: string[],\n filesWithExtensions: string[] = [],\n): string[] {\n const cwd = process.cwd();\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (file.isDirectory()) {\n const childDir = path.join(dir, file.name);\n findFilesWithExtensions(childDir, extensions, filesWithExtensions);\n } else if (extensions.some((ext) => file.name.endsWith(ext))) {\n filesWithExtensions.push(path.relative(cwd, path.join(dir, file.name)));\n }\n }\n return filesWithExtensions;\n}\n"]}
1
+ {"version":3,"file":"android-wizard.js","sourceRoot":"","sources":["../../../src/android/android-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,qCAAyB;AACzB,yEAAyE;AACzE,oDAAwC;AACxC,yCAA6B;AAC7B,mDAAuC;AACvC,+CAAmC;AACnC,mDAAu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C;SACpE;aAAM,IAAI,UAAU,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAvB,CAAuB,CAAC,EAAE;YAC5D,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzE;;IANH,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK;QAAnB,IAAM,IAAI,cAAA;gBAAJ,IAAI;KAOd;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport * as fs from 'fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as path from 'path';\nimport * as Sentry from '@sentry/node';\nimport * as gradle from './gradle';\nimport * as manifest from './manifest';\nimport * as codetools from './code-tools';\nimport {\n CliSetupConfig,\n abort,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n propertiesCliSetupConfig,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport chalk from 'chalk';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n ...propertiesCliSetupConfig,\n name: 'proguard mappings',\n};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n },\n () => runAndroidWizardWithTelemetry(options),\n );\n}\n\nasync function runAndroidWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Android Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const projectDir = process.cwd();\n const buildGradleFiles = findFilesWithExtensions(projectDir, [\n '.gradle',\n 'gradle.kts',\n ]);\n\n if (!buildGradleFiles || buildGradleFiles.length === 0) {\n clack.log.error(\n 'No Gradle project found. Please run this command from the root of your project.',\n );\n Sentry.captureException('No Gradle project found');\n await abort();\n return;\n }\n\n const appFile = await traceStep('Select App File', () =>\n gradle.selectAppFile(buildGradleFiles),\n );\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'android');\n\n // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============\n clack.log.step(\n `Adding ${chalk.bold('Sentry Gradle plugin')} to your app's ${chalk.cyan(\n 'build.gradle',\n )} file.`,\n );\n const pluginAdded = await traceStep('Add Gradle Plugin', () =>\n gradle.addGradlePlugin(\n appFile,\n selectedProject.organization.slug,\n selectedProject.slug,\n ),\n );\n if (!pluginAdded) {\n clack.log.warn(\n \"Could not add Sentry Gradle plugin to your app's build.gradle file. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#install\",\n );\n }\n Sentry.setTag('gradle-plugin-added', pluginAdded);\n\n // ======== STEP 2. Configure Sentry SDK via AndroidManifest ============\n clack.log.step(\n `Configuring Sentry SDK via ${chalk.cyan('AndroidManifest.xml')}`,\n );\n const appDir = path.dirname(appFile);\n const manifestFile = path.join(appDir, 'src', 'main', 'AndroidManifest.xml');\n\n const manifestUpdated = traceStep('Update Android Manifest', () =>\n manifest.addManifestSnippet(\n manifestFile,\n selectedProject.keys[0].dsn.public,\n ),\n );\n if (!manifestUpdated) {\n clack.log.warn(\n \"Could not configure the Sentry SDK. You'll have to do it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#configure\",\n );\n }\n Sentry.setTag('android-manifest-updated', manifestUpdated);\n\n // ======== STEP 3. Patch Main Activity with a test error snippet ============\n clack.log.step(\n `Patching ${chalk.bold('Main Activity')} with a test error snippet.`,\n );\n const mainActivity = traceStep('Find Main Activity', () =>\n manifest.getMainActivity(manifestFile),\n );\n let packageName = mainActivity.packageName;\n if (!packageName) {\n // if no package name in AndroidManifest, look into gradle script\n packageName = gradle.getNamespace(appFile);\n }\n const activityName = mainActivity.activityName;\n Sentry.setTag('has-activity-name', !!activityName);\n Sentry.setTag('has-package-name', !!packageName);\n if (!activityName || !packageName) {\n clack.log.warn(\n \"Could not find Activity with intent action MAIN. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n Sentry.captureException('Could not find Main Activity');\n } else {\n const packageNameStable = packageName;\n const activityFile = traceStep('Find Main Activity Source File', () =>\n codetools.findActivitySourceFile(appDir, packageNameStable, activityName),\n );\n\n const activityPatched = traceStep('Patch Main Activity', () =>\n codetools.patchMainActivity(activityFile),\n );\n if (!activityPatched) {\n clack.log.warn(\n \"Could not patch main activity. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n }\n Sentry.setTag('main-activity-patched', activityPatched);\n }\n\n // ======== STEP 4. Add sentry-cli config file ============\n clack.log.step(\n `Configuring ${chalk.bold('proguard mappings upload')} via the ${chalk.cyan(\n 'sentry.properties',\n )} file.`,\n );\n\n await addSentryCliConfig({ authToken }, proguardMappingCliSetupConfig);\n\n // ======== OUTRO ========\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n${chalk.greenBright('Successfully installed the Sentry Android SDK!')}\n\n${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n${issuesPageLink}`,\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n `);\n}\n\n//find files with the given extension\nfunction findFilesWithExtensions(\n dir: string,\n extensions: string[],\n filesWithExtensions: string[] = [],\n): string[] {\n const cwd = process.cwd();\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (file.isDirectory()) {\n const childDir = path.join(dir, file.name);\n findFilesWithExtensions(childDir, extensions, filesWithExtensions);\n } else if (extensions.some((ext) => file.name.endsWith(ext))) {\n filesWithExtensions.push(path.relative(cwd, path.join(dir, file.name)));\n }\n }\n return filesWithExtensions;\n}\n"]}
@@ -96,7 +96,7 @@ function runAppleWizard(options) {
96
96
  exports.runAppleWizard = runAppleWizard;
97
97
  function runAppleWizardWithTelementry(options) {
98
98
  return __awaiter(this, void 0, void 0, function () {
99
- var hasCli, projectDir, xcodeProjFiles, xcodeProjFile, pbxproj, _a, project, apiKey, xcProject, availableTargets, target, _b, hasCocoa, pm, podAdded, codeAdded, addLane, added;
99
+ var hasCli, projectDir, xcodeProjFiles, xcodeProjFile, pbxproj, _a, project, apiKey, xcProject, availableTargets, target, _b, hasCocoa, pm, podAdded, codeAdded, hasFastlane, addLane, added;
100
100
  return __generator(this, function (_c) {
101
101
  switch (_c.label) {
102
102
  case 0:
@@ -158,6 +158,7 @@ function runAppleWizardWithTelementry(options) {
158
158
  availableTargets = xcProject.getAllTargets();
159
159
  if (!(availableTargets.length == 0)) return [3 /*break*/, 15];
160
160
  prompts_1.default.log.error("No suttable target found in ".concat(xcodeProjFile));
161
+ Sentry.setTag('No-Target', true);
161
162
  return [4 /*yield*/, (0, clack_utils_1.abort)()];
162
163
  case 14:
163
164
  _c.sent();
@@ -177,6 +178,7 @@ function runAppleWizardWithTelementry(options) {
177
178
  SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });
178
179
  prompts_1.default.log.info('We created a ".sentryclirc" file in your project directory in order to provide an auth token for Sentry CLI.\nIt was also added to your ".gitignore" file.\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.');
179
180
  hasCocoa = cocoapod.usesCocoaPod(projectDir);
181
+ Sentry.setTag('cocoapod-exists', hasCocoa);
180
182
  if (!hasCocoa) return [3 /*break*/, 21];
181
183
  return [4 /*yield*/, (0, telemetry_1.traceStep)('Choose a package manager', function () {
182
184
  return (0, clack_utils_1.askForItemSelection)(['Swift Package Manager', 'CocoaPods'], 'Which package manager would you like to use to add Sentry?');
@@ -190,37 +192,42 @@ function runAppleWizardWithTelementry(options) {
190
192
  })];
191
193
  case 20:
192
194
  podAdded = _c.sent();
195
+ Sentry.setTag('cocoapod-added', podAdded);
193
196
  if (!podAdded) {
194
197
  prompts_1.default.log.warn("Could not add Sentry pod to your Podfile. You'll have to add it manually.\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install");
195
198
  }
196
199
  _c.label = 21;
197
200
  case 21:
201
+ Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');
198
202
  (0, telemetry_1.traceStep)('Update Xcode project', function () {
199
203
  xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);
200
204
  });
201
- Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');
202
205
  codeAdded = (0, telemetry_1.traceStep)('Add code snippet', function () {
203
206
  var files = xcProject.filesForTarget(target);
204
207
  if (files === undefined || files.length == 0)
205
208
  return false;
206
209
  return codeTools.addCodeSnippetToProject(projectDir, files, project.keys[0].dsn.public);
207
210
  });
211
+ Sentry.setTag('Snippet-Added', codeAdded);
208
212
  if (!codeAdded) {
209
213
  prompts_1.default.log.warn('Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure');
210
- return [2 /*return*/];
211
214
  }
212
- if (!fastlane.fastFile(projectDir)) return [3 /*break*/, 24];
215
+ hasFastlane = fastlane.fastFile(projectDir);
216
+ Sentry.setTag('fastlane-exists', hasFastlane);
217
+ if (!hasFastlane) return [3 /*break*/, 24];
213
218
  return [4 /*yield*/, prompts_1.default.confirm({
214
219
  message: 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',
215
220
  })];
216
221
  case 22:
217
222
  addLane = _c.sent();
223
+ Sentry.setTag('fastlane-desired', addLane);
218
224
  if (!addLane) return [3 /*break*/, 24];
219
225
  return [4 /*yield*/, (0, telemetry_1.traceStep)('Configure fastlane', function () {
220
226
  return fastlane.addSentryToFastlane(projectDir, project.organization.slug, project.slug);
221
227
  })];
222
228
  case 23:
223
229
  added = _c.sent();
230
+ Sentry.setTag('fastlane-added', added);
224
231
  if (added) {
225
232
  prompts_1.default.log.step('A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.');
226
233
  }
@@ -1 +1 @@
1
- {"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AACzB,yCAA6B;AAC7B,iDAA+C;AAC/C,sDAA0C;AAC1C,kDAAsC;AACtC,oEAAwD;AAExD,mDAAuC;AACvC,0CAAwD;AACxD,mDAAuC;AACvC,mDAAuC;AAEvC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,qDAAqD;AAErD,oDAO8B;AAE9B,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,KAAK;iBACnB,EACD,cAAM,OAAA,4BAA4B,CAAC,OAAO,CAAC,EAArC,CAAqC,CAC5C,EAAC;;;CACH;AARD,wCAQC;AAED,SAAe,4BAA4B,CACzC,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE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KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAxB,CAAwB,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\nconst xcode = require('xcode');\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suttable target found in ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n return;\n }\n\n if (fastlane.fastFile(projectDir)) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
1
+ {"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AACzB,yCAA6B;AAC7B,iDAA+C;AAC/C,sDAA0C;AAC1C,kDAAsC;AACtC,oEAAwD;AAExD,mDAAuC;AACvC,0CAAwD;AACxD,mDAAuC;AACvC,mDAAuC;AAEvC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,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eAAe,GAAG,IAAI,CAAC,IAAI,CAC/B,EAAE,EACF,SAAS,CAAC,CAAC,CAAC,EACZ,0BAA0B,CAC3B,CAAC;IACF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;QACnC,OAAO,EAAE,CAAC;KACX;IACD,IAAM,UAAU,GAAG,iCAAiC,CAAC;IACrD,IAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACzD,IAAI,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,OAAO,EAAE;QACd,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,IACE,CAAC,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACjC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC5B,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EACxB;YACA,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACnB;QACD,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qCAAqC;AACrC,SAAS,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IAC5D,IAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAxB,CAAwB,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\nconst xcode = require('xcode');\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suttable target found in ${xcodeProjFile}`);\n Sentry.setTag('No-Target', true);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n Sentry.setTag('cocoapod-exists', hasCocoa);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n Sentry.setTag('cocoapod-added', podAdded);\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n\n Sentry.setTag('Snippet-Added', codeAdded);\n\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n Sentry.setTag('fastlane-desired', addLane);\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n Sentry.setTag('fastlane-added', added);\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  export declare function usesCocoaPod(projPath: string): boolean;
2
2
  export declare function addCocoaPods(projPath: string): Promise<boolean>;
3
+ export declare function podInstall(dir?: string): Promise<void>;
@@ -58,21 +58,25 @@ 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 __importDefault = (this && this.__importDefault) || function (mod) {
62
+ return (mod && mod.__esModule) ? mod : { "default": mod };
63
+ };
61
64
  Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.addCocoaPods = exports.usesCocoaPod = void 0;
65
+ exports.podInstall = exports.addCocoaPods = exports.usesCocoaPod = void 0;
63
66
  var fs = __importStar(require("fs"));
64
67
  var path = __importStar(require("path"));
65
68
  var bash = __importStar(require("../utils/bash"));
66
69
  var Sentry = __importStar(require("@sentry/node"));
67
70
  // @ts-ignore - clack is ESM and TS complains about that. It works though
68
71
  var clack = __importStar(require("@clack/prompts"));
72
+ var chalk_1 = __importDefault(require("chalk"));
69
73
  function usesCocoaPod(projPath) {
70
74
  return fs.existsSync(path.join(projPath, 'Podfile'));
71
75
  }
72
76
  exports.usesCocoaPod = usesCocoaPod;
73
77
  function addCocoaPods(projPath) {
74
78
  return __awaiter(this, void 0, void 0, function () {
75
- var podfile, podContent, podMatch, frameworkMatch, insertIndex, newFileContent, loginSpinner, e_1;
79
+ var podfile, podContent, podMatch, frameworkMatch, insertIndex, newFileContent;
76
80
  return __generator(this, function (_a) {
77
81
  switch (_a.label) {
78
82
  case 0:
@@ -97,27 +101,46 @@ function addCocoaPods(projPath) {
97
101
  "pod 'Sentry'\n" +
98
102
  podContent.slice(insertIndex);
99
103
  fs.writeFileSync(podfile, newFileContent, 'utf8');
100
- loginSpinner = clack.spinner();
101
104
  clack.log.step('Sentry pod added to the project podFile.');
102
- loginSpinner.start("Running 'pod install'. This may take a few minutes...");
105
+ return [4 /*yield*/, podInstall()];
106
+ case 1:
107
+ _a.sent();
108
+ return [2 /*return*/, true];
109
+ }
110
+ });
111
+ });
112
+ }
113
+ exports.addCocoaPods = addCocoaPods;
114
+ function podInstall(dir) {
115
+ if (dir === void 0) { dir = '.'; }
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var installSpinner, e_1;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0:
121
+ installSpinner = clack.spinner();
122
+ installSpinner.start("Running 'pod install'. This may take a few minutes...");
103
123
  _a.label = 1;
104
124
  case 1:
105
- _a.trys.push([1, 3, , 4]);
106
- return [4 /*yield*/, bash.execute('pod install --silent')];
125
+ _a.trys.push([1, 4, , 5]);
126
+ return [4 /*yield*/, bash.execute("cd ".concat(dir, " && pod repo update"))];
107
127
  case 2:
108
128
  _a.sent();
109
- loginSpinner.stop('Running "pod install"');
110
- return [3 /*break*/, 4];
129
+ return [4 /*yield*/, bash.execute("cd ".concat(dir, " && pod install --silent"))];
111
130
  case 3:
131
+ _a.sent();
132
+ installSpinner.stop('Pods installed.');
133
+ return [3 /*break*/, 5];
134
+ case 4:
112
135
  e_1 = _a.sent();
113
- loginSpinner.stop('Running "pod install"');
114
- clack.log.error('Failed to run "pod install". You can run it manually for more details.');
136
+ installSpinner.stop('Failed to install pods.');
137
+ clack.log.error("".concat(chalk_1.default.red('Encountered the following error during pods installation:'), "\n\n").concat(e_1, "\n\n").concat(chalk_1.default.dim('If you think this issue is caused by the Sentry wizard, let us know here:\nhttps://github.com/getsentry/sentry-wizard/issues')));
115
138
  Sentry.captureException('Sentry pod install failed.');
116
- return [3 /*break*/, 4];
117
- case 4: return [2 /*return*/, true];
139
+ return [3 /*break*/, 5];
140
+ case 5: return [2 /*return*/];
118
141
  }
119
142
  });
120
143
  });
121
144
  }
122
- exports.addCocoaPods = addCocoaPods;
145
+ exports.podInstall = podInstall;
123
146
  //# sourceMappingURL=cocoapod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cocoapod.js","sourceRoot":"","sources":["../../../src/apple/cocoapod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,kDAAsC;AACtC,mDAAuC;AACvC,yEAAyE;AACzE,oDAAwC;AAExC,SAAgB,YAAY,CAAC,QAAgB;IAC3C,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACvD,CAAC;AAFD,oCAEC;AAED,SAAsB,YAAY,CAAC,QAAgB;;;;;;oBAC3C,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;oBAEzC,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;oBAEpD,IACE,wDAAwD,CAAC,IAAI,CAAC,UAAU,CAAC,EACz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bash from '../utils/bash';\nimport * as Sentry from '@sentry/node';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n\nexport function usesCocoaPod(projPath: string): boolean {\n return fs.existsSync(path.join(projPath, 'Podfile'));\n}\n\nexport async function addCocoaPods(projPath: string): Promise<boolean> {\n const podfile = path.join(projPath, 'Podfile');\n\n const podContent = fs.readFileSync(podfile, 'utf8');\n\n if (\n /^\\s*pod\\s+(['\"]Sentry['\"]|['\"]SentrySwiftUI['\"])\\s*$/im.test(podContent)\n ) {\n // Already have Sentry pod\n return true;\n }\n\n let podMatch = /^( *)pod\\s+['\"](\\w+)['\"] *$/im.exec(podContent);\n if (!podMatch) {\n // No Podfile is empty, will try to add Sentry pod after \"use_frameworks!\"\n const frameworkMatch = /^( *)use_frameworks![^\\n]* *$/im.exec(podContent);\n if (!frameworkMatch) {\n return false;\n }\n podMatch = frameworkMatch;\n }\n\n const insertIndex = podMatch.index + podMatch[0].length;\n const newFileContent =\n podContent.slice(0, insertIndex) +\n '\\n' +\n podMatch[1] +\n \"pod 'Sentry'\\n\" +\n podContent.slice(insertIndex);\n fs.writeFileSync(podfile, newFileContent, 'utf8');\n\n const loginSpinner = clack.spinner();\n\n clack.log.step('Sentry pod added to the project podFile.');\n loginSpinner.start(\"Running 'pod install'. This may take a few minutes...\");\n\n try {\n await bash.execute('pod install --silent');\n loginSpinner.stop('Running \"pod install\"');\n } catch (e) {\n loginSpinner.stop('Running \"pod install\"');\n clack.log.error(\n 'Failed to run \"pod install\". You can run it manually for more details.',\n );\n Sentry.captureException('Sentry pod install failed.');\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"cocoapod.js","sourceRoot":"","sources":["../../../src/apple/cocoapod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,kDAAsC;AACtC,mDAAuC;AACvC,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I,EAAC;;;;CACb;AApCD,oCAoCC;AAED,SAAsB,UAAU,CAAC,GAAS;IAAT,oBAAA,EAAA,SAAS;;;;;;oBAClC,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;oBACvC,cAAc,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;;;;oBAG5E,qBAAM,IAAI,CAAC,OAAO,CAAC,aAAM,GAAG,wBAAqB,CAAC,EAAA;;oBAAlD,SAAkD,CAAC;oBACnD,qBAAM,IAAI,CAAC,OAAO,CAAC,aAAM,GAAG,6BAA0B,CAAC,EAAA;;oBAAvD,SAAuD,CAAC;oBACxD,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;;;;oBAEvC,cAAc,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;oBAC/C,KAAK,CAAC,GAAG,CAAC,KAAK,CACb,UAAG,eAAK,CAAC,GAAG,CACV,2DAA2D,CAE5D,iBAAO,GAAC,iBAAO,eAAK,CAAC,GAAG,CACvB,8HAA8H,CAC/H,CAAE,CACJ,CAAC;oBACF,MAAM,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,CAAC;;;;;;CAEzD;AApBD,gCAoBC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as bash from '../utils/bash';\nimport * as Sentry from '@sentry/node';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nexport function usesCocoaPod(projPath: string): boolean {\n return fs.existsSync(path.join(projPath, 'Podfile'));\n}\n\nexport async function addCocoaPods(projPath: string): Promise<boolean> {\n const podfile = path.join(projPath, 'Podfile');\n\n const podContent = fs.readFileSync(podfile, 'utf8');\n\n if (\n /^\\s*pod\\s+(['\"]Sentry['\"]|['\"]SentrySwiftUI['\"])\\s*$/im.test(podContent)\n ) {\n // Already have Sentry pod\n return true;\n }\n\n let podMatch = /^( *)pod\\s+['\"](\\w+)['\"] *$/im.exec(podContent);\n if (!podMatch) {\n // No Podfile is empty, will try to add Sentry pod after \"use_frameworks!\"\n const frameworkMatch = /^( *)use_frameworks![^\\n]* *$/im.exec(podContent);\n if (!frameworkMatch) {\n return false;\n }\n podMatch = frameworkMatch;\n }\n\n const insertIndex = podMatch.index + podMatch[0].length;\n const newFileContent =\n podContent.slice(0, insertIndex) +\n '\\n' +\n podMatch[1] +\n \"pod 'Sentry'\\n\" +\n podContent.slice(insertIndex);\n fs.writeFileSync(podfile, newFileContent, 'utf8');\n\n clack.log.step('Sentry pod added to the project podFile.');\n\n await podInstall();\n\n return true;\n}\n\nexport async function podInstall(dir = '.') {\n const installSpinner = clack.spinner();\n installSpinner.start(\"Running 'pod install'. This may take a few minutes...\");\n\n try {\n await bash.execute(`cd ${dir} && pod repo update`);\n await bash.execute(`cd ${dir} && pod install --silent`);\n installSpinner.stop('Pods installed.');\n } catch (e) {\n installSpinner.stop('Failed to install pods.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during pods installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n 'If you think this issue is caused by the Sentry wizard, let us know here:\\nhttps://github.com/getsentry/sentry-wizard/issues',\n )}`,\n );\n Sentry.captureException('Sentry pod install failed.');\n }\n}\n"]}
@@ -138,7 +138,7 @@ function runNextjsWizardWithTelemetry(options) {
138
138
  }); }); })];
139
139
  case 7:
140
140
  _c.sent();
141
- return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)(authToken)];
141
+ return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)({ authToken: authToken })];
142
142
  case 8:
143
143
  _c.sent();
144
144
  mightBeUsingVercel = fs.existsSync(path.join(process.cwd(), 'vercel.json'));