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

bundle and optimize server and API routes and serve from output directory (decouple serve task from source code) #946

Closed
Tracked by #1034
thescientist13 opened this issue Jun 26, 2022 · 0 comments · Fixed by #1079 or #1034
Assignees
Labels
alpha.5 breaking CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) SSR v0.28.0
Milestone

Comments

@thescientist13
Copy link
Member

thescientist13 commented Jun 26, 2022

Type of Change

Feature

Summary

As it stands right now (I believe) SSR routes are called directly from src/, but ideally they should bundle and resolved to JS files by the hybrid server so that running the final result and the CLI can be totally independent of the source code needing to be present.

Details

This should ensure that the CLI can be used independent of the source code, say if the server crashes or someone wants to write their own server and just build a static distribution through something like Docker. This means that if greenwood serve is called and there is no workspace directory, it should try and find the output directory and just start from that, assuming a pre-generated bundle. For example, in Next, if you clone a repo and just run next serve it will break until you at least run a next build.

Most importantly, this avoids false positives thinking something is working when using serve because it is hitting source code directly, not bundled output. Hit that again in #986. Blast you false positives! 😠


This should also probably include API routes too after #1007 lands, and then will need to figure out how we change the shape of graph.json, which will have an impact on our graph output. Maybe something like

const graph = {
  pages: [ /*... */ ],
  apis: [ /*... */ ]
}

Additionally, if there are no pages/ but an /api/ directory, should we even output a default index.html / 404.html?

@thescientist13 thescientist13 added the enhancement Improve something existing (e.g. no docs, new APIs, etc) label Jun 26, 2022
@thescientist13 thescientist13 added this to the 1.0 milestone Jun 26, 2022
@thescientist13 thescientist13 self-assigned this Jun 26, 2022
@thescientist13 thescientist13 mentioned this issue Feb 5, 2023
22 tasks
@thescientist13 thescientist13 moved this from 📋 Backlog to 🏗 In progress in [Greenwood] Phase 9 - Standards and Conventions Feb 25, 2023
@thescientist13 thescientist13 changed the title bundle and optimize server routes and serve from output directory (decouple serve task from source code) bundle and optimize server and API routes and serve from output directory (decouple serve task from source code) Feb 25, 2023
@thescientist13 thescientist13 moved this from 🏗 In progress to 👀 In review in [Greenwood] Phase 9 - Standards and Conventions Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha.5 breaking CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) SSR v0.28.0
Projects
No open projects
1 participant