1 line
3.0 KiB
Plaintext
1 line
3.0 KiB
Plaintext
{"version":3,"names":["tryLaunchAppOnDevice","device","packageName","adbPath","args","appId","appIdSuffix","packageNameWithSuffix","filter","Boolean","join","activityToLaunch","mainActivity","includes","adbArgs","unshift","logger","info","debug","execa","sync","stdio","error","CLIError"],"sources":["../../../src/commands/runAndroid/tryLaunchAppOnDevice.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport execa from 'execa';\nimport {Flags} from '.';\nimport {logger, CLIError} from '@react-native-community/cli-tools';\n\nfunction tryLaunchAppOnDevice(\n device: string | void,\n packageName: string,\n adbPath: string,\n args: Flags,\n) {\n const {appId, appIdSuffix} = args;\n const packageNameWithSuffix = [appId || packageName, appIdSuffix]\n .filter(Boolean)\n .join('.');\n\n const activityToLaunch = args.mainActivity.includes('.')\n ? args.mainActivity\n : [packageName, args.mainActivity].filter(Boolean).join('.');\n\n try {\n // Here we're using the same flags as Android Studio to launch the app\n const adbArgs = [\n 'shell',\n 'am',\n 'start',\n '-n',\n `${packageNameWithSuffix}/${activityToLaunch}`,\n '-a',\n 'android.intent.action.MAIN',\n '-c',\n 'android.intent.category.LAUNCHER',\n ];\n\n if (device) {\n adbArgs.unshift('-s', device);\n logger.info(`Starting the app on \"${device}\"...`);\n } else {\n logger.info('Starting the app...');\n }\n logger.debug(`Running command \"${adbPath} ${adbArgs.join(' ')}\"`);\n execa.sync(adbPath, adbArgs, {stdio: 'inherit'});\n } catch (error) {\n throw new CLIError('Failed to start the app.', error as any);\n }\n}\n\nexport default tryLaunchAppOnDevice;\n"],"mappings":";;;;;;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmE;AAVnE;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,oBAAoB,CAC3BC,MAAqB,EACrBC,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