@sentry/wizard 2.0.0 → 2.1.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 (34) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/NextJs/sentry_sample_error.js +47 -0
  3. package/dist/lib/Constants.d.ts +1 -1
  4. package/dist/lib/Constants.js.map +1 -1
  5. package/dist/lib/Helper/File.d.ts +1 -0
  6. package/dist/lib/Helper/File.js +9 -3
  7. package/dist/lib/Helper/File.js.map +1 -1
  8. package/dist/lib/Helper/Logging.d.ts +1 -0
  9. package/dist/lib/Helper/Logging.js +5 -1
  10. package/dist/lib/Helper/Logging.js.map +1 -1
  11. package/dist/lib/Helper/__tests__/SentryCli.js +1 -1
  12. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  13. package/dist/lib/Steps/Integrations/Electron.js +2 -11
  14. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  15. package/dist/lib/Steps/Integrations/NextJs.js +16 -5
  16. package/dist/lib/Steps/Integrations/NextJs.js.map +1 -1
  17. package/dist/lib/Steps/Integrations/ReactNative.d.ts +1 -0
  18. package/dist/lib/Steps/Integrations/ReactNative.js +34 -13
  19. package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
  20. package/dist/lib/Steps/Integrations/__tests__/ReactNative.d.ts +1 -0
  21. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +103 -0
  22. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +1 -0
  23. package/lib/Constants.ts +1 -1
  24. package/lib/Helper/File.ts +8 -2
  25. package/lib/Helper/Logging.ts +4 -0
  26. package/lib/Helper/__tests__/SentryCli.ts +1 -1
  27. package/lib/Steps/Integrations/Electron.ts +1 -25
  28. package/lib/Steps/Integrations/NextJs.ts +29 -1
  29. package/lib/Steps/Integrations/ReactNative.ts +29 -16
  30. package/lib/Steps/Integrations/__tests__/ReactNative.ts +67 -0
  31. package/package.json +4 -1
  32. package/scripts/NextJs/sentry_sample_error.js +47 -0
  33. package/dist/Electron/symbols.js +0 -94
  34. package/scripts/Electron/symbols.js +0 -94
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,uBAAyB;AAEzB,0BAA4B;AAC5B,2BAA6B;AAG7B,0CAA8E;AAC9E,gDAAuD;AACvD,oDAAmD;AACnD,iDAAgD;AAEhD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B;IAAiC,+BAAa;IAI5C,qBAAsB,KAAW;QAAjC,YACE,kBAAM,KAAK,CAAC,SAEb;QAHqB,WAAK,GAAL,KAAK,CAAM;QAE/B,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,0BAAI,GAAjB,UAAkB,OAAgB;;;;;;;wBAChC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;4BACxB,sBAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC;yBAChC;wBACK,qBAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAA;;wBAApC,IAAI,CAAC,CAAC,SAA8B,CAAC,EAAE;4BACrC,sBAAO,EAAE,EAAC;yBACX;wBAEK,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,0BAA0B,CACpE,OAAO,CACR,CAAC;wBAEF,qDAAqD;wBACrD,sBAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;;oCACjC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,CAC7C,UAAO,QAAgB;;;;;;yDAEf,CAAA,QAAQ,KAAK,KAAK,CAAA,EAAlB,wBAAkB;oDACpB,qB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E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpB,gEAAgE;gBAChE,OAAO,OAAO,CAAI,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;IACH,kBAAC;AAAD,CAAC,AA3YD,CAAiC,6BAAa,GA2Y7C;AA3YY,kCAAW","sourcesContent":["/* eslint-disable max-lines */\nimport * as fs from 'fs';\nimport { Answers } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport { Args } from '../../Constants';\nimport { exists, matchesContent, patchMatchingFile } from '../../Helper/File';\nimport { dim, green, red } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\n\nconst xcode = require('xcode');\n\nexport class ReactNative extends MobileProject {\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n constructor(protected _argv: Args) {\n super(_argv);\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\n const sentryCliProperties = this._sentryCli.convertAnswersToProperties(\n answers,\n );\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\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 dim(`✅ Patched build script in Xcode project.`);\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n dim(`✅ Patched build.gradle file.`);\n }\n await patchMatchingFile(\n `index.${platform}.js`,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n // rm 0.49 introduced an App.js for both platforms\n await patchMatchingFile(\n 'App.js',\n this._patchJs.bind(this),\n answers,\n platform,\n );\n dim(`✅ Patched App.js file.`);\n await this._addSentryProperties(platform, sentryCliProperties);\n dim(`✅ Added sentry.properties file to ${platform}`);\n\n green(`Successfully set up ${platform} for react-native`);\n } catch (e) {\n red(e);\n }\n },\n );\n Promise.all(promises)\n .then(resolve)\n .catch(reject);\n });\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 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 _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 return Promise.resolve(\n contents.replace(\n /^apply from: \"..\\/..\\/node_modules\\/react-native\\/react.gradle\"/m,\n // eslint-disable-next-line prefer-template\n match => match + '\\n' + applyFrom,\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(\n /\\/scripts\\/react-native-xcode\\.sh/i,\n ) ||\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\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 script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/sentry-cli\\s+upload-dsym/)) {\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:\n 'export SENTRY_PROPERTIES=sentry.properties\\\\n' +\n '../node_modules/@sentry/cli/bin/sentry-cli upload-dsym',\n },\n );\n }\n\n private _patchXcodeProj(contents: string, filename: string): 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 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();\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 // 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\\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,uBAAyB;AAEzB,0BAA4B;AAC5B,2BAA6B;AAG7B,0CAA0F;AAC1F,gD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,KAAK,SAAS,EAAE;gBACtD,SAAS;aACV;YAED,IACE,MAAM,CAAC,WAAW,CAAC,KAAK,CACtB,+CAA+C,CAChD,EACD;gBACA,gEAAgE;gBAChE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpB,gEAAgE;gBAChE,OAAO,OAAO,CAAI,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;IACH,kBAAC;AAAD,CAAC,AAxZD,CAAiC,6BAAa,GAwZ7C;AAxZY,kCAAW","sourcesContent":["/* eslint-disable max-lines */\nimport * as fs from 'fs';\nimport { Answers } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport { Args } from '../../Constants';\nimport { exists, matchesContent, matchFiles, patchMatchingFile } from '../../Helper/File';\nimport { dim, green, red, yellow } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\n\nconst xcode = require('xcode');\n\nexport class ReactNative extends MobileProject {\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n constructor(protected _argv: Args) {\n super(_argv);\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\n const sentryCliProperties = this._sentryCli.convertAnswersToProperties(\n answers,\n );\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\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 dim(`✅ Patched build script in Xcode project.`);\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n dim(`✅ Patched build.gradle file.`);\n }\n await this._patchJsSentryInit(platform, answers);\n await this._addSentryProperties(platform, sentryCliProperties);\n dim(`✅ Added sentry.properties file to ${platform}`);\n\n green(`Successfully set up ${platform} for react-native`);\n } catch (e) {\n red(e);\n }\n },\n );\n Promise.all(promises)\n .then(resolve)\n .catch(reject);\n });\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 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 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 dim(`✅ Patched ${jsFileToPatch.join(', ')} file(s).`);\n } else {\n dim(`🚨 Could not find ${platformGlob} nor ${universalGlob} files.`);\n yellow('❓ 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 return Promise.resolve(\n contents.replace(\n /^apply from: \"..\\/..\\/node_modules\\/react-native\\/react.gradle\"/m,\n // eslint-disable-next-line prefer-template\n match => match + '\\n' + applyFrom,\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(\n /\\/scripts\\/react-native-xcode\\.sh/i,\n ) ||\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\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 script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/sentry-cli\\s+upload-dsym/)) {\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:\n 'export SENTRY_PROPERTIES=sentry.properties\\\\n' +\n '../node_modules/@sentry/cli/bin/sentry-cli upload-dsym',\n },\n );\n }\n\n private _patchXcodeProj(contents: string, filename: string): 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 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();\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 // 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\\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"]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ jest.mock('../../../Helper/Logging.ts'); // We mock logging to not pollute the output
40
+ var fs = require("fs");
41
+ var process = require("process");
42
+ var rimraf = require("rimraf");
43
+ var Constants_1 = require("../../../Constants");
44
+ var ReactNative_1 = require("../ReactNative");
45
+ var testDir = 'rn-test';
46
+ var iosIndexJs = 'index.ios.js';
47
+ var appTsx = 'src/App.tsx';
48
+ var dummyJsContent = 'import React from "react";\n';
49
+ var testArgs = {
50
+ debug: false,
51
+ integration: Constants_1.Integration.reactNative,
52
+ platform: [Constants_1.Platform.ios],
53
+ quiet: true,
54
+ skipConnect: true,
55
+ uninstall: false,
56
+ url: 'https://not.used',
57
+ };
58
+ var testAnswers = {
59
+ shouldConfigurePlatforms: { 'ios': true },
60
+ config: {
61
+ dsn: {
62
+ public: 'dns.public.com',
63
+ },
64
+ },
65
+ };
66
+ describe('ReactNative', function () {
67
+ var defaultCwd = process.cwd();
68
+ beforeEach(function () {
69
+ rimraf.sync(testDir);
70
+ fs.mkdirSync(testDir);
71
+ process.chdir(testDir);
72
+ fs.writeFileSync(iosIndexJs, dummyJsContent);
73
+ fs.mkdirSync('src');
74
+ fs.writeFileSync(appTsx, dummyJsContent);
75
+ });
76
+ afterEach(function () {
77
+ process.chdir(defaultCwd);
78
+ rimraf.sync(testDir);
79
+ });
80
+ test('patches js files', function () { return __awaiter(void 0, void 0, void 0, function () {
81
+ var project, patchedIosIndexJs, patchedAppTsx, expectedPatch;
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0:
85
+ project = new ReactNative_1.ReactNative(testArgs);
86
+ return [4 /*yield*/, project.emit(testAnswers)];
87
+ case 1:
88
+ _a.sent();
89
+ patchedIosIndexJs = fs.readFileSync(iosIndexJs, 'utf8');
90
+ patchedAppTsx = fs.readFileSync(appTsx, 'utf8');
91
+ expectedPatch = 'import React from "react";\n\n' +
92
+ 'import * as Sentry from \'@sentry/react-native\';\n\n' +
93
+ 'Sentry.init({ \n' +
94
+ ' dsn: \'dns.public.com\', \n' +
95
+ '});\n\n';
96
+ expect(patchedIosIndexJs).toEqual(expectedPatch);
97
+ expect(patchedAppTsx).toEqual(expectedPatch);
98
+ return [2 /*return*/];
99
+ }
100
+ });
101
+ }); });
102
+ });
103
+ //# sourceMappingURL=ReactNative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../../lib/Steps/Integrations/__tests__/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC,4CAA4C;AACrF,uBAAyB;AAEzB,iCAAmC;AACnC,+BAAiC;AAEjC,gDAAiE;AACjE,8CAA6C;AAE7C,IAAM,OAAO,GAAG,SAAS,CAAC;AAC1B,IAAM,UAAU,GAAG,cAAc,CAAC;AAClC,IAAM,MAAM,GAAG,aAAa,CAAC;AAE7B,IAAM,cAAc,GAAG,8BAA8B,CAAC;AAEtD,IAAM,QAAQ,GAAG;IACf,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,uBAAW,CAAC,WAAW;IACpC,QAAQ,EAAE,CAAC,oBAAQ,CAAC,GAAG,CAAC;IACxB,KAAK,EAAE,IAA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/B,SAAS,CAAC;oBACZ,MAAM,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;oBACjD,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;;;;SAC9C,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('../../../Helper/Logging.ts'); // We mock logging to not pollute the output\nimport * as fs from 'fs';\nimport { Answers } from 'inquirer';\nimport * as process from 'process';\nimport * as rimraf from 'rimraf';\n\nimport { Args, Integration, Platform } from '../../../Constants';\nimport { ReactNative } from '../ReactNative';\n\nconst testDir = 'rn-test';\nconst iosIndexJs = 'index.ios.js';\nconst appTsx = 'src/App.tsx';\n\nconst dummyJsContent = 'import React from \"react\";\\n';\n\nconst testArgs = {\n debug: false,\n integration: Integration.reactNative,\n platform: [Platform.ios],\n quiet: true,\n skipConnect: true,\n uninstall: false,\n url: 'https://not.used',\n};\n\nconst testAnswers: Answers = {\n shouldConfigurePlatforms: { 'ios': true },\n config: {\n dsn: {\n public: 'dns.public.com',\n },\n },\n};\n\ndescribe('ReactNative', () => {\n\n const defaultCwd = process.cwd();\n\n beforeEach(() => {\n rimraf.sync(testDir);\n fs.mkdirSync(testDir);\n process.chdir(testDir);\n fs.writeFileSync(iosIndexJs, dummyJsContent);\n fs.mkdirSync('src');\n fs.writeFileSync(appTsx, dummyJsContent);\n });\n\n afterEach(() => {\n process.chdir(defaultCwd);\n rimraf.sync(testDir);\n });\n\n test('patches js files', async () => {\n const project = new ReactNative(testArgs as Args);\n await project.emit(testAnswers);\n\n const patchedIosIndexJs = fs.readFileSync(iosIndexJs, 'utf8');\n const patchedAppTsx = fs.readFileSync(appTsx, 'utf8');\n const expectedPatch = 'import React from \"react\";\\n\\n' +\n 'import * as Sentry from \\'@sentry/react-native\\';\\n\\n' +\n 'Sentry.init({ \\n' +\n ' dsn: \\'dns.public.com\\', \\n' +\n '});\\n\\n';\n expect(patchedIosIndexJs).toEqual(expectedPatch);\n expect(patchedAppTsx).toEqual(expectedPatch);\n });\n});\n"]}
package/lib/Constants.ts CHANGED
@@ -56,7 +56,7 @@ export interface Args {
56
56
  debug: boolean;
57
57
  uninstall: boolean;
58
58
  integration: Integration;
59
- platform: Platform;
59
+ platform: Platform[];
60
60
  skipConnect: boolean;
61
61
  quiet: boolean;
62
62
  }
@@ -1,5 +1,5 @@
1
1
  import * as fs from 'fs';
2
- const glob = require('glob');
2
+ import * as glob from 'glob';
3
3
 
4
4
  const IGNORE_PATTERN = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];
5
5
 
@@ -31,6 +31,12 @@ export function patchMatchingFile(
31
31
  return rv;
32
32
  }
33
33
 
34
+ export function matchFiles(globPattern: string): string[] {
35
+ return glob.sync(globPattern, {
36
+ ignore: IGNORE_PATTERN,
37
+ });
38
+ }
39
+
34
40
  export function exists(globPattern: string): boolean {
35
41
  const matches = glob.sync(globPattern, {
36
42
  ignore: IGNORE_PATTERN,
@@ -54,7 +60,7 @@ export function matchesContent(
54
60
  return false;
55
61
  }
56
62
  return matches.reduce((prev: boolean, match: string) => {
57
- return (
63
+ return !!(
58
64
  prev &&
59
65
  fs
60
66
  .readFileSync(match)
@@ -31,6 +31,10 @@ export function dim(msg: string): void {
31
31
  return l(Chalk.dim(prepareMessage(msg)));
32
32
  }
33
33
 
34
+ export function yellow(msg: string): void {
35
+ return l(Chalk.yellow(prepareMessage(msg)));
36
+ }
37
+
34
38
  export function debug(msg: any): void {
35
39
  return l(Chalk.italic.yellow(prepareMessage(msg)));
36
40
  }
@@ -7,7 +7,7 @@ import { SentryCli } from '../SentryCli';
7
7
  const args: Args = {
8
8
  debug: false,
9
9
  integration: Integration.reactNative,
10
- platform: Platform.ios,
10
+ platform: [Platform.ios],
11
11
  quiet: false,
12
12
  skipConnect: false,
13
13
  uninstall: false,
@@ -8,7 +8,7 @@ import { debug, dim, green, l, nl, red } from '../../Helper/Logging';
8
8
  import { SentryCli } from '../../Helper/SentryCli';
9
9
  import { BaseIntegration } from './BaseIntegration';
10
10
 
11
- const MIN_ELECTRON_VERSION_STRING = '1.7.0';
11
+ const MIN_ELECTRON_VERSION_STRING = '2.0.0';
12
12
  const MIN_ELECTRON_VERSION = parseInt(
13
13
  MIN_ELECTRON_VERSION_STRING.replace(/\D+/g, ''),
14
14
  10,
@@ -20,8 +20,6 @@ Sentry.init({
20
20
  dsn: '___DSN___',
21
21
  });`;
22
22
 
23
- const UPLOAD_EXAMPLE = `npm install --save-dev @sentry/cli electron-download
24
- node sentry-symbols.js`;
25
23
 
26
24
  let appPackage: any = {};
27
25
 
@@ -61,33 +59,11 @@ export class Electron extends BaseIntegration {
61
59
  green(`Successfully created sentry.properties`);
62
60
  nl();
63
61
 
64
- const symbolsScript = path.join(
65
- __dirname,
66
- '..',
67
- '..',
68
- '..',
69
- 'Electron',
70
- 'symbols.js',
71
- );
72
-
73
- if (fs.existsSync(symbolsScript)) {
74
- fs.writeFileSync('sentry-symbols.js', fs.readFileSync(symbolsScript));
75
- } else {
76
- debug(
77
- `Couldn't find ${symbolsScript}, probably because you run from src`,
78
- );
79
- }
80
-
81
62
  printExample(
82
63
  CODE_EXAMPLE.replace('___DSN___', dsn),
83
64
  'Put these lines in to your main and renderer processes to setup Sentry:',
84
65
  );
85
66
 
86
- printExample(
87
- UPLOAD_EXAMPLE,
88
- 'To upload debug information for native crashes when updating Electron, run:',
89
- );
90
-
91
67
  l('For more information, see https://docs.sentry.io/clients/electron/');
92
68
  nl();
93
69
 
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable max-lines */
2
+ import Chalk from 'chalk';
2
3
  import * as fs from 'fs';
3
4
  import { Answers, prompt } from 'inquirer';
4
5
  import * as _ from 'lodash';
@@ -50,12 +51,15 @@ export class NextJs extends BaseIntegration {
50
51
  const sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);
51
52
  await this._createSentryCliConfig(sentryCliProps);
52
53
 
53
- const configDirectory = path.join(
54
+ const templateDirectory = path.join(
54
55
  __dirname,
55
56
  '..',
56
57
  '..',
57
58
  '..',
58
59
  'NextJs',
60
+ );
61
+ const configDirectory = path.join(
62
+ templateDirectory,
59
63
  CONFIG_DIR,
60
64
  );
61
65
 
@@ -68,6 +72,30 @@ export class NextJs extends BaseIntegration {
68
72
  nl();
69
73
  }
70
74
 
75
+ const selectedProjectSlug: string | null = answers.config?.project?.slug;
76
+ if (selectedProjectSlug) {
77
+ const hasFirstEvent = answers.wizard?.projects?.find?.((p: { slug: string; }) => p.slug === selectedProjectSlug)?.firstEvent;
78
+ if (!hasFirstEvent) {
79
+ this._setTemplate(
80
+ templateDirectory,
81
+ 'sentry_sample_error.js',
82
+ ['pages', 'src/pages'],
83
+ dsn,
84
+ );
85
+ l(
86
+ Chalk.bgYellowBright(`
87
+ |------------------------------------------------------------------------|
88
+ | Installation Complete |
89
+ | To verify your installation and finish onboarding, launch your Next.js |
90
+ | application, navigate to https://localhost:3000/sentry_sample_error |
91
+ | and send us a sample error. |
92
+ |------------------------------------------------------------------------|
93
+ `
94
+ )
95
+ );
96
+ }
97
+ }
98
+
71
99
  l(
72
100
  'For more information, see https://docs.sentry.io/platforms/javascript/guides/nextjs/',
73
101
  );
@@ -5,8 +5,8 @@ import * as _ from 'lodash';
5
5
  import * as path from 'path';
6
6
 
7
7
  import { Args } from '../../Constants';
8
- import { exists, matchesContent, patchMatchingFile } from '../../Helper/File';
9
- import { dim, green, red } from '../../Helper/Logging';
8
+ import { exists, matchesContent, matchFiles, patchMatchingFile } from '../../Helper/File';
9
+ import { dim, green, red, yellow } from '../../Helper/Logging';
10
10
  import { SentryCli } from '../../Helper/SentryCli';
11
11
  import { MobileProject } from './MobileProject';
12
12
 
@@ -51,20 +51,7 @@ export class ReactNative extends MobileProject {
51
51
  );
52
52
  dim(`✅ Patched build.gradle file.`);
53
53
  }
54
- await patchMatchingFile(
55
- `index.${platform}.js`,
56
- this._patchJs.bind(this),
57
- answers,
58
- platform,
59
- );
60
- // rm 0.49 introduced an App.js for both platforms
61
- await patchMatchingFile(
62
- 'App.js',
63
- this._patchJs.bind(this),
64
- answers,
65
- platform,
66
- );
67
- dim(`✅ Patched App.js file.`);
54
+ await this._patchJsSentryInit(platform, answers);
68
55
  await this._addSentryProperties(platform, sentryCliProperties);
69
56
  dim(`✅ Added sentry.properties file to ${platform}`);
70
57
 
@@ -132,6 +119,32 @@ export class ReactNative extends MobileProject {
132
119
  return result;
133
120
  }
134
121
 
122
+ private async _patchJsSentryInit(
123
+ platform: string,
124
+ answers: Answers,
125
+ ): Promise<void> {
126
+ const prefixGlob = '{.,./src}';
127
+ const suffixGlob = '@(j|t|cj|mj)s?(x)';
128
+ const platformGlob = `index.${platform}.${suffixGlob}`;
129
+ // rm 0.49 introduced an App.js for both platforms
130
+ const universalGlob = `App.${suffixGlob}`;
131
+ const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;
132
+
133
+ const jsFileToPatch = matchFiles(jsFileGlob);
134
+ if (jsFileToPatch.length !== 0) {
135
+ await patchMatchingFile(
136
+ jsFileGlob,
137
+ this._patchJs.bind(this),
138
+ answers,
139
+ platform,
140
+ );
141
+ dim(`✅ Patched ${jsFileToPatch.join(', ')} file(s).`);
142
+ } else {
143
+ dim(`🚨 Could not find ${platformGlob} nor ${universalGlob} files.`);
144
+ yellow('❓ Please, visit https://docs.sentry.io/platforms/react-native');
145
+ }
146
+ }
147
+
135
148
  private _addSentryProperties(
136
149
  platform: string,
137
150
  properties: any,
@@ -0,0 +1,67 @@
1
+ jest.mock('../../../Helper/Logging.ts'); // We mock logging to not pollute the output
2
+ import * as fs from 'fs';
3
+ import { Answers } from 'inquirer';
4
+ import * as process from 'process';
5
+ import * as rimraf from 'rimraf';
6
+
7
+ import { Args, Integration, Platform } from '../../../Constants';
8
+ import { ReactNative } from '../ReactNative';
9
+
10
+ const testDir = 'rn-test';
11
+ const iosIndexJs = 'index.ios.js';
12
+ const appTsx = 'src/App.tsx';
13
+
14
+ const dummyJsContent = 'import React from "react";\n';
15
+
16
+ const testArgs = {
17
+ debug: false,
18
+ integration: Integration.reactNative,
19
+ platform: [Platform.ios],
20
+ quiet: true,
21
+ skipConnect: true,
22
+ uninstall: false,
23
+ url: 'https://not.used',
24
+ };
25
+
26
+ const testAnswers: Answers = {
27
+ shouldConfigurePlatforms: { 'ios': true },
28
+ config: {
29
+ dsn: {
30
+ public: 'dns.public.com',
31
+ },
32
+ },
33
+ };
34
+
35
+ describe('ReactNative', () => {
36
+
37
+ const defaultCwd = process.cwd();
38
+
39
+ beforeEach(() => {
40
+ rimraf.sync(testDir);
41
+ fs.mkdirSync(testDir);
42
+ process.chdir(testDir);
43
+ fs.writeFileSync(iosIndexJs, dummyJsContent);
44
+ fs.mkdirSync('src');
45
+ fs.writeFileSync(appTsx, dummyJsContent);
46
+ });
47
+
48
+ afterEach(() => {
49
+ process.chdir(defaultCwd);
50
+ rimraf.sync(testDir);
51
+ });
52
+
53
+ test('patches js files', async () => {
54
+ const project = new ReactNative(testArgs as Args);
55
+ await project.emit(testAnswers);
56
+
57
+ const patchedIosIndexJs = fs.readFileSync(iosIndexJs, 'utf8');
58
+ const patchedAppTsx = fs.readFileSync(appTsx, 'utf8');
59
+ const expectedPatch = 'import React from "react";\n\n' +
60
+ 'import * as Sentry from \'@sentry/react-native\';\n\n' +
61
+ 'Sentry.init({ \n' +
62
+ ' dsn: \'dns.public.com\', \n' +
63
+ '});\n\n';
64
+ expect(patchedIosIndexJs).toEqual(expectedPatch);
65
+ expect(patchedAppTsx).toEqual(expectedPatch);
66
+ });
67
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "2.0.0",
3
+ "version": "2.1.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",
@@ -37,14 +37,17 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@sentry-internal/eslint-config-sdk": "^6.2.1",
40
+ "@types/glob": "^7.2.0",
40
41
  "@types/inquirer": "^0.0.43",
41
42
  "@types/jest": "^23.3.2",
42
43
  "@types/lodash": "^4.14.144",
43
44
  "@types/node": "^10.11.0",
45
+ "@types/rimraf": "^3.0.2",
44
46
  "@types/semver": "^7.3.7",
45
47
  "eslint": "^7.21.0",
46
48
  "jest": "^26.6.3",
47
49
  "prettier": "^1.14.3",
50
+ "rimraf": "^3.0.2",
48
51
  "ts-jest": "^26.5.5",
49
52
  "ts-node": "^7.0.1",
50
53
  "tslint": "^5.11.0",
@@ -0,0 +1,47 @@
1
+ import Head from 'next/head'
2
+
3
+ const boxStyles = { padding: '12px', border: '1px solid #eaeaea', borderRadius: '10px' };
4
+ export default function Home() {
5
+ return (
6
+ <div>
7
+ <Head>
8
+ <title>Sentry Onboarding</title>
9
+ <meta name="description" content="Make your Next.js ready for Sentry" />
10
+ </Head>
11
+
12
+ <main style={{
13
+ minHeight: '100vh',
14
+ display: 'flex',
15
+ flexDirection: 'column',
16
+ justifyContent: 'center',
17
+ alignItems: 'center',
18
+ }}>
19
+ <h1 style={{ fontSize: '4rem' }}>
20
+ <svg style={{
21
+ height: '1em'
22
+ }} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 44">
23
+ <path fill="currentColor" d="M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"></path>
24
+ </svg>
25
+ </h1>
26
+
27
+ <p >
28
+ Get started by sending us a sample error
29
+ </p>
30
+ <button type="button" style={{
31
+ ...boxStyles,
32
+ backgroundColor: '#c73852',
33
+ borderRadius: '12px',
34
+ border: 'none'
35
+ }} onClick={() => {
36
+ throw new Error("Sentry Frontend Error");
37
+ }}>
38
+ Throw error
39
+ </button>
40
+
41
+ <p>
42
+ For more information, see <a href="https://docs.sentry.io/platforms/javascript/guides/nextjs/">https://docs.sentry.io/platforms/javascript/guides/nextjs/</a>
43
+ </p>
44
+ </main>
45
+ </div>
46
+ )
47
+ }