diff options
author | 2021-04-05 15:56:46 -0600 | |
---|---|---|
committer | 2021-04-05 15:56:46 -0600 | |
commit | 1acd5ee310040d654f6d457a1dd53b9cb19f1f51 (patch) | |
tree | 86d46a87817d70f7b7c7aa18ce9e30a98a27ee98 /src/cli.ts | |
parent | 71e5de76f136a0ef76253c05bb8072898bcf08f7 (diff) | |
download | astro-1acd5ee310040d654f6d457a1dd53b9cb19f1f51.tar.gz astro-1acd5ee310040d654f6d457a1dd53b9cb19f1f51.tar.zst astro-1acd5ee310040d654f6d457a1dd53b9cb19f1f51.zip |
Allow no config (#61)
* Allow no config
* Update README
Diffstat (limited to 'src/cli.ts')
-rw-r--r-- | src/cli.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cli.ts b/src/cli.ts index e0f0c0dc3..71c9691d7 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -58,14 +58,13 @@ async function printVersion() { /** Handle `astro run` command */ async function runCommand(rawRoot: string, cmd: (a: AstroConfig) => Promise<void>) { - const astroConfig = await loadConfig(rawRoot); - if (typeof astroConfig === 'undefined') { - console.error(colors.red(' An astro.config.mjs file is required.\n')); - printHelp(); + try { + const astroConfig = await loadConfig(rawRoot); + return cmd(astroConfig); + } catch (err) { + console.error(colors.red(err.toString() || err)); process.exit(1); } - - return cmd(astroConfig); } const cmdMap = new Map([ |