From 58be1809c46cbe517a18d86d0af52179dcc5cbf6 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 29 Jun 2025 17:31:30 -0700 Subject: Move to nodejs and also lots of significant refactoring that should've been broken up but idgaf --- index.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'index.ts') diff --git a/index.ts b/index.ts index a9defca..86119ca 100755 --- a/index.ts +++ b/index.ts @@ -3,7 +3,7 @@ import { argv, IEither, Either } from '@emprespresso/pengueno'; import { runServer } from '@emprespresso/ci_server'; -const main = (_argv = process.argv.slice(2)): Promise> => +const main = (_argv = process.argv.slice(2)): Promise> => argv( ['--run-server', '--port', '--host'], { @@ -18,19 +18,17 @@ const main = (_argv = process.argv.slice(2)): Promise> => port: args['--port'], host: args['--host'], })) - .flatMapAsync((runConfig) => { - if (runConfig.server_mode) { - return runServer(runConfig.port, runConfig.host); + .flatMapAsync(async (runConfig) => { + if (!runConfig.server_mode) { + return Either.right(undefined); } - return Promise.resolve(Either.right(0)); + return runServer(runConfig.port, runConfig.host); }); if (process.argv[1] === import.meta.filename) { await main().then((eitherDone) => - eitherDone.fold(({ isLeft, value }) => { - if (!isLeft) return; - - console.error(`failed to start`, value); + eitherDone.mapLeft((err) => { + console.error(`failed to start`, err); process.exit(1); }), ); -- cgit v1.2.3-70-g09d2