Skip to content

Conversation

laneysmith
Copy link
Contributor

@laneysmith laneysmith commented Jun 5, 2025

Current Behavior

In the legacy versioning logic, you could use workspace protocol and pinned versions for the same upstream dependency, and bumping the upstream package would only affect downstream projects that depended on it via workspace protocol:

{
  "name": "@company/upstream",
  "version": "8.1.0"
}

{
  "name": "@company/downstream-pinned",
  "version": "0.0.1"
  "dependencies": {
    "@company/upstream": "7.3.4" // <--- pinned
  }
}

{
  "name": "@company/downstream-workspace",
  "version": "0.0.1"
  "dependencies": {
    "@company/upstream": "workspace:^"
  }
}

The new versioning logic introduced a regression where the pinned version would be bumped to the latest version of the upstream package. So bumping @company/upstream to 8.2.0 replaces "@company/upstream": "7.3.4" with "@company/upstream": "8.2.0" in @company/downstream-pinned.

Expected Behavior

Bumping "@company/upstream" to 8.2.0 should only affect "@company/downstream-workspace" and not "@company/downstream-pinned".

In our Nx monorepo, we generally adhere to a single version policy, but we have a few exceptions where we need to pin versions during migrations. Given that Nx supports both single version policy and independently maintained dependencies, I'd expect that we could continue to use pinned versions in this scenario.

Related Issue(s)

Fixes # #31454

Copy link

vercel bot commented Jun 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jun 6, 2025 11:35pm

Copy link
Contributor

nx-cloud bot commented Jun 5, 2025

View your CI Pipeline Execution ↗ for commit 5ea53e9.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 35m 21s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 7s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 2m View ↗

☁️ Nx Cloud last updated this comment at 2025-06-07 00:04:19 UTC

@@ -1332,6 +1332,17 @@ Valid values are: ${validReleaseVersionPrefixes
if (!currentDependencyVersion) {
continue;
}
const targetMatchesRequirement =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapted from this line in release-version/utils/resolve-local-package-dependencies.ts.

@laneysmith laneysmith changed the title fix(js): stop bumping pinned versions when preserveLocalDependencyPro… fix(js): stop bumping pinned versions when proposed version bump does not satisfy current semver version Jun 5, 2025
@laneysmith laneysmith changed the title fix(js): stop bumping pinned versions when proposed version bump does not satisfy current semver version fix(js): WIP stop bumping pinned versions when proposed version bump does not satisfy current semver version Jun 5, 2025
@laneysmith laneysmith force-pushed the laneys/fix-31454-dont-bump-pinned-versions-with-preserveLocalDependencyProtocols branch from 6535709 to db1c04e Compare June 6, 2025 22:50
@laneysmith laneysmith force-pushed the laneys/fix-31454-dont-bump-pinned-versions-with-preserveLocalDependencyProtocols branch from db1c04e to 5ea53e9 Compare June 6, 2025 23:22
@FrozenPandaz FrozenPandaz added the priority: medium Medium Priority (not high, not low priority) label Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Medium Priority (not high, not low priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants