From 2ac081f6ed31a20ef4a4b01ea6bc2a663d3464a7 Mon Sep 17 00:00:00 2001 From: v-nvtsk Date: Wed, 1 May 2024 19:08:54 +0300 Subject: [PATCH] feat: add entry-point index.ts --- src/index.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 src/index.ts diff --git a/src/index.ts b/src/index.ts new file mode 100755 index 0000000..291b9da --- /dev/null +++ b/src/index.ts @@ -0,0 +1,28 @@ +import { argv } from "process"; +import { parseArgs } from "./commander"; +import { dialog } from "./inquirer"; +import { publish } from "./publish"; +import { clearConsole, printError, printHeader, printSuccessBright } from "./utils"; + +async function main() { + const result = argv.length > 2 ? await parseArgs(process.argv) : await dialog(); + + if (!result || result.buildDir === "") { + printError("Aborted - not enough arguments\n"); + process.exit(0); + } + + try { + await publish(result); + printSuccessBright("finished successfully\n"); + } catch (e: any) { + printError(e.message); + printError("finished with error\n"); + process.exit(1); + } +} + +clearConsole(); +printHeader("Github-pages deploy\n"); + +await main();