lerna icon indicating copy to clipboard operation
lerna copied to clipboard

--ignoreChanges is not respected.

Open danceroutine opened this issue 11 months ago • 2 comments

Lerna Version: 8.1.9

Current Behavior

Hi all,

I'm running into an issue where in my CICD pipeline, I do a hotswap of .npmrc for an alternative cicd.npmrc with a mv cicd.npmrc .npmrc command prior to running lerna version/lerna publish

I've tried configuring Lerna according to the documentation and various issues I've seen around this, with my lerna.json configured as so:

{
  "$schema": "node_modules/lerna/schemas/lerna-schema.json",
  "version": "independent",
  "command": {
    "publish": {
      "ignoreChanges": [
        ".npmrc",
        "cicd.npmrc"
      ]
    }
  },
  "packages": [
    "packages/*"
  ]
}

I've also tried configuring my lerna CLI as such

npx lerna publish --ignore-changes 'cicd.npmrc' '.npmrc' --canary --exact --dist-tag ${CI_COMMIT_REF_SLUG} --preid "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" --yes ${FORCED_PKGLIST} --concurrency 1

However end result is I get this output

Image

Expected Behavior

As far as I can tell, the issue is that the code for checking the working directory here

https://github.com/lerna/lerna/blob/c3e601bee1bd6416e8b067ec8121abd996163d86/libs/core/src/lib/collect-uncommitted.ts#L32

completely ignores the configuration that's passed in. I would expect the ignoreChanges configuration to work as expected.

Related Issues

It seems like this may be related to this issue https://github.com/lerna/lerna/issues/2522 which was never resolved.

danceroutine avatar Jan 31 '25 17:01 danceroutine

I can approve this bug, it's not working for me too. My package keeps creating a new version, even only the package.json and changelog have been changed. I tried to fix that by adding them to the ignoreChanges

mm-georges avatar Apr 10 '25 06:04 mm-georges

Running into the same issue. It doesn't seem like ignoreChanges is being respected even though it mentioned it earlier, if you have it set.

lerna notice cli v8.2.2
lerna info versioning independent
lerna info ci enabled
lerna info Looking for changed packages since @scope/[email protected]
lerna info ignoring diff in paths matching [ '.yarnrc.yml' ]
lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove the following changes before continuing:
lerna ERR! EUNCOMMIT  M .yarnrc.yml
Error: Process completed with exit code 1.

Would love a resolution to this.

rr-jimmy-multani avatar Jul 17 '25 20:07 rr-jimmy-multani