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

feat: adpate rspack copy plugin #3485

Merged
merged 2 commits into from
Apr 19, 2023
Merged

Conversation

GiveMe-A-Name
Copy link
Member

@GiveMe-A-Name GiveMe-A-Name commented Apr 18, 2023

Summary

🤖 Generated by Copilot at f737a2b

This pull request adds support for copying public and upload assets using both webpack and rspack bundlers in the @modern-js/app-tools package. It introduces a new rspack plugin adapter, refactors some common logic to shared functions and files, and updates the tests and changeset accordingly.

Details

🤖 Generated by Copilot at f737a2b

  • Add a changeset file to document the minor version bump and the features added for the @modern-js/app-tools package (link)
  • Add a builder plugin for rspack to handle the copy patterns and transform the public HTML files with the asset prefix variable (link)
  • Modify the createRspackBuilderForModern function to add the builderPluginAdpaterCopy to the builder instance (link,link)
  • Export two functions createPublicPattern and createUploadPattern from a new file createCopyPattern.ts to create the copy patterns for the public and upload assets respectively, using the webpack chain and the app context and config (link)
  • Replace the createCopyPattern function with the createPublicPattern and createUploadPattern functions in the builderPluginCompatModern and createOutputConfig functions respectively, to make the function names more specific and consistent (link,link,link,link)
  • Delete the createCopyPattern file and remove its export from the shared index file (link,link)
  • Export a function createCopyInfo from a new file createCopyInfo.ts to return the config, upload, and public directories based on the app context and config, and use it by both webpack and rspack bundlers (link,link)
  • Modify the modern.config.ts file in the copy-public-html fixture to support both webpack and rspack bundlers using an environment variable BUNDLER (link)
  • Modify the index.test.ts file in the copy-assets test to run the test for both webpack and rspack bundlers using the BUNDLER variable, and use a helper function testPublicHtml to avoid code duplication (link)
  • Add the opts.env option to the modernBuild function in the modernTestUtils.js file to allow passing custom environment variables to the build command (link)

Related Issue

Checklist

  • I have added changeset via pnpm run change.
  • I have updated the documentation.
  • I have added tests to cover my changes.

@changeset-bot
Copy link

changeset-bot bot commented Apr 18, 2023

🦋 Changeset detected

Latest commit: fbf20f1

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch coverage: 73.78% and project coverage change: +0.47 🎉

Comparison is base (99693f0) 57.59% compared to head (fbf20f1) 58.06%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3485      +/-   ##
==========================================
+ Coverage   57.59%   58.06%   +0.47%     
==========================================
  Files         672      669       -3     
  Lines       17794    17710      -84     
  Branches     3876     3836      -40     
==========================================
+ Hits        10249    10284      +35     
+ Misses       6934     6820     -114     
+ Partials      611      606       -5     
Impacted Files Coverage Δ
packages/cli/core/src/nodeApi.ts 0.00% <ø> (ø)
packages/cli/doc-plugin-auto-sidebar/src/index.ts 0.00% <0.00%> (ø)
...s/cli/plugin-changeset/src/commands/releaseNote.ts 36.95% <0.00%> (ø)
packages/cli/core/src/createCli.ts 72.00% <72.00%> (ø)
packages/cli/core/src/config/loadConfig.ts 83.33% <85.71%> (+0.25%) ⬆️
packages/cli/core/src/utils/initAppDir.ts 88.88% <88.88%> (ø)
packages/cli/core/src/index.ts 71.42% <100.00%> (-0.62%) ⬇️
packages/cli/core/src/types/index.ts 100.00% <100.00%> (ø)
packages/cli/core/src/utils/index.ts 100.00% <100.00%> (ø)
packages/cli/plugin-bff/src/cli.ts 60.00% <100.00%> (ø)
... and 2 more

... and 103 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@GiveMe-A-Name GiveMe-A-Name enabled auto-merge (squash) April 19, 2023 03:09
@GiveMe-A-Name GiveMe-A-Name merged commit 7c5c752 into main Apr 19, 2023
6 checks passed
@GiveMe-A-Name GiveMe-A-Name deleted the feat/rspack-provider-support-copy branch April 19, 2023 04:13
This was referenced Apr 20, 2023
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.

None yet

3 participants