UNPKG

hugo-extended

Version:

✏️ Plug-and-play binary wrapper for Hugo Extended, the awesomest static-site generator.

28 lines (26 loc) 753 B
#!/usr/bin/env node import hugo_default from "./hugo.mjs"; import { spawn } from "node:child_process"; //#region src/cli.ts process.on("unhandledRejection", (reason) => { console.error("Unhandled promise rejection:", reason); process.exitCode = 1; }); (async () => { try { const args = process.argv.slice(2); const child = spawn(await hugo_default(), args, { stdio: "inherit" }); child.on("error", (err) => { console.error("Failed to spawn Hugo binary:", err.message); process.exitCode = 1; }); child.on("exit", (code) => { process.exitCode = code ?? void 0; }); } catch (err) { console.error("Failed to initialize Hugo:", err instanceof Error ? err.message : err); process.exitCode = 1; } })(); //#endregion export { };