1#!/usr/bin/env node 2 3// Basic node CLI script to resolve the native app entry file. 4// 5// Usage: 6// node expo/scripts/resolveAppEntry.js path/to/project-root <platform> <format> 7// 8// Example: 9// node expo/scripts/resolveAppEntry.js path/to/project-root/ android absolute 10// 11// Returns: 12// The resolved entry file path. 13// 14// Limitations: 15// Currently only supports android and ios. 16 17const { resolveEntryPoint } = require('@expo/config/paths'); 18const path = require('path'); 19 20const projectRoot = process.argv[1]; 21const platform = process.argv[2]; 22const absolute = process.argv[3] === 'absolute'; 23 24if (!platform || !projectRoot) { 25 console.error( 26 'Usage: node expo/scripts/resolveAppEntry.js <projectRoot> <platform> <relative|absolute>' 27 ); 28 process.exit(1); 29} 30 31const entry = resolveEntryPoint(projectRoot, { platform }); 32 33if (entry) { 34 console.log(absolute ? path.resolve(entry) : path.relative(projectRoot, entry)); 35} else { 36 console.error(`Error: Could not find entry file for project at: ${projectRoot}`); 37 process.exit(1); 38} 39