Skip to content

Conversation

@Mheaus
Copy link

@Mheaus Mheaus commented Dec 29, 2025

Current Behavior

Since Nx 22, when using conventional commits with independent project relationships, commits affecting a project require the scope to match the project name to apply the full semver bump.

For example:

  • feat(my-lib): new featureminor bump for my-lib
  • feat: new featureminor bump for affected projects ✅
  • feat(random-scope): new featurepatch bump (downgraded) ❌

This behavior forces teams to use project names as scopes, which may not align with their preferred commit conventions (e.g., feature-based or functional scopes like feat(auth): ..., feat(ui): ...).

The changelog generation correctly identifies breaking changes regardless of scope matching, but the versioning logic downgrades non-matching scoped commits to patch bumps.

Expected Behavior

With the new ignoreProjectScopeForVersionBump configuration option, teams can opt-in to use commit scopes freely without being constrained to match project names.

When ignoreProjectScopeForVersionBump: true is set in the conventional commits configuration:

  • feat(random-scope): new featureminor bump ✅
  • fix(whatever): bug fixpatch bump ✅
  • feat(auth)!: breaking changemajor bump ✅

The versioning will be based solely on the commit type (feat, fix, etc.) and breaking change indicators, not on scope matching.

Configuration Example

{
  "release": {
    "version": {
      "conventionalCommits": true
    },
    "conventionalCommits": {
      "ignoreProjectScopeForVersionBump": true
    }
  }
}

Related Issue(s)

Fixes #33686

Implementation Details

  • Added ignoreProjectScopeForVersionBump boolean option to NxReleaseConventionalCommitsConfiguration
  • Modified determineSemverChange() to respect this configuration when determining version bumps
  • Added default value (false) to maintain backward compatibility
  • Added comprehensive unit tests to validate the new behavior
  • Updated type definitions and documentation

Add a new configuration option 'ignoreProjectScopeForVersionBump' to the conventional commits configuration.

When enabled, commits affecting a project will use their full semver bump (e.g., minor for feat, patch for fix)
regardless of whether the commit scope matches the project name.

By default (false), a commit like 'feat(other-lib):' affecting a project as a dependency will be downgraded
to a patch bump. When set to true, the same commit will apply its full configured semver bump.

This allows using commit scopes freely without being constrained to match project names, which is useful for:
- Teams using functional/feature-based scopes instead of project-based scopes
- Monorepos with many small projects where scope matching is impractical
- Projects that want consistent versioning based solely on commit types

No breaking change (opt-in feature, default behavior unchanged)
Set explicit default value (false) for ignoreProjectScopeForVersionBump in DEFAULT_CONVENTIONAL_COMMITS_CONFIG to maintain backward compatibility and make the default behavior clear.
@netlify
Copy link

netlify bot commented Dec 29, 2025

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit f714839

@vercel
Copy link

vercel bot commented Dec 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Dec 29, 2025 10:37am

@Mheaus Mheaus marked this pull request as ready for review December 29, 2025 10:45
@Mheaus Mheaus requested review from a team and Coly010 as code owners December 29, 2025 10:45
@Mheaus Mheaus requested a review from AgentEnder December 29, 2025 10:45
@Mheaus
Copy link
Author

Mheaus commented Dec 29, 2025

Hi @Coly010, I'm working for a company that uses this format in their commit messages: type(#123456-project): commit message

We noticed during last week that we didn't have a minor release since our last upgrade to Nx 22 and came to look into it.

I think this condition in shared.ts introduced in #32915 is the root cause for this behavior:

if (
  commit.scope === projectName ||
  commit.scope.split(',').includes(projectName) ||
  !commit.scope
) {

This is my first PR to nx so don't hesitate to tell me if I'm missing anything.
Maybe I can also update some documentation somewhere too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convential commits release version now requires specific scope

1 participant