diff --git a/packages/react-native-cli/src/commands/AutomateSymbolicationCommand.ts b/packages/react-native-cli/src/commands/AutomateSymbolicationCommand.ts index 242ff5c74a..b91ef09e5f 100644 --- a/packages/react-native-cli/src/commands/AutomateSymbolicationCommand.ts +++ b/packages/react-native-cli/src/commands/AutomateSymbolicationCommand.ts @@ -65,7 +65,7 @@ export default async function run (projectRoot: string, urls: OnPremiseUrls): Pr }, { onCancel }) if (bugsnagCliNpmTasks) { - await writeToPackageJson(join(projectRoot, 'package.json'), urls[UrlType.UPLOAD], urls[UrlType.BUILD]) + await writeToPackageJson(join(projectRoot, 'package.json'), urls[UrlType.UPLOAD], urls[UrlType.BUILD]) } await prompts({ @@ -135,30 +135,6 @@ async function installBugsnagCliPackage (projectRoot: string, urls: OnPremiseUrl logger.success('@bugsnag/cli dependency is installed') } -async function installJavaScriptPackage (projectRoot: string): Promise { - const alreadyInstalled = await detectInstalled('@bugsnag/source-maps', projectRoot) - - if (alreadyInstalled) { - logger.warn('@bugsnag/source-maps is already installed, skipping') - return - } - - logger.info('Adding @bugsnag/source-maps dependency') - - const packageManager = await guessPackageManager(projectRoot) - - const { version } = await prompts({ - type: 'text', - name: 'version', - message: 'If you want the latest version of @bugsnag/source-maps hit enter, otherwise type the version you want', - initial: 'latest' - }, { onCancel }) - - await install(packageManager, '@bugsnag/source-maps', version, true, projectRoot) - - logger.success('@bugsnag/source-maps dependency is installed') -} - async function writeToPackageJson (packageJsonPath: string, uploadUrl?: string, buildUrl?: string): Promise { try { const data = await fs.readFile(packageJsonPath, 'utf8') diff --git a/packages/react-native-cli/src/lib/Xcode.ts b/packages/react-native-cli/src/lib/Xcode.ts index 5f78d21a58..0367564b3c 100644 --- a/packages/react-native-cli/src/lib/Xcode.ts +++ b/packages/react-native-cli/src/lib/Xcode.ts @@ -55,13 +55,13 @@ async function addUploadSourceMapsTask ( ): Promise { for (const shellBuildPhaseKey in buildPhaseMap) { const phase = buildPhaseMap[shellBuildPhaseKey] - if (typeof phase.shellScript === 'string' && phase.shellScript.includes('bugsnag-react-native-xcode.sh') || typeof phase.shellScript === 'string' && phase.shellScript.includes('Upload source maps to Bugsnag')) { + if (typeof phase.shellScript === 'string' && (phase.shellScript.includes('bugsnag-react-native-xcode.sh') || phase.shellScript.includes('Upload source maps to Bugsnag'))) { logger.warn('An "Upload source maps to Bugsnag" build phase already exists') return false } } - let shellScript = 'npm run bugsnag:upload-ios' + const shellScript = 'npm run bugsnag:upload-ios' proj.addBuildPhase( [], @@ -74,35 +74,25 @@ async function addUploadSourceMapsTask ( return true } -function addExtraPackagerArgs (phaseId: string, existingShellScript: string, logger: Logger): [string, boolean] { - const parsedExistingShellScript = JSON.parse(existingShellScript) as string - if (parsedExistingShellScript.includes(EXTRA_PACKAGER_ARGS)) { - logger.warn(`The "Bundle React Native Code and Images" build phase (${phaseId}) already includes the required arguments`) - return [existingShellScript, false] - } - const scriptLines = parsedExistingShellScript.split('\n') - return [JSON.stringify([EXTRA_PACKAGER_ARGS].concat(scriptLines).join('\n')), true] -} - -function updateXcodeEnv(projectRoot: string, logger: Logger): boolean { - const searchString = 'SOURCEMAP_FILE='; +function updateXcodeEnv (projectRoot: string, logger: Logger): boolean { + const searchString = 'SOURCEMAP_FILE=' const sourceMapFilePath = 'ios/build/main.jsbundle.map' const envFilePath = path.join(projectRoot, 'ios', '.xcode.env') const data = fs.readFile(envFilePath, 'utf8').then( function (results){ if (results.includes(searchString)) { - logger.warn(`The .xcode.env file already contains a section for "${searchString}"`); - return false; + logger.warn(`The .xcode.env file already contains a section for "${searchString}"`) + return false } else { - const newData = `${results}\n\n#React Native Source Map File\n${searchString}${sourceMapFilePath}`; + const newData = `${results}\n\n#React Native Source Map File\n${searchString}${sourceMapFilePath}` fs.writeFile(envFilePath, newData, 'utf8') return true } }).catch( function (error){ - logger.warn(`Error updating the .xcode.env file: ${error}`); + logger.warn(`Error updating the .xcode.env file: ${error}`) return false })