-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
32 lines (27 loc) · 728 Bytes
/
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
require = require("esm")(module);
const program = require("commander");
const { version, description } = require("./package.json");
const { run: runGuides } = require("./src/guides");
const { run: runApi } = require("./src/api");
program
.version(version, "-v, --version")
.description(description)
.option("-p, --project <project>", 'Project name. Accepts "api" or "guides"');
program.on("--help", function() {
console.log(`
Examples:
$ yarn start -p api
$ yarn start -p guides
`);
});
program.parse(process.argv);
switch (program.project) {
case "guides":
runGuides();
break;
case "api":
runApi();
break;
default:
throw new Error("Invalid --project property");
}