summaryrefslogtreecommitdiff
path: root/index.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-06-29 17:31:30 -0700
committerElizabeth Hunt <me@liz.coffee>2025-06-29 17:31:30 -0700
commit58be1809c46cbe517a18d86d0af52179dcc5cbf6 (patch)
tree9ccc678b3fd48c1a52fe501600dd2c2051740a55 /index.ts
parentd4791f3d357634daf506fb8f91cc5332a794c421 (diff)
downloadci-58be1809c46cbe517a18d86d0af52179dcc5cbf6.tar.gz
ci-58be1809c46cbe517a18d86d0af52179dcc5cbf6.zip
Move to nodejs and also lots of significant refactoring that should've been broken up but idgaf
Diffstat (limited to 'index.ts')
-rwxr-xr-xindex.ts16
1 files changed, 7 insertions, 9 deletions
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<IEither<Error, 0>> =>
+const main = (_argv = process.argv.slice(2)): Promise<IEither<Error, void>> =>
argv(
['--run-server', '--port', '--host'],
{
@@ -18,19 +18,17 @@ const main = (_argv = process.argv.slice(2)): Promise<IEither<Error, 0>> =>
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(<void>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);
}),
);