1#!/usr/bin/env node 2import chalk from 'chalk'; 3 4import { Command } from '../../bin/cli'; 5import * as Log from '../log'; 6import { assertArgs, getProjectRoot } from '../utils/args'; 7 8export const expoConfig: Command = async (argv) => { 9 const args = assertArgs( 10 { 11 // Types 12 '--help': Boolean, 13 '--full': Boolean, 14 '--json': Boolean, 15 '--type': String, 16 // Aliases 17 '-h': '--help', 18 '-t': '--type', 19 }, 20 argv 21 ); 22 23 if (args['--help']) { 24 Log.exit( 25 chalk` 26 {bold Description} 27 Show the project config 28 29 {bold Usage} 30 $ npx expo config <dir> 31 32 <dir> is the directory of the Expo project. 33 Defaults to the current working directory. 34 35 Options 36 --full Include all project config data 37 --json Output in JSON format 38 -t, --type <public|prebuild|introspect> Type of config to show 39 -h, --help Output usage information 40 `, 41 0 42 ); 43 } 44 45 // Load modules after the help prompt so `npx expo config -h` shows as fast as possible. 46 const [ 47 // ./configAsync 48 { configAsync }, 49 // ../utils/errors 50 { logCmdError }, 51 ] = await Promise.all([import('./configAsync'), import('../utils/errors')]); 52 53 return configAsync(getProjectRoot(args), { 54 // Parsed options 55 full: args['--full'], 56 json: args['--json'], 57 type: args['--type'], 58 }).catch(logCmdError); 59}; 60