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.

Allow lerna publish to not update dependency package.jsons if they do not match semvers

See original GitHub issue

Expected Behavior

If I have a monorepo with package A and B, where A depends on B, I want to be able to hard code the version of B that A depends on if there is a bug in B. For example, if A’s package.json normally contains this:

B: "^4.5.6

but then B@4.5.7 contains a bug, I would like to move forward with the version of A while hard coding B to 4.5.6

B: "4.5.6"

And then I’d like B to remain at 4.5.6 until I manually add a caret back in. This way if B gets updated with a different change that does not fix the bug, I don’t accidentally pull it into A.

Current Behavior

If I hard code A to B@4.5.6, any change to B will bump A’s version.

Possible Solution

There’s an argument to be made that if the new version of B does not match A’s old semver, A’s version of B should not be bumped. But since that would be a breaking change, I think a good middle ground would be to enable this behavior only with an option to publish. Something like --respect-semvers or something.

Context

I work on a project with many teams, and we want to easily be able to move forward with development if one the libraries in our monorepo has a bug in it. We typically hard code the version of that library to the last working version if a bug is released, but this would not work if we tried to use lerna publish (because we can’t always fix the broken dependency right away).

Your Environment

Executable Version
lerna --version 2.11.0
node --version 9.11.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
evocateurcommented, Jul 4, 2018

It sounds like A and B in your example shouldn’t be living in the same monorepo. How did B’s bug not break A’s unit/integration tests?

0reactions
stale[bot]commented, Feb 25, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

lerna publish push to npm, but not updating dependencies
My Monorepo is currently managed by Lerna.js. It all works fine except for the GitHub actions workflow I use to automate the npm...
Read more >
Error Codes | Yarn - Package Manager
A list of Yarn's error codes with detailed explanations.
Read more >
Lerna NPM | npm.io
The two primary commands in Lerna are lerna bootstrap and lerna publish . ... Add lerna as a devDependency in package.json if it...
Read more >
How to Create a React Typescript Monorepo with Git ...
To manage our monorepo we are going to use two tools: Lerna: For running scripts across multiple projects and adding new dependencies. Lerna...
Read more >
JavaScript Monorepos - Scott Logic Blog
This monorepo approach is not the only one. ... Then in the server-package/package.json file I can declare the dependency on the ...
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