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

chore: refactor the generateBlogData function #7607

Merged

Conversation

dario-piotrowicz
Copy link
Contributor

Description

This PR is simply am refactoring the generateBlogData function, as I was working around the function I noticed that the code could be simplified and Promise.all could be used to read the files frontmatter in parallel, hopefully this makes sense and I am not missing some nuances in the code 😅

If the changes here are correct they should both simplify the code and make it faster 🙂

Validation

I simply run npm run dev to manually validate that this is working as intended

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@Copilot Copilot bot review requested due to automatic review settings April 1, 2025 17:41
@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner April 1, 2025 17:41
Copy link

vercel bot commented Apr 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Apr 1, 2025 5:44pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the generateBlogData function to simplify the code and improve performance by leveraging Promise.all for parallel file processing.

  • Apply Promise.all with a map over filenames to process file frontmatter concurrently.
  • Simplify the accumulation of raw frontmatter and resolution logic for each file.

@dario-piotrowicz dario-piotrowicz changed the title simplify and speed up the generateBlogData function chore: refactor the generateBlogData function Apr 1, 2025
@dario-piotrowicz dario-piotrowicz force-pushed the dario/improve-generateBlogData branch from 9c5c742 to c497efa Compare April 1, 2025 17:42
Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟠 89 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Unit Test Coverage Report

Title Lines Statements Branches Functions
@node-core/ui-components Coverage: 95%
95.83% (161/168) 77.86% (102/131) 88.57% (31/35)
@nodejs/website Coverage: 87%
84.74% (500/590) 76.03% (165/217) 87.09% (108/124)
Title Tests Skipped Failures Errors Time
@node-core/ui-components 24 0 💤 0 ❌ 0 🔥 4.986s ⏱️
@nodejs/website 157 0 💤 0 ❌ 0 🔥 6.465s ⏱️

Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great first official contribution - thanks!

@ovflowd ovflowd added this pull request to the merge queue Apr 3, 2025
Merged via the queue into nodejs:main with commit b7364b9 Apr 3, 2025
15 checks passed
dario-piotrowicz added a commit to dario-piotrowicz/nodejs.org that referenced this pull request Apr 3, 2025
ovflowd pushed a commit that referenced this pull request Apr 3, 2025
@dario-piotrowicz dario-piotrowicz deleted the dario/improve-generateBlogData branch April 3, 2025 21:08
dario-piotrowicz added a commit to dario-piotrowicz/nodejs.org that referenced this pull request Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants