Skip to content
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

fix(node-workspace): maintain the dependency version prefix in newCandidate #1748

Merged
merged 1 commit into from Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions __snapshots__/node-workspace.js
Expand Up @@ -24,7 +24,7 @@ Release notes for path: node1, releaseType: node

* The following workspace dependencies were updated
* dependencies
* @here/pkgB bumped from 2.2.2 to ^2.2.3
* @here/pkgB bumped from 2.2.2 to 2.2.3
</details>

---
Expand All @@ -49,7 +49,7 @@ exports['NodeWorkspace plugin run appends dependency notes to an updated module

* The following workspace dependencies were updated
* dependencies
* @here/pkgB bumped from 2.2.2 to ^2.2.3
* @here/pkgB bumped from 2.2.2 to 2.2.3
`

exports['NodeWorkspace plugin run combines node packages 1'] = `
Expand Down Expand Up @@ -138,7 +138,7 @@ Release notes for path: node1, releaseType: node

* The following workspace dependencies were updated
* dependencies
* @here/pkgA bumped from 3.3.3 to ^3.3.4
* @here/pkgA bumped from 3.3.3 to 3.3.4
</details>

<details><summary>@here/pkgC: 1.1.2</summary>
Expand All @@ -147,7 +147,7 @@ Release notes for path: node1, releaseType: node

* The following workspace dependencies were updated
* dependencies
* @here/pkgB bumped from 2.2.2 to ^2.2.3
* @here/pkgB bumped from 2.2.2 to 2.2.3
</details>

<details><summary>@here/pkgD: 4.4.5</summary>
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/node-workspace.ts
Expand Up @@ -242,13 +242,17 @@ export class NodeWorkspace extends WorkspacePlugin<Package> {
for (const [depName, resolved] of graphPackage.localDependencies) {
const depVersion = updatedVersions.get(depName);
if (depVersion && resolved.type !== 'directory') {
const currentVersion = this.combineDeps(pkg)?.[depName];
const prefix = currentVersion
? this.detectRangePrefix(currentVersion)
: '';
updatedPackage.updateLocalDependency(
resolved,
depVersion.toString(),
'^'
prefix
);
this.logger.info(
`${pkg.name}.${depName} updated to ^${depVersion.toString()}`
`${pkg.name}.${depName} updated to ${prefix}${depVersion.toString()}`
);
}
}
Expand Down