|
4 | 4 |
|
5 | 5 | ## Usage |
6 | 6 |
|
| 7 | +The `list` subcommand is aliased to several convenient shorthands (similar to [`npm ls`](https://docs.npmjs.com/cli/ls)): |
| 8 | + |
| 9 | + * `lerna ls`: Identical to `lerna list`, which is itself analogous to the `ls` command |
| 10 | + * `lerna ll`: Equivalent to `lerna ls -l`, showing [long](#--long) output |
| 11 | + * `lerna la`: Equivalent to `lerna ls -la`, showing [all](#--all) packages (including private ones) |
| 12 | + |
7 | 13 | ```sh |
8 | | -# The following commands are identical: |
9 | | -$ lerna list |
10 | 14 | $ lerna ls |
| 15 | +package-1 |
| 16 | +package-2 |
11 | 17 | ``` |
12 | 18 |
|
13 | | -List all of the public packages in the current Lerna repo. |
| 19 | +You might notice extra logging from `lerna` when running these commands in your shell. |
| 20 | +Rest assured they will not infect your piped incantations, |
| 21 | +as all logs are emitted to `stderr`, not `stdout`. |
| 22 | + |
| 23 | +In any case, you can always pass `--loglevel silent` to create pristine chains of magical shell wizardry. |
14 | 24 |
|
15 | 25 | ## Options |
16 | 26 |
|
17 | 27 | `lerna ls` respects the `--ignore` and `--scope` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). |
18 | 28 |
|
19 | 29 | ### --json |
20 | 30 |
|
| 31 | +Show information as a JSON array. |
| 32 | + |
21 | 33 | ```sh |
22 | 34 | $ lerna ls --json |
23 | | -``` |
24 | | - |
25 | | -When run with this flag, `ls` will return an array of objects in the following format: |
26 | | - |
27 | | -```json |
28 | 35 | [ |
29 | 36 | { |
30 | | - "name": "package", |
| 37 | + "name": "package-1", |
| 38 | + "version": "1.0.0", |
| 39 | + "private": false, |
| 40 | + "location": "/path/to/packages/pkg-1/" |
| 41 | + }, |
| 42 | + { |
| 43 | + "name": "package-2", |
31 | 44 | "version": "1.0.0", |
32 | | - "private": false |
| 45 | + "private": false, |
| 46 | + "location": "/path/to/packages/pkg-2/" |
33 | 47 | } |
34 | 48 | ] |
35 | 49 | ``` |
| 50 | + |
| 51 | +**Tip:** Pipe to the [`json`](http://trentm.com/json/) utility to pick out individual properties: |
| 52 | + |
| 53 | +```sh |
| 54 | +$ lerna ls --json --all | json -a -c 'this.private === true' name |
| 55 | +package-3 |
| 56 | +``` |
| 57 | + |
| 58 | +### --all |
| 59 | + |
| 60 | +Alias: `-a` |
| 61 | + |
| 62 | +Show private packages that are hidden by default. |
| 63 | + |
| 64 | +```sh |
| 65 | +$ lerna ls --all |
| 66 | +package-1 |
| 67 | +package-2 |
| 68 | +package-3 (private) |
| 69 | +``` |
| 70 | + |
| 71 | +### --long |
| 72 | + |
| 73 | +Alias: `-l` |
| 74 | + |
| 75 | +Show extended information. |
| 76 | + |
| 77 | +```sh |
| 78 | +$ lerna ls --long |
| 79 | +package-1 v1.0.1 packages/pkg-1 |
| 80 | +package-2 v1.0.2 packages/pkg-2 |
| 81 | + |
| 82 | +$ lerna ls -la |
| 83 | +package-1 v1.0.1 packages/pkg-1 |
| 84 | +package-2 v1.0.2 packages/pkg-2 |
| 85 | +package-3 v1.0.3 packages/pkg-3 (private) |
| 86 | +``` |
| 87 | + |
| 88 | +### --parseable |
| 89 | + |
| 90 | +Alias: `-p` |
| 91 | + |
| 92 | +Show parseable output instead of columnified view. |
| 93 | + |
| 94 | +By default, each line of the output is an absolute path to a package. |
| 95 | + |
| 96 | +In `--long` output, each line is a `:`-separated list: `<fullpath>:<name>:<version>[:flags..]` |
| 97 | + |
| 98 | +```sh |
| 99 | +$ lerna ls --parseable |
| 100 | +/path/to/packages/pkg-1 |
| 101 | +/path/to/packages/pkg-2 |
| 102 | + |
| 103 | +$ lerna ls -pl |
| 104 | +/path/to/packages/pkg-1:package-1:1.0.1 |
| 105 | +/path/to/packages/pkg-2:package-2:1.0.2 |
| 106 | + |
| 107 | +$ lerna ls -pla |
| 108 | +/path/to/packages/pkg-1:package-1:1.0.1 |
| 109 | +/path/to/packages/pkg-2:package-2:1.0.2 |
| 110 | +/path/to/packages/pkg-3:package-3:1.0.3:PRIVATE |
| 111 | +``` |
0 commit comments