Skip to content

feat(build): support pnpm workspace: protocol in dependencies#78

Open
matehortua-godaddy wants to merge 2 commits into
godaddy:mainfrom
matehortua-godaddy:feat/workspace-protocol-support
Open

feat(build): support pnpm workspace: protocol in dependencies#78
matehortua-godaddy wants to merge 2 commits into
godaddy:mainfrom
matehortua-godaddy:feat/workspace-protocol-support

Conversation

@matehortua-godaddy

Copy link
Copy Markdown

Summary

  • Strip workspace: prefix from dependency version specifiers in parse-options.js before passing them to version resolution
  • Enables @radpack/build to work in pnpm workspace monorepos where packages use workspace:*, workspace:^, workspace:~, or workspace:^x.y.z specifiers
  • workspace:* is treated as * (wildcard, use latest at run-time)
  • workspace:^1.0.0 is treated as ^1.0.0 (standard semver range)

Motivation

When using @radpack/build in a pnpm workspace monorepo, the build fails with:

Error: Unsupported version 'workspace:*' specified for '@wsb/guac-widget-shared/lib/components/SocialLinks, available: 1.7.11

The workspace: protocol is a pnpm-specific feature for referencing local packages. It has no semver meaning — it's a package manager instruction that should be transparent to build tools.

Changes

  • packages/build/src/parse-options.js: Strip workspace: prefix when building the dependencies map
  • packages/build/test/unit/parse-options.test.js: New test file covering all workspace protocol variants

Test plan

  • All 25 existing unit tests pass
  • 4 new tests for workspace protocol handling pass
  • Verify with pnpm workspace monorepo using workspace:* specifiers

matehortua-godaddy and others added 2 commits June 10, 2026 14:46
When using @radpack/build in a pnpm workspace monorepo, dependency
specifiers like `workspace:*`, `workspace:^1.0.0`, or `workspace:~`
are used to reference local packages. The build step now strips the
`workspace:` prefix before version resolution, treating them as their
underlying semver range.

This enables radpack-built packages to coexist in pnpm workspaces
without requiring manual version pinning workarounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When pnpm's workspace:^ or workspace:~ is stripped to just ^ or ~,
get-version now resolves the latest available version and applies the
appropriate prefix (caret or tilde) to the manifest output.

This ensures radpack manifests contain proper versioned externals like
@wsb/guac-widget-shared@^1 even when the source package.json uses
workspace:^ shorthand.
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.

3 participants