How does Lerna detect packages? #3685
-
Hi, I'm using Lerna for the first time because it's used by some example packages. The folder hierarchy looks like the following:
I'm also needing a server for foo and wanted to just include another Lerna repository into the foo project like this:
If I now start a console and my working directory is But if I change to If I instead move the My question is: Doesn't Lerna consider the working directory I'm in as the root-directory and tries to find a "parent" package? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For new projects, Lerna uses the workspaces property in the package.json in the root directory (the one with lerna.json in it) to search for packages. For details on this property, see the npm documentation or the Yarn documentation. You can tell if Lerna is configured to use this by looking for If you are using pnpm, you might have set npmClient to pnpm in lerna.json. In this case, Lerna will use the packages property in pnpm-workspace.yaml to search for packages. For details on this property, see the pnpm documentation. If you are using an older version of Lerna or have explicitly opted out of using workspaces ("useWorkspaces" is missing or set to false in |
Beta Was this translation helpful? Give feedback.
-
You can definitely add server projects to the same lerna repo as your client ones. One example structure would be like this:
Your package.json's workspaces property would be set to |
Beta Was this translation helpful? Give feedback.
You can definitely add server projects to the same lerna repo as your client ones. One example structure would be like this:
Your package.json's workspaces property would be set to
["client/*", "server/*"]
and the "useWorkspaces" property in lerna.json would be set to true.