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
yarn ignores existing project package.json #2709
Comments
Hey @eurochriskelly, sorry we missed this earlier. This is certainly a very important thing and we'll now prioritize it accordingly. |
We may be able to use this code piece with minor changes: https://github.com/yarnpkg/yarn/blob/master/src/config.js#L573 |
@torifat - Still working on this? |
@BYK I spent some time working on this but couldn't finish it 😞. I have a few questions regarding how it should inside a workspace. I will try to discuss those in Discord. |
I've been using yarn happily for a while. For most things, it's pretty much a drop-in replacement for npm. However, it behaves very differently if you are working in folders other than the project root. This is unintuitive, unlike npm in a bad way, and results in multiple package.json files peppered throughout the source, all needing to be maintained separately.
For example, let's say my package.json contains a "build" script. From a terminal, I run
yarn run build
ornpm run build
and both work as expected. Let's say I cd into directory"test/".npm run build
still works butyarn run build
complains that there is no package.json.I would expect that running
yarn run build
would descend the tree until it finds a package.json file and then build the project as though in that directory (just like npm, gulp, and everything else). I suspect the cause is related to the fact thatyarn add
"conveniently" creates a package.json file for you if there is no package.json in the current directory, saving you the npm init step. Again, I think yarn add should only do this if it does not find a package.json when descending the tree.This seems like an unintentional bug to me.
Using yarn version 0.20.1 and Windows 10.
The text was updated successfully, but these errors were encountered: