-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling .version()
in a monorepo reads version from the root package.json
#2400
Comments
In simple terms, Yargs searches up through the directories looking for the nearest Have you got a simple reproduction, or more detail about how Yargs is integrated into a package in your monorepo and how your application is being called? |
@shadowspawn This is where we are using The |
I reproduced the problem locally in your repo. (I am not sure what happens when it gets published.) The monorepo is using workspaces. When you run the install, A simple work-around might be to specify the version explicitly, like (I tried to install just yargs into the |
Yes, what you observed is totally normal. In other words, the whole point of this issue is suggesting a possible new solution to support monorepos. |
"monorepo" only implies multiple products are being maintained from a single repository, not how they are arranged and managed within the repo. But monorepo does hint at possible problems, which may differ depending on how using npm or yarn or pnpm or lerna etc. Labelled as an enhancement. |
Related, request to add nohoist for npm workspaces: npm/rfcs#287 |
Yes, many monorepo tools have this feature implemented. But |
It seems that the default behavior of
version
function (which reads the version frompackage.json
is wrong for monorepos. It reads thepackage.json
in the root of the monorepo, which is not correct.The text was updated successfully, but these errors were encountered: