diff --git a/bun.lockb b/bun.lockb index b447073..adc862f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index f69fa61..a4af8d4 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "dependencies": { "@expo/server": "^0.3.1", "arg": "^5.0.2", + "chalk": "^4.1.2", "compression": "^1.7.4", "connect": "^3.7.0", "express": "^4.18.2", diff --git a/src/cli/bin.ts b/src/cli/bin.ts index 374216a..6bbc380 100644 --- a/src/cli/bin.ts +++ b/src/cli/bin.ts @@ -1,5 +1,6 @@ #!/usr/bin/env node import arg from 'arg'; +import chalk from 'chalk'; import open from 'open'; import path from 'path'; @@ -26,16 +27,16 @@ if (args['--version']) { } if (args['--help']) { - console.log(` - Usage - $ expo-atlas [statsFile] - - Options - --port, -p Port to listen on - --no-open Do not open the browser automatically - --help, -h Displays this message - --version, -v Displays the current version - `); + printLines([ + chalk.bold('Usage'), + ` ${chalk.dim('$')} expo-atlas ${chalk.dim('[statsFile]')}`, + '', + chalk.bold('Options'), + ` --port${chalk.dim(', -p')} Port to listen on`, + ` --no-open Do not open the browser automatically`, + ` --help${chalk.dim(', -h')} Displays this message`, + ` --version${chalk.dim(', -v')} Displays the current version`, + ]); process.exit(0); } @@ -49,9 +50,10 @@ async function run() { server.listen(options.port, () => { const href = `http://localhost:${options.port}`; - console.log(`Metro bundle inspector is ready on ${href}`); - console.log('Loaded stats file:'); - console.log(` ${options.statsFile}`); + printLines([ + `Expo Atlas is ready on: ${chalk.underline(href)}`, + ` ${chalk.dim(`Using: ${options.statsFile}`)}`, + ]); if (options.browserOpen) { open(href).catch((error) => { @@ -61,6 +63,10 @@ async function run() { }); } +function printLines(lines: string[]) { + console.log(` ${lines.join('\n ')}`); +} + run().catch((error) => { if (error.type !== 'AtlasError') { throw error;