UNPKG

@nx/expo

Version:

The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.

49 lines (48 loc) 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = update; const devkit_1 = require("@nx/devkit"); /** * Add expo-system-ui to Expo projects for SDK 54. * expo-system-ui is now a built-in module that handles system UI colors * and user interface style configuration. */ function update(tree) { const projects = (0, devkit_1.getProjects)(tree); for (const [projectName, config] of projects.entries()) { if (config.projectType !== 'application' || !isExpoProject(tree, config.root)) { continue; } const appPackageJsonPath = (0, devkit_1.joinPathFragments)(config.root, 'package.json'); if (!tree.exists(appPackageJsonPath)) { continue; } const packageJson = (0, devkit_1.readJson)(tree, appPackageJsonPath); // Check if expo-system-ui is already installed if (packageJson.dependencies?.['expo-system-ui'] || packageJson.devDependencies?.['expo-system-ui']) { continue; } // Add expo-system-ui dependency (0, devkit_1.updateJson)(tree, appPackageJsonPath, (json) => { json.dependencies = json.dependencies || {}; json.dependencies['expo-system-ui'] = '~6.0.0'; return json; }); devkit_1.logger.info(`Added expo-system-ui dependency to ${projectName} for SDK 54 support`); } } function isExpoProject(tree, projectRoot) { const packageJsonPath = (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'); if (!tree.exists(packageJsonPath)) { return false; } try { const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath); return Boolean(packageJson.dependencies?.expo || packageJson.devDependencies?.expo); } catch { return false; } }