Open billba opened 4 years ago
It would be great to see this - after seeing lerna mentioned in the README, it was a bit of a gotcha for it to not just work out of the box.
I'd recommend that support is kept for non-lerna Yarn workspaces, too. Perhaps the order of precedence should be:
"workspaces"
from package.json (first since lerna and yarn can coexist)"packages"
from lerna.json"packages"
With the existing command line option as an override?
Sounds good. I'd be happy to accept a PR for this.
I personally use packages/*
always for my projects, which is why I didn't see this as a problem.
Let's use the fallback mechanism @macksal mentioned. Resources:
Our project uses Lerna in what appears to be a nonstandard but accepted way. Instead of putting all the child packages under a
root/packages
folder, they are all directly underroot
, e.g.root/client
,root/server
. Lerna handles this by listing them inlerna.json
in apackages
array, e.g.:It appears that, in a more traditional Lerna setup, the child packages are listed there as follows:
I propose that, instead of reading the command-line option
--child-directory-root
(with defaultpackages
), the list of packages instead be read from thelerna.json
.For backwards compatibility you could still allow the option as an override, however I would recommend instead bumping up the major version number to keep the code simple, since this approach seems to be more in line with how Lerna is intended to be used, and therefore should obviate the need for anyone to use
--child-directory-root
.If you approve I'd be happy to submit a PR.