question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lerna updates all packages with every publish

See original GitHub issue

Expected Behavior

Lerna should only update packages that have changed. From the README:

When you run lerna publish, if a module has been updated since the last time a release was made, it will be updated to the new version you’re releasing. This means that you only publish a new version of a package when you need to.

Current Behavior

Instead of only updating packages that have changed, lerna updates every package with every change.

Both lerna updated and lerna changed return the correct result. Changing only a single package only displays changes from that package and packages that depend on that package.

Steps to Reproduce (for bugs)

  1. Clone this repository: https://github.com/zposten/lerna-all-update
  2. On the master branch, run lerna updated or lerna changed. Notice that only two @test/checkbox and the one package that depends on checkbox are shown to be updated (this is correct behavior).
  3. Now run lerna publish, choose “patch”, and see that it lists every package in the repository as changed, when only two packages should have changed:
Changes:
 - demo: 0.0.19 => 0.0.20 (private)
 - @test/button: 0.0.19 => 0.0.20
 - @test/card: 0.0.19 => 0.0.20
 - @test/checkbox: 0.0.19 => 0.0.20
 - @test/components-web: 0.0.19 => 0.0.20
 - @test/date-picker: 0.0.19 => 0.0.20
 - @test/form-field: 0.0.19 => 0.0.20
 - @test/global: 0.0.19 => 0.0.20
lerna.json

{
  "version": "0.0.19",
  "packages": [
    "packages/*"
  ],
  "npmClient": "yarn",
  "useWorkspaces": true
}

Context

Your Environment

Executable Version
lerna --version 3.20.2
npm --version 6.4.1
yarn --version 1.17.3
node --version v10.15.3
OS Version
macOS Mojave 10.14.6

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
reveltcommented, Mar 9, 2020

Looking at your lerna.json:

{
"version": "0.0.19",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true
}

I noticed there are no ignoreChanges field. For example, myself, I use:

{
  "command": {
    "publish": {
      "conventionalCommits": true,
      "message": "[skip ci] chore: release"
    }
  },
  "ignoreChanges": [
    "**/CHANGELOG.md",
    "**/node_modules/**",
    "**/package.json",
    "**/*.md",
    "**/perf/**"
  ],
  "lifecycle": {
    "version": "npm run build && git add ."
  },
  "packages": [
    "packages/*"
  ],
  "version": "independent"
}

Please try to add copious ignoreChanges (add package.json and changelog and anything else you can imagine, anything that could theoretically mutate during publishing) and let us know how it went.

I’d rule out ignoreChanges first.

1reaction
zpostencommented, Mar 10, 2020

So are you saying that the README section I quoted above is incorrect?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Version and Publish - Lerna
Lerna can increment your package's versions as well as publish your packages to NPM, and it provides a variety of options to make...
Read more >
Lerna always lists all packages ready to publish when running ...
the step which I run lerna updated in my github actions workflow always tells/lists me all the package are available to publish which...
Read more >
How to deploy only changed packages in a Lerna Monorepo
Deploy only changed packages. The only command you need to know is “lerna run” , it simply runs an npm script in each...
Read more >
@lerna/version - npm
When run, this command does the following: Identifies packages that have been updated since the previous tagged release. Prompts for a new version....
Read more >
Salable Tech Blog 4; How to version all packages ...
Version packages synchronously in a monorepo with Lerna ... But because we're not publishing any parts of the monorepo, it's largely a void ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found