Proposal for SSGResultDetails
What is the feature you are proposing?
When debugging files created by toSSG, it is not practical to check all the routes registered in app. I believe we should provide a way to know which routes have succeeded, failed, or skipped.
interface SSGResultPaths {
successfulPaths: string[];
failedPaths: { path: string; error: Error }[];
excludedPaths: string[];
}
interface ToSSGResult {
success: boolean;
files: string[];
error?: Error;
paths: SSGResultPaths;
}
If you agree with this I will create it.
There may be a cooler way to do this, but you could also make a hybridapp like this.
const dir = './static'
const result = toSSG(app, fs, { dir });
export const successfulPaths = result.paths?.successfulPaths || [];
import { successfulPath } from ′./build′
const hybridApp = new Hono()
successfulPaths.forEach(path => {
hybridApp.get(`${path}`, serveStatic({ root: dir }))
})
It may be a bit wasteful in its usage with respect to this purpose. Since it is necessary to create a wrapper function for fetchRouteContent, such as scanSSGRoute, to skip file writing or to reduce waste, we should separate the story again and only consider whether the first debugging usage is necessary.
Hi @watany-dev
I think SSGResultPaths is not bad, and I can imagine the use case of a "hybrid app." Also, I don't think the implementation will be that complicated.