-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
cli-list-commands.ts
67 lines (62 loc) · 1.59 KB
/
cli-list-commands.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { filterOptions } from '../filter-options';
/** @ts-ignore */
const group = 'Command Options:';
/**
* @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
*/
exports.command = 'list';
exports.describe = 'List local packages';
exports.aliases = ['ls', 'la', 'll'];
exports.builder = (yargs) => {
yargs.options({
json: {
group,
describe: 'Show information as a JSON array',
type: 'boolean',
},
ndjson: {
group,
describe: 'Show information as newline-delimited JSON',
type: 'boolean',
},
a: {
group,
describe: 'Show private packages that are normally hidden',
type: 'boolean',
alias: 'all',
},
l: {
group,
describe: 'Show extended information',
type: 'boolean',
alias: 'long',
},
p: {
group,
describe: 'Show parseable output instead of columnified view',
type: 'boolean',
alias: 'parseable',
},
toposort: {
group,
describe: 'Sort packages in topological order instead of lexical by directory',
type: 'boolean',
},
graph: {
group,
describe: 'Show dependency graph as a JSON-formatted adjacency list',
type: 'boolean',
},
});
return filterOptions(yargs);
};
exports.handler = async function handler(argv) {
try {
const { ListCommand } = await import('@lerna-lite/list');
new ListCommand(argv);
} catch (e) {
console.error(
'"@lerna-lite/list" is optional and was not found. Please install it with `npm install @lerna-lite/list -D -W`'
);
}
};