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

.nxignore not used in releaseVersion conventionalcommits version calculation #26812

Open
1 of 4 tasks
Zordrak opened this issue Jul 3, 2024 · 0 comments
Open
1 of 4 tasks

Comments

@Zordrak
Copy link

Zordrak commented Jul 3, 2024

Current Behavior

If you:

  • have .github in .nxignore
  • use conventionalcommits automatic versioning
  • version packages independently
  • make a change to a file in .github/
  • commit with a version-affecting commit message, e.g. fix: foo

Then:

  • pnpm nx affected -t build (or test) will believe that no packages are affected, and no packages will be built (or tested)
  • pnpm nx release or const { releaseVersion } = require('nx/release'); await releaseVersion({ verbose: true }); will believe all packages are affected and attempt to publish a new version of all of them, despite there being no locally built artifacts to publish

Expected Behavior

.nxignore is respected by releaseVersion, and changes to ignored files/paths will not cause a version increment for all workspace packages.

GitHub Repo

No response

Steps to Reproduce

Have a monorepo with multiple packages under packages/*

relevant parts of nx.json

{
  "defaultBase": "master",
  "release": {
    "changelog": {
      "automaticFromRef": true,
      "projectChangelogs": {
        "createRelease": "github"
      }
    },
    "projects": [
      ".",
      "packages/*"
    ],
    "projectsRelationship": "independent",
    "version": {
      "conventionalCommits": true,
      "generatorOptions": {
        "fallbackCurrentVersionResolver": "disk"
      }
    }
  }
}

.nxignore

nx.json
.nxignore
pnpm-lock.yaml
tsconfig.json
.github
  • Have at least one existing release -- because releaseVersion ignores NX_HEAD/NX_BASE and will go back to the start of your repository for relevant changes even if you want to only consider the specified HEAD and BASE
  • Make a change to a file in .github/, e.g. .github/dependabot.yml
  • Commit change with commit message fix: foo
  • pnpm nx affected -t build
    • Note that no packages are built as none have changed and .github is ignored
  • pnpm nx release or const { releaseVersion } = require('nx/release'); await releaseVersion({ verbose: true }); with or without dry-run flags
    • Note that attempt is made to release and publish a patch-incremented version of every package, which may or may not fail (depending on your packages) due to the lack of built artifacts (dist/).

Nx Report

Node   : 20.5.1
OS     : linux-x64
pnpm   : 9.2.0

nx             : 18.3.5
@nx/js         : 18.3.5
@nx/jest       : 18.3.5
@nx/linter     : 18.3.5
@nx/eslint     : 18.3.5
@nx/workspace  : 18.3.5
@nx/devkit     : 18.3.5
@nrwl/tao      : 18.3.5
typescript     : 5.5.2
---------------------------------------
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

It's also generally unclear as to exactly how the releaseVersion process determines the changed fileset, as it seems to use independent logic from affected and therefore this may not be the only gap between the expectations of them both working identically.

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

No branches or pull requests

1 participant