-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add name
lookups to yarn ls
#1599
Comments
Created #1643 to fix this, pending approval. |
I just tested this new commit, and it does not appear to be working correctly. Before, the fix, if I tried
|
* master: (66 commits) Add --no-bin-links flag - fixes yarnpkg#929 (yarnpkg#1651) Add option to change the prefix of the global bin folder - fixes yarnpkg#630 (yarnpkg#1654) patterns -> filteredPatterns Add helpful nudge to yarnpkg/rfcs on issue template (yarnpkg#1650) Change reporter.log to console.log in generate-lock-entry command - fixes yarnpkg#644 (yarnpkg#1652) Fixed add command flag (yarnpkg#1653) Nested executables fix (yarnpkg#1210) Added short-flags for yarn add (yarnpkg#1618) Add name lookups to ls command - fixes yarnpkg#1599 (yarnpkg#1643) Disable flaky secureUrl test (yarnpkg#1644) Add unit tests for `yarn why`. (yarnpkg#1544) Refine flow type for config.generateHardModulePath (yarnpkg#1642) Use ~/Library/Caches as default cache location on OSX - fixes yarnpkg#1637 (yarnpkg#1638) Update aliases.js (yarnpkg#1635) Update aliases.js (yarnpkg#1634) Add webhook to archive AppVeyor build artifacts (yarnpkg#1631) Attempt to fix failing Circle CI builds (yarnpkg#1629) Adding 'yarn global upgrade'(Issue yarnpkg#776) (yarnpkg#1616) Show error message in stdout. (yarnpkg#1502) Nicer permission errors when trying to write global binaries - fixes yarnpkg#1578 (yarnpkg#1592) ...
I'm not seeing this issue as being fixed with the latest code-- this issue should be re-opened. The behavior I see is that
@lukeed Can you test the latest code and see if it works for you? |
Going to reopen this as it is not implemented fully. I messed with it a bit and was able to get it to work and produce an output like the following: $ yarn ls chalk
yarn ls v0.17.0-0
├─ babel-code-frame@6.16.0
│ └─ chalk@^1.1.0
├─ chalk@1.1.3
├─ eslint-config-kittens@2.0.1
│ └─ babel-core@5.8.38
│ │ └─ chalk@^1.0.0
├─ eslint@3.7.1
│ └─ chalk@^1.1.3
├─ fancy-log@1.2.0
│ └─ chalk@^1.1.1
├─ gulp-util@3.0.7
│ └─ chalk@^1.0.0
├─ gulp@3.9.1
│ └─ chalk@^1.0.0
├─ har-validator@2.0.6
│ └─ chalk@^1.1.1
├─ inquirer@0.12.0
│ └─ chalk@^1.0.0
├─ jest-cli@16.0.1
│ └─ chalk@^1.1.1
├─ jest-config@16.0.0
│ └─ chalk@^1.1.1
├─ jest-diff@16.0.0
│ └─ chalk@^1.1.3
├─ jest-matcher-utils@16.0.0
│ └─ chalk@^1.1.3
├─ jest-runtime@16.0.0
│ └─ chalk@^1.1.3
├─ jest-util@16.0.0
│ └─ chalk@^1.1.1
├─ marked-terminal@1.6.2
│ └─ chalk@^1.0.0
└─ table@3.8.0
│ └─ chalk@^1.1.1
✨ Done in 0.46s. |
👍 Closer. Looks like you just need to flatten all deps first, then filter for uniqueness. |
@lukeed Given the above output, what would you expect it to look like instead with the flattening? |
Unfortunately I can't dig thru & play with Yarn source right now, but I'm a fan of all = all.filter((v, i, a) => a.indexOf(v) === i) |
@wyze The last bit of my opening statement makes the most sense to me as it's also the most concise. If you want to see why a dep is there // what's including it, you'd use |
I guess I am not following, all the packages listed are unique. If you could just use my sample output and modify it to what you would expect to see, that would be helpful. |
@wyze Sure. Chalk may not be the best example, but if I want to see a list of all (resolved) versions of Chalk that were installed & nothing about which deps required them.
Everything else in your example ( It's useful because if I see this:
Then it's instantaneously obvious that I have duplicate/old dependencies installed! If, then, I need to find out what's requiring
|
@wyze Back to original example, if I were to run
Your current output would give something like:
Which is a lot of repetition, when all that's useful to me is:
|
Given previous output with $ yarn ls once
yarn ls v0.17.0-0
├─ commoner@0.10.4
│ └─ glob@5.0.15
│ │ └─ once@^1.3.0
├─ end-of-stream@1.1.0
│ ├─ once@~1.3.0
│ └─ once@1.3.3
├─ fileset@0.2.1
│ └─ glob@5.0.15
│ │ └─ once@^1.3.0
├─ glob-stream@3.1.18
│ └─ glob@4.5.3
│ │ └─ once@^1.3.0
├─ glob@7.1.1
│ └─ once@^1.3.0
├─ inflight@1.0.5
│ └─ once@^1.3.0
├─ istanbul-api@1.0.0-aplha.10
│ └─ once@1.x
├─ istanbul@0.4.5
│ ├─ glob@5.0.15
│ │ └─ once@^1.3.0
│ └─ once@1.x
├─ once@1.4.0
├─ orchestrator@0.3.7
│ ├─ end-of-stream@0.1.5
│ │ └─ once@~1.3.0
│ └─ once@1.3.3
├─ run-async@0.1.0
│ └─ once@^1.3.0
└─ tar-pack@3.1.4
│ ├─ once@~1.3.3
│ └─ once@1.3.3
✨ Done in 0.46s. In the terminal it seems to have logic to dim (src/cli/commands/ls.js#L88) some dependencies. Well with a filter applied, it is going to just hide those. Output above becomes: $ yarn ls once
yarn ls v0.17.0-0
├─ end-of-stream@1.1.0
│ └─ once@1.3.3
├─ once@1.4.0
├─ orchestrator@0.3.7
│ └─ once@1.3.3
└─ tar-pack@3.1.4
│ └─ once@1.3.3
✨ Done in 0.45s. Compared to npm: ❯ npm ls once
yarn@0.17.0-0
├─┬ eslint@3.8.1
│ └─┬ glob@7.1.1
│ └── once@1.4.0
├─┬ gulp@3.9.1
│ └─┬ orchestrator@0.3.7
│ └─┬ end-of-stream@0.1.5
│ └── once@1.3.3
├─┬ gulp-watch@4.3.10
│ └─┬ chokidar@1.6.1
│ └─┬ fsevents@1.0.14
│ └─┬ node-pre-gyp@0.6.29
│ └─┬ tar-pack@3.1.4
│ └── once@1.3.3
└─┬ tar-stream@1.5.2
└─┬ end-of-stream@1.1.0
└── once@1.3.3 Also, not sure anyone would do this as it is confusing, but it does support multiple arguments: $ yarn ls vinyl once
yarn ls v0.17.0-0
├─ end-of-stream@1.1.0
│ └─ once@1.3.3
├─ gulp-watch@4.3.10
│ └─ vinyl@1.2.0
├─ once@1.4.0
├─ orchestrator@0.3.7
│ └─ once@1.3.3
├─ tar-pack@3.1.4
│ └─ once@1.3.3
├─ vinyl-file@2.0.0
│ └─ vinyl@1.2.0
├─ vinyl-fs@0.3.14
│ └─ vinyl@0.4.6
└─ vinyl@0.5.3
✨ Done in 0.46s. I'll look into |
@wyze Yup. I do prefer your shortened output more than the first. Yet, maybe I'm alone on this, but I still only care about:
IMO, it is |
I mean, I can get exactly what I want right now if/when I pipe
It just seems unintuitive to me that |
This is now available on master and will be in the next release. @lukeed If you want the glob pattern matching functionality, please open a separate issue describing it, thanks! |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
yarn ls
takes no options or arguments.What is the expected behavior?
NPM lets you list packages by name. Yarn can/should include this, but improve it 1 step further by matching name patterns (a la
minimatch
?).The text was updated successfully, but these errors were encountered: