wxt
wxt copied to clipboard
feat: Add option to strip `workspace:` protocol from dependencies in zipped sources
Overview
This adds a new option zip.stripWorkspaceProtocol to strip the workspace: protocol from dependencies when zipping the sources. All package managers except npm do this when publishing packages[^1], and since creating the zip is a form of publishing, wxt should do the same.
This is an option defaulting to false, as some people zip monorepos using sourcesRoot: '../..', or similar, where the workspace: protocol should be kept.
Note that this only strips the prefix for now (so workspace:* becomes *, instead of replacing *, ^ and ~ with the version defined in the workspace like the package managers do.
Manual Testing
Create a new extension in a monorepo depending on a workspace dependency, and then create the zip using wxt zip -b firefox. Check the generated package.json in the sources.zip.
I was sadly not able to write a e2e test for this, as all the tests run with --ignore-workspace added at various points. Maybe the e2e tests could be improved to create the projects in a path outside the wxt repo (maybe /tmp/wxt-e2e/<id>, instead of e2e/dist/<id>, so scenarios using workspace could be tested.
[^1]: Here is the documentation of the different package managers on how they handle workspace:: pnpm / yarn / deno / bun
Related PRs
- #1685
Deploy Preview for creative-fairy-df92c4 ready!
| Name | Link |
|---|---|
| Latest commit | 605938797275457daa1192979983b8ec271c840c |
| Latest deploy log | https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6839b058b01da20008da5b9f |
| Deploy Preview | https://deploy-preview-1689--creative-fairy-df92c4.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.