Skip to content

feat(web): add web generator #285

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat(web): add web generator #285

wants to merge 3 commits into from

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented May 28, 2025

Fixes #7.

This PR adds the web generator.

Tasks / Issues

P1 – Must Complete Before Merge

  • Add more items (anyone can do this as they review1)

P2 – Must complete before migration

P3 – Can Be Done in a Follow-up

  • Remove mustache dependency
  • Adding a tooltip/expand to the DataTag
  • Use new Orama UI
  • Add more items (anyone can do this as they review1)

Get a preview

node bin/cli.mjs generate -t orama-db -i "/node/doc/api/*.md" -o "./out" # If you want search functionality
node bin/cli.mjs generate -t web -i "/node/doc/api/*.md" -o "./out" --index "/node/doc/api/index.md" # Specifying `--index` is optional, but recommended
npx serve out # You can serve the output, or just open one of the files in your browser. Serving is required for using search.

Footnotes

  1. Add things as they appear, or leave review comments. 2 3

@codecov-commenter
Copy link

codecov-commenter commented May 28, 2025

Codecov Report

Attention: Patch coverage is 53.89507% with 580 lines in your changes missing coverage. Please review.

Project coverage is 70.54%. Comparing base (6fa7d1b) to head (2e3f96d).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...nerators/jsx-ast/utils/createSignatureElements.mjs 30.37% 149 Missing ⚠️
src/generators/web/index.mjs 39.55% 81 Missing ⚠️
src/generators/jsx-ast/utils/buildContent.mjs 47.01% 71 Missing ⚠️
src/generators/web/build/generate.mjs 22.36% 59 Missing ⚠️
src/generators/web/build/css.mjs 24.19% 47 Missing ⚠️
src/generators/jsx-ast/utils/buildBarProps.mjs 36.92% 40 Missing and 1 partial ⚠️
src/generators/web/build/bundle.mjs 24.52% 40 Missing ⚠️
src/generators/jsx-ast/index.mjs 26.00% 37 Missing ⚠️
src/generators/orama-db/index.mjs 54.34% 21 Missing ⚠️
src/utils/queries/index.mjs 71.73% 10 Missing and 3 partials ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
- Coverage   72.12%   70.54%   -1.58%     
==========================================
  Files         117      128      +11     
  Lines        9984    10926     +942     
  Branches      597      633      +36     
==========================================
+ Hits         7201     7708     +507     
- Misses       2780     3211     +431     
- Partials        3        7       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller marked this pull request as ready for review May 28, 2025 22:13
@avivkeller avivkeller requested a review from a team as a code owner May 28, 2025 22:13
@avivkeller avivkeller marked this pull request as draft May 29, 2025 16:36
@avivkeller
Copy link
Member Author

avivkeller commented May 30, 2025

🎉 The code now dehydrates to the client so it can render without JavaScript!

@AugustinMauroy
Copy link
Member

🎉 The code now dehydrates to the client so it run without JavaScript!

Wow 😵‍💫 and what about codetab

@avivkeller
Copy link
Member Author

avivkeller commented May 30, 2025

It rehydrates and runs with JS, but if you don't have JS, you can still view the docs. I used React's SSRing

@avivkeller
Copy link
Member Author

@AugustinMauroy and I got search to finally work 🎉
image

@avivkeller avivkeller force-pushed the feat/web/gen branch 2 times, most recently from 024bbea to dbfe55d Compare June 3, 2025 21:40
@avivkeller
Copy link
Member Author

@nodejs/nodejs-website @nodejs/web-infra ChangeHistory and SideBar aren't implemented yet, so this is still a draft, but it's ready for you to take a look, so feel free to review :-)

@avivkeller avivkeller linked an issue Jun 6, 2025 that may be closed by this pull request
@avivkeller

This comment was marked as resolved.

@Qard

This comment was marked as off-topic.

@avivkeller

This comment was marked as resolved.

This comment was marked as outdated.

This comment was marked as outdated.

@avivkeller
Copy link
Member Author

@ovflowd Did something change on the main branch that required a fast-forward? I've undone that commit to see if it fixes the deployment.

@ovflowd
Copy link
Member

ovflowd commented Jul 12, 2025

@ovflowd Did something change on the main branch that required a fast-forward? I've undone that commit to see if it fixes the deployment.

Please don't undo the commit lol

@ovflowd
Copy link
Member

ovflowd commented Jul 12, 2025

It was just updated vercel permissions that needed to be fixed.

@avivkeller
Copy link
Member Author

Ahh I see, apologies.

@avivkeller
Copy link
Member Author

avivkeller commented Jul 12, 2025

I've re-requested review from previous web-team reviewers, since this PR has undergone substantial changes since the last code review comment.

I'm pleased to feel that this PR is in a place where it can land with minimal adjustments (where a follow-up tracking improvements can be made, see the list of improvements in the PR description).

@AugustinMauroy
Copy link
Member

Capture d’écran 2025-07-13 à 10 45 12

focusing a title make a ugly focus ring maybe upstream issue

@avivkeller
Copy link
Member Author

We have the same thing on https://nodejs.org, and I quite like it.
Screenshot 2025-07-13 at 11 10 32

@ovflowd
Copy link
Member

ovflowd commented Jul 13, 2025

Can we pin the remaining feedback items to be impl?:

And verify previous feedback was not missed accidentaly (I'd recommend @avivkeller going through the numerous comments I and Dario made xD)

@ovflowd
Copy link
Member

ovflowd commented Jul 13, 2025

(FYI Im only going to review the code once the remaining features are impl)

@avivkeller
Copy link
Member Author

Noted. I'll go through all the comments, and pin this the things still needing to be implemented in the PR description, sorted by priority.

@avivkeller
Copy link
Member Author

To some of the comments that needed an additional reply:

(@AugustinMauroy) "I think we should fix this on the node/nodejs.org side, but shouldn't the numerical index of the StabilityIndex component be at the top left?"

(@dario-piotrowicz) "the history selector's focus-visible style is barely noticeable in light mode"

(@dario-piotrowicz) "the Toggle navigation menu element is not very accessible, it has a role of button and an aria-label, but it doesn't seem like it is interactable via keyboard (tab navigation + enter)" (nodejs/nodejs.org has an issue open)

(@ovflowd)
"We should document what C, M, E (and the different versions of "C") mean somewhere. Either by a hover tooltip or "about this documentation""
"I think I have an idea for solving the "what are these "S", "C", "M"...""

(@avivkeller) "Adding a tooltip/expand to the DataTag, which explains what it refers to"

(@avivkeller) "Improving the UX of the Mobile Table Design" (nodejs/nodejs.org has an issue open)

These, if determined to be issues, are in https://github.com/nodejs/nodejs.org. Please open an issue there, if not already. Any changes there will be reflected in the @node-core/ui-components package, so I don't believe they block this PR, since, they are upstream issues.

(@dario-piotrowicz) "I personally think the stability alter boxes should include the word stability"

Have we reached consensus on whether or not to implement this? Perhaps as a title?

(@ovflowd) "Maybe also add a <hr /> between top level things (classes, idk)"

I don't think that's really needed, do you insist?

(@ovflowd) "Ah and some stuff seems to not be using the new table yet:"

See nodejs/node#59019

(@ovflowd) "It'd be great if we could also have a navbar 🤔 but maybe not (and not a blocker can be a folow-up)"

Do you want me to just copy the current navbar from https://github.com/nodejs/nodejs.org? Or, should this fetch https://github.com/nodejs/nodejs.org/blob/main/apps/site/navigation.json#L2.

(@ovflowd) "Can we make a visual representation of the extends?"

I'm still not sure how this would look? Would it be like a signature code block that's just

MyClass extends MySuperClass

(@ovflowd) "Shouldn't the ToC of file system include also the methods and classes? 🤔"

I've upped the depth.

(@avivkeller) "The History component does not show HTML"

(@avivkeller) _"Some typed lists are not rendered as tables"

This isn't an issue with this generator, so IMO it shouldn't block it.

See #326
See nodejs/node#59019 + #348

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

Successfully merging this pull request may close these issues.

Add Vercel Deployment once we have minimal CLI + Web generators ready Add react-web generator Write React Components
10 participants