feat: assets copying#753
Conversation
PR SummaryLow Risk Overview A new
Reviewed by Cursor Bugbot for commit 7369ac5. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #753 +/- ##
==========================================
+ Coverage 84.48% 84.60% +0.12%
==========================================
Files 174 176 +2
Lines 15634 15802 +168
Branches 1387 1411 +24
==========================================
+ Hits 13208 13369 +161
- Misses 2416 2423 +7
Partials 10 10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Why can't the user specify "all my assets are in |
If you mean as what do you think? |
Say wdyt @nodejs/web-infra I want opinions |
|
I'll hold off on fixing the bot's comments, Waiting for the final decision. |
yeah this is a really common pattern |
|
@moshams272 We've decided to use the We think the default should be |
536ed59 to
56ae71a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 56ae71a. Configure here.
avivkeller
left a comment
There was a problem hiding this comment.
other than my previous concern, lgtm
bjohansebas
left a comment
There was a problem hiding this comment.
The changes look good to me, but could we add some tests?

Description
Local images referenced in Markdown files were not resolved correctly or copied to the final build, this PR will solve this by copying the images in the
output/assets/.I solved this from root from the jsx-ast phase as they are markdown AST because we can iterate on them easier than JSX elements.
Steps:
Updated
src/generators/ast/generate.mjsto include the absolutefullPathof each Markdown file.Updated
src/generators/metadata/utils/parse.mjsto include thefullPathinto the metadata entries.Implemented
extractAssetsFromASTinsrc/generators/jsx-ast/utils/buildContent.mjs, that identifies local images, rewrites their URLs to a centralized /assets/ directory, and collects the source paths.Implemented
copyProjectAssetsto the web generatorsrc/generators/web/generate.mjsto aggregate all unique assets and copy them to the output directory.Validation
Added tests in
src/generators/jsx-ast/utils/__tests__/buildContent.test.mjsto verify that theassetsMapis populated with absolute paths.Tested against Node.js API documentation; local images (like
logo.png) are now correctly copied to the out/assets folder and displayed in the web generated.Related Issues
#748
Check List
node --run testand all tests passed.node --run format&node --run lint.