I'm using explicit workspace:^1.2.3-style versions for peerDependencies so as to comply with npm's recommendation to keep peerDependencies ranges as broad as possible - this way I can manually bump them when the change becomes significant.
However; here:
|
if ( |
|
!depCurrentVersion || |
|
depCurrentVersion.startsWith("file:") || |
|
depCurrentVersion.startsWith("link:") || |
|
!shouldUpdateDependencyBasedOnConfig( |
|
{ version, type }, |
|
{ |
|
depVersionRange: depCurrentVersion, |
|
depType, |
|
}, |
|
{ |
|
minReleaseType: updateInternalDependencies, |
|
onlyUpdatePeerDependentsWhenOutOfRange, |
|
} |
|
) |
|
) { |
|
continue; |
|
} |
|
const usesWorkspaceRange = depCurrentVersion.startsWith("workspace:"); |
The raw range (workspace:^1.2.3) is passed to shouldUpdateDependencyBasedOnConfig; which in turn passes it to semver:
|
): boolean { |
|
if (!semverSatisfies(release.version, depVersionRange)) { |
|
// Dependencies leaving semver range should always be updated |
|
return true; |
|
} |
Semver seems to always see this as "unsatisfied" (presumably because it's "invalid").
You have explicit checks later for workspace:^-style (implicit) ranges:
|
if (usesWorkspaceRange) { |
|
const workspaceDepVersion = depCurrentVersion.replace( |
|
/^workspace:/, |
|
"" |
|
); |
|
if ( |
|
workspaceDepVersion === "*" || |
|
workspaceDepVersion === "^" || |
|
workspaceDepVersion === "~" |
|
) { |
|
continue; |
|
} |
|
depCurrentVersion = workspaceDepVersion; |
|
} |
so I don't think this is intentional.
I've worked around this by having shouldUpdateDependencyBasedOnConfig strip workspace: prefix before running semver comparison, but I'm not certain this is the right fix:
https://github.com/graphile/crystal/blob/2807c8e211b97302299029b88ecb5df7426994b4/.yarn/patches/%40changesets-apply-release-plan-npm-7.0.13-14603bf9e7.patch#L8-L16
I'm using explicit
workspace:^1.2.3-style versions forpeerDependenciesso as to comply with npm's recommendation to keep peerDependencies ranges as broad as possible - this way I can manually bump them when the change becomes significant.However; here:
changesets/packages/apply-release-plan/src/version-package.ts
Lines 47 to 65 in 3ab4d89
The raw range (
workspace:^1.2.3) is passed toshouldUpdateDependencyBasedOnConfig; which in turn passes it tosemver:changesets/packages/apply-release-plan/src/utils.ts
Lines 38 to 42 in 3ab4d89
Semver seems to always see this as "unsatisfied" (presumably because it's "invalid").
You have explicit checks later for
workspace:^-style (implicit) ranges:changesets/packages/apply-release-plan/src/version-package.ts
Lines 75 to 88 in 3ab4d89
so I don't think this is intentional.
I've worked around this by having
shouldUpdateDependencyBasedOnConfigstripworkspace:prefix before running semver comparison, but I'm not certain this is the right fix:https://github.com/graphile/crystal/blob/2807c8e211b97302299029b88ecb5df7426994b4/.yarn/patches/%40changesets-apply-release-plan-npm-7.0.13-14603bf9e7.patch#L8-L16