`nx release` not respecting `implicitDependencies` when running `updateDependents`
kumboleijo opened this issue ยท 0 comments
Current Behavior
Having an implicitDependency
set inside the project.json
file seems to be not respected when running nx release
.
Setup
nx.json
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"defaultBase": "dev",
"release": {
"releaseTagPattern": "{projectName}@{version}",
"projectsRelationship": "independent",
"versionPlans": true,
"version": {
"generatorOptions": { "preserveLocalDependencyProtocols": true }
},
"changelog": { "projectChangelogs": true },
"projects": ["packages/*", "apps/*"]
}
}
packages/lib/package.json
{
"name": "lib",
"version": "1.0.0"
}
apps/api/package.json
{
"name": "api",
"version": "1.0.0"
}
apps/api/project.json
{
"implicitDependencies": ["lib"]
}
version-plan
---
lib: minor
---
some fix
nx graph
The nx graph
shows the expected implicit dependency correctly.
nx release
Now when running nx release -d
the following output shows:
NX Running release version for project: lib
lib ๐ Reading data for package "lib" from packages/lib/package.json
lib ๐ Resolved the current version as 1.0.0 from packages/lib/package.json
lib ๐ Resolved the specifier as "minor" using version plans.
lib โ๏ธ New version 1.1.0 written to packages/lib/package.json
NX Running release version for project: api
api ๐ Reading data for package "api" from apps/api/package.json
api ๐ Resolved the current version as 1.0.0 from apps/api/package.json
api ๐ซ No changes were detected within version plans.
api ๐ซ Skipping versioning "api" as no changes were detected.
UPDATE packages/lib/package.json [dry-run]
"name": "lib",
- "version": "1.0.0"
+ "version": "1.1.0"
}
Warning
Note the api ๐ซ No changes were detected within version plans.
line.
Expected Behavior
Shouldn't the implicitDependency
also affect the output of nx release
and bump the version of the dependents?
Nx Report
NX Report complete - copy this into the issue template
Node : 20.18.1
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 9.12.3
nx : 20.2.1
@nx/js : 20.2.1
@nx/workspace : 20.2.1
@nx/devkit : 20.2.1
typescript : 5.7.2
Failure Logs
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
๐จ Side effect
When adding the lib
also as a dependency
or devDependency
to the apps/api/package.json
nx release
shows a weird behaviour:
apps/api/package.json (updated)
{
"name": "api",
"version": "1.0.0",
"dependencies": {
"lib": "workspace:*"
}
}
NX Running release version for project: lib
lib ๐ Reading data for package "lib" from packages/lib/package.json
lib ๐ Resolved the current version as 1.0.0 from packages/lib/package.json
lib ๐ Resolved the specifier as "minor" using version plans.
lib โ๏ธ New version 1.1.0 written to packages/lib/package.json
lib โ๏ธ Applying new version 1.1.0 to 3 packages which depend on lib
NX Running release version for project: api
api ๐ Reading data for package "api" from apps/api/package.json
api ๐ Resolved the current version as 1.0.0 from apps/api/package.json
api ๐ Resolved the specifier as "patch" because "release.version.generatorOptions.updateDependents" is enabled
api โ๏ธ New version 1.0.1 written to apps/api/package.json
UPDATE packages/lib/package.json [dry-run]
"name": "lib",
- "version": "1.0.0"
+ "version": "1.1.0"
}
UPDATE packages/api-client/package.json [dry-run]
"name": "api-client",
- "version": "1.7.0",
+ "version": "1.7.3",
"description": "",
UPDATE apps/api/package.json [dry-run]
"name": "api",
- "version": "1.0.0",
+ "version": "1.0.1",
"dependencies": {
NX Updating pnpm lock file
NX Staging changed files with git
NX Previewing an entry in packages/lib/CHANGELOG.md for lib@1.1.0
CREATE packages/lib/CHANGELOG.md [dry-run]
+ ## 1.1.0 (2024-12-10)
+
+ ### ๐ Features
+
+ - some fix
NX Previewing an entry in apps/api/CHANGELOG.md for api@1.0.1
CREATE apps/api/CHANGELOG.md [dry-run]
+ ## 1.0.1 (2024-12-10)
+
+ ### ๐งฑ Updated Dependencies
+
+ - Updated lib to 1.1.0
+ - Updated lib to 1.1.0
NX Staging changed files with git
NX Removing version plan files
NX Committing changes with git
NX Tagging commit with git
NX Skipped publishing packages.
Now it correctly picks up the dependency and bumps the version of api
.
Warning
But the generated changelog now contains the update information twice!
If you now remove the implicitDependency
from apps/api/project.json
this duplication is gone - so it seems like it somehow affects nx release
.