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 version gets confused by non-lerna tags

See original GitHub issue

Expected Behavior

  • Given a repo that contains both lerna packages, and a non-lerna package with its own top-level subfolder and package.js
  • The non-lerna package also creates git tags on new releases (the lerna package tags are prefixed with @my-group/ while the non-lerna tags are prefixed with legacy/)
  • lerna version should ignore git tags of the non-lerna package and being able to find and tag changed packages independently of git tags of the non-lerna package

Current Behavior

When the latest tag on the master branch is from the non-lerna package, and after that no changes have been made to the lerna packages, lerna will output that there are no changes:

lerna info Looking for changed packages since legacy/0.35.3
lerna info No changed packages found

Possible Solution

Ignore tags that have a non-matching name.

Steps to Reproduce (for bugs)

  1. Create a lerna repo with some packages and make a release
  2. Make changes to the lerna packages and commit
  3. Create a manual tag for the latest commit
  4. Try to run lerna version and observe that it does not recognize the changes from 2.
lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "independent"
}

Note that the non-lerna package is NOT contained in the packages/ folder.

Context

We introduced lerna later in our repository and created new separate published packages for the lerna packages, and use a starvation strategy for the old legacy package.

Your Environment

Executable Version
lerna --version 3.19.0
npm --version 6.12.0
node --version v12.13.0
OS Version
macOS Catalina 10.15.1 (19B88)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
evocateurcommented, Mar 7, 2020

I still feel that the WIP branch provides important functionality, but I can’t give any timeline on completion. Using lightweight tags for the “external” tags (instead of annotated tags) is the best workaround I can think of, right now.

1reaction
evocateurcommented, Dec 17, 2019

So I fixed the bad tests inmaster, but wasn’t able to get to a complete solution on the tag filtering. I agree that it’s valuable to have, but as I indicated in the commit that references this issue, I still haven’t addressed the collectUpdates() usage here: https://github.com/lerna/lerna/blob/167d6e3abd81af1f8bed587f649b93016c76dc20/core/filter-options/lib/get-filtered-packages.js#L60

Without filtering that execution, almost any command outside of lerna publish/lerna version in a repo where external annotated git tags exist would likely be incorrect. Additional tests are needed to guard against regression, too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@lerna/publish - npm
Publish packages in the latest commit where the version is not present in ... This will identify packages tagged by lerna version and...
Read more >
@lerna/npm-dist-tag | Yarn - Package Manager
The previous behavior was too overzealous, and the new option operates exactly like the corresponding npm version option of the same name. As...
Read more >
Git Error While Publishing Lerna Monorepo to NPM via GitHub ...
In this case, it's possible that you have either a branch and tag both named master or you have a refs/heads/master (the master...
Read more >
Lerna You a Monorepo: The Nuts and Bolts of Building a CI ...
It's common for the main source code of a non-monorepo repository to live in a src/ directory. Instead, Lerna encourages you to use...
Read more >
Discontinuous Semver: Versioning in the Land of Monolithics
Discontinuous, in that not every package has a unique version at every numerical ... npx lerna version patch --yes --no-git-tag-version
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