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

31 lines (30 loc) 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = update; const devkit_1 = require("@nx/devkit"); const child_process_1 = require("child_process"); const react_native_project_detection_1 = require("../../utils/react-native-project-detection"); async function update(tree) { const projects = (0, devkit_1.getProjects)(tree); const reactNativeProjects = await (0, react_native_project_detection_1.getAllReactNativeProjects)(tree, projects); if (reactNativeProjects.length === 0) { return; } const pm = (0, devkit_1.detectPackageManager)(tree.root); const { exec } = (0, devkit_1.getPackageManagerCommand)(pm); // Run nx upgrade for each React Native project for (const projectName of reactNativeProjects) { const command = `${exec} nx upgrade ${projectName}`; try { (0, child_process_1.execSync)(command, { stdio: 'inherit', cwd: process.cwd(), }); } catch (error) { devkit_1.logger.warn(`Failed to upgrade ${projectName}: ${error.message}. Please run '${command}'.`); // Continue with other projects even if one fails } } await (0, devkit_1.formatFiles)(tree); }