Skip to content

ToSSGResult

reference
1 min readUpdated

Kind: Interface

Source: src/helper/ssg/ssg.ts

Part of: Helper

ToSSGResult represents the outcome of a static site generation operation. It reports whether generation succeeded, lists generated file paths, and carries an Error when the operation fails.

Properties

PropertyType
successboolean
filesstring[]
errorError

Diagram

mermaid
graph LR
  SSG[Static site generation] --> Result[ToSSGResult]
  Result --> Success[success: boolean]
  Result --> Files[files: string[]]
  Result --> Error[error: Error]

Usage

ts
import type { ToSSGResult } from "./src/helper/ssg/ssg";

function reportGeneration(result: ToSSGResult): void {
  if (result.success) {
    console.log("Generated files:", result.files);
    return;
  }

  console.error("Static site generation failed:", result.error);
}

const result: ToSSGResult = {
  success: true,
  files: ["dist/index.html", "dist/about/index.html"],
  error: new Error(),
};

reportGeneration(result);

AI Coding Instructions

  • Return success, files, and error together when creating a ToSSGResult.
  • Check success before treating entries in files as generated output.
  • Pass the original failure through the error field so callers can log or handle it.
  • Keep files limited to paths produced by the static site generation operation.

Was this page helpful?

Download as PDF
ToSSGResult — Hono (narrator proof)