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 run does not respect the topology

See original GitHub issue

lerna run does not respect libs the topology Workspace created using Angular cli (angular version 8.2.3)

Expected Behavior

should respect topology according to devDependencies in package.json

Current Behavior

building in some random order

Possible Solution

Steps to Reproduce (for bugs)

create a workspace using Angular cli (8.2.3) in the following toplogy:

libs–> business –> lib a –>lib b (depend on a,c,d) –> services –>lib c (depend on e) –>lib d –>shared –> **lib e ** –>ui –>lib f –>lib g (depend on f)

define the libs dependencies and “build” script in pacage.json file run lerna build

lerna.json

{
 "packages":
  [
   "./libs/**/*"
  ],
"version" : "independent"

}

Context

cant create CI CD to my Project using lerna

Your Environment

| lerna --version | 3.18.3| | npm --version | 6.4.1 | | node --version | 10.14.1 |

| Windows 10 |

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:11

github_iconTop GitHub Comments

1reaction
biro456commented, Feb 5, 2021

I was setting up a TypeScript monorepo today and noticed this as well.

It only seems to happen when I use the parallel option. When using concurrency without parallel it works as expected.

Looking at the source code this is the actual behaviour: https://github.com/lerna/lerna/blob/72414ec1c679cf8a7ae4bfcefce52d50a6120a70/commands/run/index.js#L76-L82

1reaction
goofrnzikcommented, Jul 12, 2020

In my case I can see that the problem is different:

It do trying to work in the right order but it running parallel

Workaround:

lerna run build --concurrency 1

This flag forcing lerna to run each script and wait for it to return. The default is to run parallel.

More to that i can see that your are using yarn workspace and i am not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Things I wish I had known when I started JavaScript monorepo ...
These scripts should use lerna run <script> command which respects the packages topology and runs the script in every monorepo package that ...
Read more >
@lerna-lite/run - npm
Similar to --stream , but completely disregards concurrency and topological sorting, running a given command or script immediately in all ...
Read more >
@lerna/clean | Yarn - Package Manager
A package is considered "updated" using the same rules as lerna updated . ... With this flag, lerna exec will run the command...
Read more >
Lerna NPM | npm.io
Add lerna as a devDependency in package.json if it doesn't already exist. ... lerna run respects the --concurrency , --scope , --ignore ,...
Read more >
How to run lerna sequentially? - Stack Overflow
So, that still doesn't guarantee sequential execution since multiple packages may have the same priority in the topological order and hence, may ...
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