-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: use workspace spec alias by default in pnpm add #4947
feat: use workspace spec alias by default in pnpm add #4947
Conversation
cfa463a
to
4964de1
Compare
Isn't it a breaking change? You suggested using a setting in #4887. Maybe it is fine to do, I am not sure. I need to test first whether changesets support it well out of the box. |
Yes, it's a breaking change. My intention was twofold: change the default and make it configurable. I've only done the first so far because I was not able to code the configuration part. |
30f10a5
to
7a8c96d
Compare
I understand that maintaining backwards compatiblity and giving users the configuration choices are important for the success of pnpm. That's why I've come up with an alternative proposal, tell me what you think. Right now this PR makes rolling: shouldUseWorkspaceProtocol The change is that now I use reuse the semantics of existing options rolling: shouldUseWorkspaceProtocol && opts.saveWorkspaceProtocol === 'rolling' We would be able to offer users the following configurability space for
The cons with respect to the original proposal are minimal
The pros are
|
4bc0d69
to
54aa60f
Compare
With
That is fine.
Sounds fine. |
switch (pinnedVersion ?? 'major') { | ||
case 'none': | ||
return '*' | ||
case 'major': | ||
return `^${version}` | ||
if (rolling) return '^' | ||
return !version ? '*' : `^${version}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this line not just ^${version}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because version may not be defined, in which case *
should be used instead (assuming that rolling is not enabled). E.g. createVersionSpec(undefined, { pinnedVersion: 'major' })
Previously there was a guard at the beginning of the function to handle this case.
export function createVersionSpec (version, ...) {
if (!version) return '*'
...
}
But after introducing rolling
, we first have to check if rolling
was requested because now we can return a pinned version even if we do not know the current version number, e.g. ^
. Otherwise we check if version
is defined and return a result accordingly.
54aa60f
to
705f561
Compare
Please add a changeset for "pnpm" and some explanatory description with more details that you want to appear on the release page. |
705f561
to
0437bca
Compare
Yes, I just wanted to make sure that it was intuitive enough. I was afraid that setting a property to
Done |
Makes workspace spec aliases (
workspace:^
,workspace:~
andworkspace:*
) the default version specifiers when a workspace package is added.Related to #4887