1
mirror of https://github.com/jakejarvis/hugo-extended.git synced 2026-06-24 10:25:57 -04:00

refactor: full typescript migration (#174)

This commit is contained in:
2026-01-06 21:08:36 -05:00
committed by GitHub
parent 4ce0fbb869
commit 0f9bca8bf5
32 changed files with 4803 additions and 2903 deletions
Regular → Executable
+37 -3
View File
@@ -1,4 +1,38 @@
import install from "./lib/install.js";
#!/usr/bin/env node
// Install Hugo right off the bat.
(async () => await install())();
import { existsSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
/**
* Postinstall wrapper script that properly handles errors during Hugo binary installation.
* This script imports and executes the install function, logging any errors with full stack traces
* and exiting with a non-zero code on failure.
*
* During development/CI (before build), the dist folder won't exist and this script will exit gracefully.
* For published packages, the dist folder is included and installation will proceed.
*/
const __dirname = dirname(fileURLToPath(import.meta.url));
const installPath = join(__dirname, "dist", "lib", "install.mjs");
async function run() {
// Skip installation if dist folder doesn't exist (development/CI environment)
if (!existsSync(installPath)) {
console.log(
"Skipping Hugo installation (dist not found - likely in CI or development environment)",
);
process.exit(0);
}
try {
const m = await import("./dist/lib/install.mjs");
await m.default();
} catch (error) {
console.error("Hugo installation failed:");
console.error(error);
process.exit(1);
}
}
run();