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

rfc/issue 1167 content as data #1266

Draft
wants to merge 25 commits into
base: release/0.30.0
Choose a base branch
from

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Aug 11, 2024

Related Issue

resolves #1167

For a demo of all these features see ProjectEvergreen/www.greenwoodjs.dev#49

Summary of Changes

  1. Introduced Collections as the successor to Menus with test cases
  2. Add support for "rich" frontmatter with test cases
  3. Introduce a first party "content" server with helper query utilities
  4. Refactor and clean up graph properties, with better defaults (and updated website frontmatter accordingly)
  5. Apply appropriate Netlify redirects in netlify.toml
  6. Refreshed content as data and adjacent docs, moved more of the GraphQL docs to the plugin's README

TODOs

  1. Rename interpolateFrontmatter -> activeFrontmatter
  2. Frontmatter / graph node properties refactoring (and update website as needed)
  3. GraphQL refactoring
    • Delete config schema for GraphQL
    • align with CLI collection utils (ideally)
  4. Make more / less content as data available through active frontmatter + test cases
    <!-- so would be nice if we could use other content as data, e.g. -->
    <app-toc route="${globalThis.page.route}"></app-toc>
    
    <!-- for now, just using userland frontmatter -->
    <app-toc route="${globalThis.page.route}"></app-toc>
  5. downstream observations - content/issue 33 guides pages www.greenwoodjs.dev#94
    • title not populating as active frontmatter (is this because we set it to null?)
    • why do run an unshift on content as data in the graph?
  6. realized in feature/issue 34 blog landing page and all posts www.greenwoodjs.dev#84 that we were never checking for activeFrontmatter when rendering page layout <title>
  7. prune collections serializing to only the bare essentials for CSR (data, route, ???)
  8. use content server port as dev server += 1
  9. how to sync queries.js (rename to client) host and port with greenwood config / content server
  10. hashing / hydration techniques from GraphQL world, e.g. APOLLO DATA
  11. looks like import map merging was broken when no import map exists? - feature/issue 34 blog landing page and all posts www.greenwoodjs.dev#84
    • also make sure only one import map exists
    • needs to account for import map configuration now
  12. collection APIs develop specs?
  13. Documentation
    • rename menus -> collections
    • rename interpolateFrontmatter -> activeFrontmatter
    • graph property changes
    • ${graph.page.data.foo}
    • data/client.js
    • update GraphQL plugin README
    • external sources plugin
    • adapters
  14. we already get frontmatter contents in the graph phase, but we re-get it in html resource plugin
  15. need relaxed node modules plugin intercept patch?
  16. how come Response merging isn't working?
  17. make sure client.js and GraphQL resolvers are handling basePath
  18. build graphQL resolvers off of greenwood internal functions / content API endpoint - I think would rather wait until support hot reloading content as data changes during development #1278
  19. content as data work should probably happen in the plugin (instead of in HTML plugin)
  20. clean up TODOs / console logging

Thoughts / Observations

  1. alternate namespace to globalThis ?
    <title>${globalThis.page.title}</title>
  2. Is a content server OK for now?
    • Could we just intercept API requests instead using a resource plugin instead?
    • should we inline for production builds instead of using fetch requests, e.g. <script type="application/json" GWD-DATA ...></script>
    • leave no trace? 🏕️
  3. I wonder if there is a case to rename graph to pages instead? A graph implies nodes, some sort of linking structure, etc which it is definitely not in its current state.
  4. Messy / noisy output for “rich” activeFrontmatter :/
    • can we at least prune some stuff?
    • at least recommend prerender + static opt (e.g. in JS) 👇
  5. Related to prerendering and Rendering Strategies (prerender vs SSR vs CSR) #951
    • prerender caveat - only your components run once, not your generic inline <script> tags!
    • When to use active frontmatter vs CSR + prerendering vs hydration?
    • with active frontmatter, it's there in the HTML. With CSR prerender, no remnants left behind, a la carte via <script type="application/json">
    • This all feels somewhat "RSC-y" (e.g. fetch data close to your components). I think if we can come up with some sort of hydration / islands story here, this could become a really nice pattern, at least for static sites (what happens when you're graph "gets huge" though? Just read from the DOM to hydrate?
    • to the above point, instead of data-gwd-opt="static", should we create something like use static? 🤔
    • or could WCC "unwrap" a light DOM component? (e.g. <my-heading><h1>Hello World!</h1></my-heading> -> <h1>Hello World!</h1> 🤔 🤔
  6. as far as renaming things, I suppose we could potentially align with the xxxHref naming convention to
    • context - e.g. outputDir, scratchDir, userWorkspace and append Href
    • bundled resources - e.g. optimizedFileName, etc

@thescientist13 thescientist13 added question Further information is requested RFC Proposal and changes to workflows, architecture, APIs, etc CLI Content as Data breaking feature New feature or request labels Aug 11, 2024
@thescientist13 thescientist13 linked an issue Aug 11, 2024 that may be closed by this pull request
@thescientist13 thescientist13 self-assigned this Aug 11, 2024
@thescientist13 thescientist13 added the documentation Greenwood specific docs label Aug 11, 2024
@thescientist13 thescientist13 added the website Tasks related to the projects website / documentation label Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking CLI Content as Data documentation Greenwood specific docs feature New feature or request question Further information is requested RFC Proposal and changes to workflows, architecture, APIs, etc website Tasks related to the projects website / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content as Data
1 participant