-
Notifications
You must be signed in to change notification settings - Fork 2.7k
yarn list --depth 0
list all installed dependencies in node_modules beside in package.json
#3569
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
Comments
Thanks for your request but it is not clear what you want could you provide an example? |
I believe they are looking for behavior like $ cat package.json
{
"name": "shine",
"private": true,
"dependencies": {
"@rails/webpacker": "^3.0.1",
"bootstrap": "3"
},
"devDependencies": {
"webpack-dev-server": "^2.7.1"
}
} $ npm list --depth 0
shine@ <current working directory>
+-- @rails/[email protected]
+-- [email protected]
`-- [email protected] vs $ yarn list --depth 0 | wc -l
745 I personally find it more useful when doing |
@soobrakay What you stated is exactly what I'm looking for. The OP may have not been super clear, but I think it would be quite useful to get a full list of only the installed versions of packages explicitly listed in The default behavior right now seems cluttered and confusing. Because nested dependencies are hoisted in most scenarios, the |
Please reopen this, or provide an alternative way to list only the installed packages as @soobrakay points out. The current behavior is useless in a flattened package manager. |
any news about this? |
Oddly enough, node v8.9.3 |
Another oddity: in my repo, this:
yet |
Ok, let's reopen the issue, looks like enough people want it. |
Use the npm command for this since yarn does not currently limit the output to only installed packages (it displays all packages). The npm ls command seems to work fine even though we are trying to use yarn here to actually manage the dependencies. yarnpkg/yarn#3569
@bestander Can you maybe give some hints / pseudocode about the required modifications?
I took a look at list.js and wasn't sure where to begin. |
It all starts with the
|
With version 1.7.0 I'm able to do |
@Ploppy3 This isn't about showing global packages. It's about showing only information for the packages explicitly listed within a particular project's package.json file (rather than ALL nested dependencies as well). |
@dlong500 |
@Ploppy3 That may be true, but this issue is specifically about showing a local project's explicit dependencies. We need to make sure people don't think this issue isn't valid anymore. There is still no way to show the status of only the explicitly listed dependencies for a local project. I may try to look at it myself if I can get some free time this summer and if no one else hasn't handled it yet. |
@dlong500 Yes I understand. I don't have the knowledge to work on this, so it's cool if you want to do it. |
I've been thinking about the best way to handle the intent of this issue, and I wonder if it might not be better to create a new command called something like I cloned the repo for testing and was able to produce essentially what I'm after with a one line change to the Using the Any thoughts? |
@dlong500 The proposed |
Any ongoing work on same? |
Too bad, I only recently tried yarn in a repo and just found that I get a HUGE list instead of just the packages I actually installed (directly). There are TWO places where yarn does that, unlike npm which only shows what is actually important:
A someone who recently switched one repo to yarn to see how it works, both those behaviors are unexpected — and worse, don't make sense even on their own. Such an output might be useful if it is processed by another tool, for humans the huge list of everything hardly ever is what is useful, but only the relevant information. |
Just bit by this! I expected There should be a simple and obvious command to list top-level packages via yarn, this is a poor new user experience. |
Agreed: |
with bash and # show only requested dependencies from a shallow yarn list
yarndeps() {
# preload installed dependencies, remove first and last lines
roster="$(yarn list --depth 0 2>/dev/null | awk '{print $2}' | sed '1d;$d')"
# match each dependency (from package.json) to the preloaded list
while IFS= read -r dependency; do
echo "${roster}" | GREP_OPTIONS='' grep --color=never "^${dependency}@"
done <<< "$(jq -r '.dependencies,.devDependencies|keys[]' package.json)"
} |
Just got hit by this. It's really counterintuitive. You would naturally expect Which ever api you choose to enable it via, there definitely needs to be a command so that we can verify, 'of the packages in package.json are they all installed or are some missing'. I needed to do this as I had an error saying that some base dependency was missing. (in the end it turned out the error was also an error, but this confusing command really got in the way of things). |
Is this something that is up for grabs? |
I also need this feature: "list locked direct dependencies with their exact version", For now, I made a node script to this job: https://gist.github.com/bsdelf/d24465c089c6eaba7ddac0951ac5faf7. |
As per @dlong500's suggestion, I have managed to implement this by removing the |
This was a discussion long ago, but there is still no |
yarn list --depth 0
list all installed dependencies in node_modules beside in package.jsonI need
yarn list
able to list only installed dependencies in package.jsonnode.js version 6.10.3 macOS Sierra 10.12.5
The text was updated successfully, but these errors were encountered: