-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·42 lines (35 loc) · 2.08 KB
/
index.js
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
#!/usr/bin/env node
import { program } from 'commander';
import repl from './commands/repl.js';
import dl from './commands/dl.js';
import exec from './commands/exec.js'
import cl from './commands/cl.js'
program.description("Inspecting npm packages made easy")
.name("package-inspector")
.usage("<command>")
.addHelpCommand(false);
// TODO: better help desc.
program.command("repl")
.argument("<package>", "name of the package you want to start a REPL for.")
.argument("[version]", "version of the package") // if no version parsed, just use the newest version of the package.
.description("Start a REPL with a specific package and version (e.g., package-inspector repl lodash 4).")
.action(repl);
program.command("dl")
.argument("<package>", "name of the package you want to create folders for.")
.argument("<versions...>", "Versions of the packages.")
.option("-c, --class", "Write all the package class interfaces to a seperate file")
.description("Create folders for packages (e.g., package-inspector dl lodash 3 4).")
.action(dl);
program.command("exec")
.argument("<exp>", "expression/file.")
.argument("<package>", "name of the package you want to use.")
.argument("<versions...>", "Versions of the packages.")
.option("-f, --file", "Execute a file containing multiple expressions (e.g., package-inspector exec exps.txt -f lodash 3 4).")
.option("-ap, --additionalPackages <additionalPackages...>", "Include these additional packages in the project where you execute the expression(s).")
.description("Run either a single expression or a file with expressions on each versions of the package (e.g., package-inspector exec exps.txt -f lodash 3 4).")
.action(exec);
program.command("cl")
.argument("<package>", "name of the package you want the changelogs for.")
.description("Get changelog urls for the major versions of a package (e.g., package-inspector cl lodash).")
.action(cl);
program.parse(process.argv);