website
website copied to clipboard
Clarify what' yarn ls' is showing
Reposting from yarnkpkg/yarn
yarn ls has no clear documentation. I would like to add some but it I want to be clear what is going on.
From the screenshot, it looks like zip-stream requires a versioning of lodash@~3.2.0 in grey, while the bolded [email protected] is the actual version of lodash that was installed.
But.. looking into the code, the grey/"dim" npm modules that don't have a bold equivalent (ex: compress-commons) means that they have been hoisted up to the main node_modules/ folder. So anything that is bolded, is actually dependencies that yarn decided it couldn't hoist out to the main folder. Is this mostly correct? Is there something else that should be known in the documentation?
It's also not clear what yarn ls --depth 0 is showing. I would expect it to list the same dependencies seen in package.json, but it lists many more. I suspect it's listing nested dependencies which got flattened to the top level, even though they are not top-level dependencies. This behavior should be documented.
This should be re-opened, it's still not clear what yarn list --depth 0 is showing. See: https://github.com/yarnpkg/website/pull/251#pullrequestreview-75150705
@markstos I'll provide a detail explanation of what is being displayed here later today.
I suspect it's listing nested dependencies which got flattened to the top level, even though they are not top-level dependencies.
@markstos At a glance from the work a year ago, this seems to be correct. I implemented the depth relative to the existing tree output that @kittens had put together, and not something that mirrors npm.
If there's a desire to mirror npm, perhaps, that conversation is better moved to an RFC.
cc: @BYK @bestander
@olingern It does seem like yarn list --depth 0 is showing flattened dependencies. I guess if you want the un-flattened dependencies, you can just open up package.json. If the current behavior is considered desired, then appropriate mentions of flattening should be added to the yarn list docs.
@markstos package.json doesn't actually show you what's installed, though.
What does bold mean in the yarn ls output?