1 line
3.5 KiB
Plaintext
1 line
3.5 KiB
Plaintext
{"version":3,"names":["getTaskNames","appName","mode","tasks","taskPrefix","sourceDir","appTasks","length","toPascalCase","actionableInstallTasks","getGradleTasks","find","t","task","includes","installTasksForMode","filter","toLowerCase","CLIError","map","taskName","replace","join","logger","warn","command"],"sources":["../../../src/commands/runAndroid/getTaskNames.ts"],"sourcesContent":["import {toPascalCase} from './toPascalCase';\nimport type {BuildFlags} from '../buildAndroid';\nimport {getGradleTasks} from './listAndroidTasks';\nimport {CLIError, logger} from '@react-native-community/cli-tools';\n\nexport function getTaskNames(\n appName: string,\n mode: BuildFlags['mode'] = 'debug',\n tasks: BuildFlags['tasks'],\n taskPrefix: 'assemble' | 'install' | 'bundle',\n sourceDir: string,\n): Array<string> {\n let appTasks =\n tasks && tasks.length ? tasks : [taskPrefix + toPascalCase(mode)];\n\n // Check against build flavors for \"install\" task (\"assemble\" don't care about it so much and will build all)\n if (!tasks?.length && taskPrefix === 'install') {\n const actionableInstallTasks = getGradleTasks('install', sourceDir);\n if (!actionableInstallTasks.find((t) => t.task.includes(appTasks[0]))) {\n const installTasksForMode = actionableInstallTasks.filter((t) =>\n t.task.toLowerCase().includes(mode),\n );\n if (!installTasksForMode.length) {\n throw new CLIError(\n `Couldn't find \"${appTasks\n .map((taskName) => taskName.replace(taskPrefix, ''))\n .join(\n ', ',\n )}\" build variant. Available variants are: ${actionableInstallTasks\n .map((t) => `\"${t.task.replace(taskPrefix, '')}\"`)\n .join(', ')}.`,\n );\n }\n logger.warn(\n `Found multiple tasks for \"install\" command: ${installTasksForMode\n .map((t) => t.task)\n .join(', ')}.\\nSelecting first available: ${\n installTasksForMode[0].task\n }.`,\n );\n appTasks = [installTasksForMode[0].task];\n }\n }\n\n return appName\n ? appTasks.map((command) => `${appName}:${command}`)\n : appTasks;\n}\n"],"mappings":";;;;;;AAAA;AAEA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,YAAY,CAC1BC,OA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