-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
feat(infra): migrate to Next.js infrastructure #4991
Conversation
Can you add updating |
Oh @richardlau I'm going to inspect the whole scripts folder to remove any non-needed script and update all the needed ones. Don't worry about that 👀 But yea, going to update the PR description. |
Do we have any insights into how this will affect performance, file sizes, latency, etc.? Do URLs to existing resources remain the same? |
@tniessen this is only an infrastructure migration meaning:
This means this PR is a foundational change for:
In terms of DX and development this means:
For content publishers:
|
For performance and how long build takes time, this is something we can only benchmark once the whole thing is buildable. Right now it doesn't build yet, so there are a lot of things to be done :) But of course I expect instead of taking less than one minute to at least 2-7 minutes for full cold-build time. (First time it gets built) For CI we will be leveraging cache and other things but it's honestly too soon to talk about any of these. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Happy to announce this PR is finally ready to be reviewed 🎉 |
Is it me or is the toggle dark mode not working? |
@ovflowd is there a built demo version? |
Sadly there's not, I believe I could set-up a GitHub pages, but it would not "route" the |
@AugustinMauroy it seems to be working fine for me. |
Props for the effort on this. FWIW, the theme and language pickers don't work for me on the news (/en/blog) page but work fine elsewhere. I also visually compared most of the other pages to the current live version and couldn't see any obvious issues. |
This comment was marked as resolved.
This comment was marked as resolved.
Here's a build: https://nodejs-org-next-92b1511700.netlify.app/en/ |
Hey, @mikeesto I've just updated the main PR description explaining about these behaviors. But a TL;DR is: As this is a fully static generated website, the i18n redirection (pages that not exist within a certain language) is done via NGINX on our production infrastructure. |
This comment was marked as resolved.
This comment was marked as resolved.
Hey y'all, I've just updated the main description of this PR containing more details regarding divergences within this implementation, immediate next steps, etc |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Co-authored-by: Michael Esteban <mickel13@gmail.com> Signed-off-by: Claudio Wunder <cwunder@gnome.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSLGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSLGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubber-stamp LGTM
This PR is a draft to migrate the underlying infrastructure from Handlebars and Metalsmith to JSX (React) and Next.js.
PR-Progress (Checklist)
theme.tsx
to use the correct layouti18n/locales/{localeCode}.json
public/static/js
to be modern-proof and work well with Next.jsexternal/survey
content topublic/en/
Changes
Migration of Structure
A few directories have been changed to accommodate the new Next.js folder structure. Notably, these are the significant changes:
components
styles
locale/
topages/
static/
topublic/static
(Links will be preserved)layouts
data
i18n
The deletion of per-locale
site.json
and creation of a globalsite.json
i18n specific metatdata will be moved to
i18n/config.json
as the aggregate of all i18n metadata. Specific translation texts (such as "Next" button) or other translated text will be moved toi18n
localization files such asi18n/locales/en.json
. This is the same approach adopted currently onnodejs.dev
repository to ease the migration.Navigation structure and other non-related global metadata will be moved towards a global
data/site.json
and respectively for Navigation topages/_meta.json
files.Migration of Handlebars Templates to JSX
Many of the current "Handlebars" scripts (for templating-engine) will be ported to either JavaScript utils or JSX Components, and the current Layouts will also be ported to JSX.
Migration from old tooling/scripts
Currently, we have scripts to generate the metadata of releases, versions, and the release schedule of Node.js; we should adopt the nodes from Nodejs.dev as they're going to be adopted anyways. This can be done either in this PR or in a follow-up, depending on the complexity of migrating the current scripts.
Items to be done after this PR
As mentioned, this is an initial implementation for this issue, following-up there will still be some improvements to be done, such as removing more legacy content and normalizing the JSX code and a few other things.
After that, we can start porting the layout and content from the Nodejs.dev repository.
Final Considerations (Updated on 24/01/2023)
As mentioned, this is an initial implementation (part of a transitionary phase). Much of the content added within this PR will be discarded in future PRs.
A few quirks from the original nodejs.org website are not available within this initial PR, as they do not bring value in the short-term (having the consideration that these same things will be discarded and considering the value x effort to have them done).
What was not ported from the original Nodejs.org codebase?
main
branch, all non-translated pages have their respective i18n context injected and the original English content file (Markdown) copied and bundled together.nodejs.org/{otherLanguage}/some-page-not-translated-in-that-language
without being redirected tohttps://nodejs.org/en/the-original-page-in-english
Download Page => Previous Builds
, instead of showing all versions sinceNode.js 0.10
, we adopted the same approach done onhttps://nodejs.dev
and show all the previous versions that are still "maintained" or in "maintenance" mode. All that page data was significant, and we wonder if people want to search for such old versions of Node.js on the website.HTML
tag withdir
andhtmlLang
attributes cannot be added due of howNext.js
document composition works. This will be solved with SSR on a following PR.What is going to be done on very immediate PRs
en/blog
) will be replaced by the pages fromnodejs.dev
. Meaning translations will also be dropped. This was discussed here.two-letter
folder approach and way less file generation at build time.nodejs.dev
starts, all the current layouts, scripts, and many other existing components will be dropped or adapted.nodejs.dev
Testing Locally / Caveats on the Static Build
TL;DR:
npm ci && npm run serve
. Browser:http://localhost:3000/en/
/
to/en
redirection, 404-page handling, and redirection from untranslated pages to/en/original-apge
. So please do not worry if these don't work if you're trying out a complete exported build of this branch locally. These should work out of the box with the current NGINX configuration.npm ci && npm run serve
npm ci && npm run build && npm run start
Live version: (Updated on 23/01/2023) https://nodejs-org-next-92b1511700.netlify.app/en/
Relates to #4958
cc @nodejs/website @nodejs/nodejs-dev @nodejs/build