-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcli.js
executable file
·63 lines (59 loc) · 1.45 KB
/
cli.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env node
import { default as yargs } from "yargs";
import { start, bundle } from "./server.js";
const parser = yargs()
.scriptName("df-plugin-dev-server")
.command(
"$0",
"Start a Dark Forest plugin development server.",
(yargs) => {
return yargs.options({
dir: {
desc: "The directory to load",
type: "string",
deprecated: "use --glob instead",
},
ext: {
desc: "Extensions to process",
type: "array",
deprecated: "use --glob instead",
},
glob: {
desc: "Glob for finding plugins",
type: "array",
default: ["(plugins|content)/**/*.(js|jsx|ts|tsx)"],
},
preact: {
desc: "Enabled custom preact support",
type: "boolean",
default: false,
},
});
},
start
)
.command(
"bundle",
"Produce bundles for Dark Forest plugins.",
(yargs) => {
return yargs.options({
glob: {
desc: "Glob for finding plugins",
type: "array",
default: ["plugins/*.(js|jsx|ts|tsx)"],
},
preact: {
desc: "Enabled custom preact support",
type: "boolean",
default: false,
},
outdir: {
desc: "The directory to output files",
type: "string",
required: true,
},
});
},
bundle
);
parser.parse(process.argv.slice(2));