Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for SSGResultDetails #2075

Open
watany-dev opened this issue Jan 24, 2024 · 3 comments
Open

Proposal for SSGResultDetails #2075

watany-dev opened this issue Jan 24, 2024 · 3 comments
Labels
enhancement New feature or request.

Comments

@watany-dev
Copy link
Contributor

watany-dev commented Jan 24, 2024

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.

@watany-dev watany-dev added the enhancement New feature or request. label Jan 24, 2024
@watany-dev
Copy link
Contributor Author

watany-dev commented Jan 24, 2024

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 }))
})

@watany-dev
Copy link
Contributor Author

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.

@yusukebe
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants