Skip to content

Commit

Permalink
Merge pull request microsoft#4066 from dmichon-msft/rush-version-perf…
Browse files Browse the repository at this point in the history
…ormance

[rush-lib] Improve performance of 'rush version --bump'
  • Loading branch information
octogonz authored Apr 20, 2023
2 parents 41cfe3e + 46f3a98 commit 63304a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Improve performance of 'rush version' when using 'workspace:' protocol.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
28 changes: 13 additions & 15 deletions libraries/rush-lib/src/logic/PublishUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,21 +788,19 @@ export class PublishUtilities {
// If the version range exists and has not yet been updated to this version, update it.
if (requiredVersion.versionSpecifier !== change.newRangeDependency || alwaysUpdate) {
let changeType: ChangeType | undefined;
if (changeType === undefined) {
// Propagate hotfix changes to dependencies
if (change.changeType === ChangeType.hotfix) {
changeType = ChangeType.hotfix;
} else {
// Either it already satisfies the new version, or doesn't.
// If not, the downstream dep needs to be republished.
// The downstream dep will also need to be republished if using `workspace:*` as this will publish
// as the exact version.
changeType =
semver.satisfies(change.newVersion!, requiredVersion.versionSpecifier) &&
!isWorkspaceWildcardVersion
? ChangeType.dependency
: ChangeType.patch;
}
// Propagate hotfix changes to dependencies
if (change.changeType === ChangeType.hotfix) {
changeType = ChangeType.hotfix;
} else {
// Either it already satisfies the new version, or doesn't.
// If not, the downstream dep needs to be republished.
// The downstream dep will also need to be republished if using `workspace:*` as this will publish
// as the exact version.
changeType =
!isWorkspaceWildcardVersion &&
semver.satisfies(change.newVersion!, requiredVersion.versionSpecifier)
? ChangeType.dependency
: ChangeType.patch;
}

hasChanges = PublishUtilities._addChange({
Expand Down

0 comments on commit 63304a8

Please sign in to comment.