-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Current Behavior
Info about the workspace:
- 17 npm packages. Independent versioning via git tags (using generic names as they're private)
- Recently migrated from Lerna
- Using pnpm workspaces and workspace protocol
- nx.json (fragment):
"targetDefaults": {
"nx-release-publish": {
"options": {
"packageRoot": "dist/packages/{projectName}"
}
}
},
"release": {
"projects": ["packages/*"],
"projectsRelationship": "independent",
"changelog": {
"projectChangelogs": {
"file": false,
"createRelease": {
"provider": "github-enterprise-server",
"hostname": "our.ghe.server"
}
}
},
"version": {
"preVersionCommand": "pnpm nx run-many -t experimental-build",
"generatorOptions": {
"updateDependents": "auto",
"specifierSource": "conventional-commits",
"currentVersionResolver": "git-tag",
"packageRoot": "dist/packages/{projectName}"
}
}
},
When running nx release version --dry-run --specifier patch
- Package A is versioned correctly from git tag and provided specifier
NX Running release version for project: package-a
package-a 🔍 Reading data for package "package-a" from dist/packages/package-a/package.json
package-a 📄 Resolved the current version as 3.0.1 from git tag "package-a@3.0.1".
package-a 📄 Using the provided version specifier "patch".
package-a ✍️ New version 3.0.2 written to dist/packages/package-a/package.json
- All other packages are versioned correctly as well
package.json
for Package A is updated correctly
UPDATE dist/packages/package-a/package.json [dry-run]
"name": "package-a",
- "version": "0.0.0",
+ "version": "3.0.2",
"description": "package-a",
"json-cycle": "^1.3.0",
- "package-b": "workspace:*",
- "package-c": "workspace:*",
+ "package-b": "7.0.13",
+ "package-c": "4.0.18",
"uuid": "^9.0.1"
package.json
for Package D is updated incorrectly
UPDATE dist/packages/package-d/package.json [dry-run]
"name": "package-d",
- "version": "0.0.0",
+ "version": "2.2.3",
"description": "package-d ",
"md5": "^2.2.1",
- "package-b": "workspace:*",
- "package-a": "workspace:*",
- "package-c": "workspace:*",
+ "package-b": "7.0.13",
+ "package-a": "0.0.1", 🔴 (should be 3.0.2)
+ "package-c": "4.0.18",
"uuid": "^9.0.1"
My main assumption is that package.json
of Package D is updated before Package A
, resulting in the version of Package A to be resolved to 0.0.0. There're no cycles in the graph, so I think that the execution order of versioning is wrong.
Expected Behavior
I'd expect package-a
version inside package-d
package.json file to be 3.0.2
. Either Nx should write versions first and then handle dependencies, or execute versioning in correct order aligning with the project graph
GitHub Repo
No response
Steps to Reproduce
- Initialise package-based repo with multiple npm packages
- Add pnpm workspaces
- Use workspace protocol to link dependent packages
- Run
nx release version --dry-run --specifier patch
Nx Report
NX Report complete - copy this into the issue template
Node : 18.20.4
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 9.12.0
nx (global) : 19.6.4
nx : 20.0.6
@nx/js : 20.0.6
@nx/jest : 20.0.6
@nx/eslint : 20.0.6
@nx/eslint-plugin : 20.0.6
typescript : 5.6.3
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
Failure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
This error repeats on 19.8.3 which could mean it's not related to #28380