nx/packages/expo/src/generators/convert-to-inferred/lib/process-generic-options.ts
Jack Hsu d3747e020f
feat(react-native): add convert-to-inferred generator for Expo and React Native (#27326)
This PR adds `convert-to-inferred` generators to convert React Native an
Expo apps using executors to use the corresponding inference plugins.

Also:
1. Fixes casing for `@nx/react-native/plugin` so it is correctly set as
`upgradeTargetName` not `upgradeTargetname`
2. Migration for the above fix for existing projects
2024-08-08 14:31:19 -04:00

25 lines
696 B
TypeScript

import { names } from '@nx/devkit';
import type { Tree } from '@nx/devkit';
import type { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
export function processGenericOptions(
_tree: Tree,
options: any,
_projectName: string,
_projectRoot: string,
_migrationLogs: AggregatedLog
) {
const args = options.args ?? [];
for (const key of Object.keys(options)) {
if (key === 'args') continue;
let value = options[key];
if (typeof value === 'boolean') {
if (value) args.push(`--${names(key).fileName}`);
} else {
args.push(`--${names(key).fileName}=${value}`);
}
delete options[key];
}
options.args = args;
}