UNPKG

@nx/react-native

Version:

The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: -Integration with libraries such as Jest, Detox, and Storybook. -Scaffolding for creating buildable libraries th

40 lines (39 loc) 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createProcessOptions = createProcessOptions; const devkit_1 = require("@nx/devkit"); /** * Logic copied from `packages/react-native/src/utils/get-cli-options.ts`, * which was used by most executors to map their options to CLI options. */ function createProcessOptions(executorName, optionKeysToIgnore, optionKeysInCamelName) { return (projectName, options, migrationLogs) => { const args = []; for (const optionKey of Object.keys(options)) { const optionValue = options[optionKey]; delete options[optionKey]; if (optionKeysToIgnore.includes(optionKey)) { migrationLogs.addLog({ project: projectName, executorName, log: `Unable to migrate '${optionKey}' to inferred target configuration.`, }); continue; } const cliKey = optionKeysInCamelName.includes(optionKey) ? (0, devkit_1.names)(optionKey).propertyName : (0, devkit_1.names)(optionKey).fileName; // cli uses kebab case as default if (Array.isArray(optionValue)) { args.push(`--${cliKey}`, optionValue.join(',')); } else if (typeof optionValue === 'boolean' && optionValue) { // no need to pass in the value when it is true, just the flag name args.push(`--${cliKey}`); } else { args.push(`--${cliKey}`, optionValue); } } options.args = args; }; }