Skip to content

Conversation

@ovflowd
Copy link
Member

@ovflowd ovflowd commented Nov 3, 2025

This PR removes the removal of files during also the crazy copy of files, deferring the out/ folder cleanup to docclean as it probably should. The original intent of the rm command was to ensure files that do not exist on source anymore and are irrelevant will be removed, but this isn't really an issue and eventually the legacy generator will go away.

Simplifed to a simple copyFile call too.

@ovflowd ovflowd requested a review from a team as a code owner November 3, 2025 22:55
Copilot AI review requested due to automatic review settings November 3, 2025 22:55
@vercel
Copy link

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
api-docs-tooling Ready Ready Preview Nov 9, 2025 1:59am

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.42%. Comparing base (b799808) to head (190b266).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #482      +/-   ##
==========================================
+ Coverage   74.40%   74.42%   +0.02%     
==========================================
  Files         110      110              
  Lines       10482    10468      -14     
  Branches      704      700       -4     
==========================================
- Hits         7799     7791       -8     
+ Misses       2680     2674       -6     
  Partials        3        3              

☔ 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.

Copy link
Contributor

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 safeCopy utility to use Node.js's native fs.copyFile instead of manual readFile/writeFile operations, improving efficiency and handling of concurrent operations. Additionally, it removes the aggressive cleanup step (rm) that was previously deleting the entire assets directory before copying.

Key Changes

  • Replaced readFile/writeFile with native copyFile API for better performance and atomicity
  • Removed the rm call that was deleting the entire assets directory before copying
  • Added comprehensive test coverage for the safeCopy function

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/generators/legacy-html/utils/safeCopy.mjs Refactored to use copyFile instead of manual read/write operations; updated documentation
src/generators/legacy-html/utils/tests/safeCopy.test.mjs Added comprehensive test suite covering various scenarios
src/generators/legacy-html/index.mjs Removed aggressive rm call that deleted the entire assets directory

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This comment was marked as resolved.

@avivkeller
Copy link
Member

Whoops! I thought the bot would just make a commit, not open a whole different PR.

@ovflowd
Copy link
Member Author

ovflowd commented Nov 4, 2025

cc @aduh95 / @avivkeller / @flakey5 can y'all test if y'all see any issues with this one?

I tried:

-j
-j 32
-j 64
-j 128
-j 256

Didn't find any errors.

@avivkeller
Copy link
Member

Let's give it a try :-). If it fails in the PR (for @aduh95), we can fall back to #483

@aduh95 aduh95 self-requested a review November 5, 2025 13:21
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

I'm no longer getting errors! Left a suggestion

@ovflowd
Copy link
Member Author

ovflowd commented Nov 5, 2025

@avivkeller PR is failing

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@avivkeller

This comment was marked as resolved.

@ovflowd

This comment was marked as off-topic.

@avivkeller

This comment was marked as off-topic.

@avivkeller

This comment was marked as off-topic.

@ovflowd

This comment was marked as off-topic.

@avivkeller
Copy link
Member

@nodejs/web-infra for reviews

@ovflowd
Copy link
Member Author

ovflowd commented Nov 6, 2025

cc @aduh95 can you test the current commit, and report back if it works fine? And if it does, approve the PR? cc @nodejs/web-infra we need more reviews too.

@ovflowd
Copy link
Member Author

ovflowd commented Nov 7, 2025

Bump, @aduh95 :3

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

I don't get any errors

Copy link
Member

@flakey5 flakey5 left a comment

Choose a reason for hiding this comment

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

lgtm but also I second #482 (comment)

@ovflowd ovflowd merged commit 0a64160 into main Nov 9, 2025
19 checks passed
@ovflowd ovflowd deleted the chore/a-tiny-bit-safer-approach branch November 9, 2025 02:07
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.

5 participants