`--include-dependencies` misses transitive deps that come from external packages
See original GitHub issueI have a situation where there are three packages that depend on one another like so:
- pkg-c depends on pkg-b
- pkg-b depends on pkg-a
pkg-c and pkg-a both live together in a Lerna repo, but pkg-b lives elsewhere (e.g. pulled in from NPM).
When I make a change to pkg-c, I’d like to be able to build it and it’s local dependencies, but Lerna doesn’t seem to realize that this should include pkg-a.
Expected Behavior
When I make a change to pkg-c and run lerna exec --include-dependencies --since -- 'echo $PWD'
, I see:
/path/to/monorepo/packages/pkg-a
/path/to/monorepo/packages/pkg-c
Current Behavior
When I make a change to pkg-c and run lerna exec --include-dependencies --since -- 'echo $PWD'
, I see:
/path/to/monorepo/packages/pkg-c
Possible Solution
When using Yarn workspaces, you could detect this dependency with yarn why pkg-a
.
Steps to Reproduce (for bugs)
- git clone https://github.com/mxmul/lerna-transitive-example
$ make repro
lerna.json
{
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.0.0"
}
Context
I’m migrating a set of related packages into a Lerna repo, and would like (for some amount of time) to have some of the packages in the monorepo and some outside. I would expect lerna exec --include-dependencies --since
to be agnostic to the fact that some intermediate deps are not in the monorepo, and to be able to exec commands for all of the dependencies (or dependents) of a package that are local to the monorepo.
Your Environment
Executable | Version |
---|---|
lerna --version |
3.18.3 |
yarn --version |
1.17.3 |
node --version |
v12.9.1 |
OS | Version |
---|---|
macOS Sierra | 10.14.6 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
FWIW we worked around this by walking the dependency tree in our
yarn.lock
to detect any dependency chains that flowed through an NPM dependency, and using that to augment the dependencies found by Lerna.Regarding making everything monorepo-local, my team and I are trying! 😂
Our situation is that we’re moving separate packages into a monorepo one-by-one. We we’re trying to prioritize based off of difficulty and how often a package is changed (we want to import rapidly changing packages sooner, for example).
Any idea on if this would ever be entertained? Even if it’s something explicit like listing the name of the package in
lerna.json
via some property.