yarn
yarn copied to clipboard
exact match for yarn list --pattern
Do you want to request a feature or report a bug? feature
What is the current behavior?
listing packages with exact matches is possible via yarn list $args but deprecated
What is the expected behavior?
yarn list has the capability to filter dependencies with an exact match
Please mention your node.js, yarn and operating system version.
$ yarn -v
1.13.0
$ node -v
v10.15.0
$lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
Context
Feature was deprecated in #4609.
Use case:
yarn list @types/react (or similar yarn list react) is useful when debugging typescript issues. However this matches any types package if used with the recommend --pattern flag for react dependencies since it's common to prefix them with react e.g. react-redux, react-router etc. This can add quite some noise.
I haven't really seen anybody say this yet, but it would be nice if the "filtering by arguments" feature simply wasn't deprecated. One nice thing about yarn is it's "kind-of" parity with common npm commands, even those which are renamed (eg. install -> add). It would be nice if the semantics and usage of "list" didn't change much between yarn and npm. npm list [package] is super useful and commonly used, but doesn't work with workspaces, so it'd be nice if yarn list [package] afforded the same conveniences as npm list... especially the number of keystrokes.
I wonder if there are any plans of implementing this feature before removing $args, or even when you are planning to remove that feature.
An alternative could be to accept regexes like yarn list "/@types\/react$/" and that would help achieve exact matches.