Skip to content

feat: Add option to strip workspace: protocol from dependencies in zipped sources #1689

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

darthmaim
Copy link

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 packages1, 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.

Related PRs

Footnotes

  1. Here is the documentation of the different package managers on how they handle workspace:: pnpm / yarn / deno / bun

Copy link

netlify bot commented May 30, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 6059387
🔍 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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@darthmaim darthmaim force-pushed the feature/strip-workspace branch from c9d30a8 to 6059387 Compare May 30, 2025 13:19
@darthmaim darthmaim changed the title Add option to strip workspace: protocol from dependencies in zipped sources feat: Add option to strip workspace: protocol from dependencies in zipped sources May 30, 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.

1 participant