feat: treat bare workspace: protocol as workspace:*#10436
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for the bare workspace: protocol (without version specifier), treating it equivalently to workspace:* so that it resolves to the referenced package's concrete version during publish.
Changes:
- Modified workspace resolution to treat empty version strings as wildcards
- Updated npm resolver to convert bare
workspace:to* - Enhanced manifest export logic to handle bare workspace protocol
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| workspace/resolve-workspace-range/src/index.ts | Added empty string check to treat bare protocol like *, ^, ~ |
| resolving/npm-resolver/src/workspacePrefToNpm.ts | Added conversion of empty version to * |
| resolving/npm-resolver/test/workspacePrefToNpm.test.ts | Added test case for bare workspace: protocol |
| pkg-manifest/exportable-manifest/src/index.ts | Updated regex and logic to match bare workspace protocol |
| pkg-manifest/exportable-manifest/test/index.test.ts | Added test case with quux: 'workspace:' dependency |
| .changeset/nine-areas-glow.md | Documented the new feature as a minor version bump |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| export function resolveWorkspaceRange (range: string, versions: string[]): string | null { | ||
| if (range === '*' || range === '^' || range === '~') { | ||
| if (range === '*' || range === '^' || range === '~' || range === '') { |
There was a problem hiding this comment.
The change adds support for empty range strings (for bare workspace: protocol), but there are no test cases covering this new behavior. Consider adding tests to verify that resolveWorkspaceRange('', versions) correctly returns the maximum version from the provided versions array, similar to how '*', '^', and '~' are handled.
47dfba8 to
14bf72c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Congrats on merging your first pull request! 🎉🎉🎉 |
* feat: treat bare `workspace:` protocol as `workspace:*` * chore: add chageset * test(exportable-manifest): add test for `workspace` with explicit versions * test: add tests and update changesets --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
close #10381
This PR changes the bare
workspace:protocol (without*,^or~) to be treated as equivalent toworkspace:*, so it resolves to the referenced package's concrete version during publish.There are existing repositories using this syntax: https://github.com/search?q=path%3Apackage.json+%22%5C%22workspace%3A%5C%22%22&type=code&p=1