Repository navigation
Expand file tree
/
Copy pathconfig.ts
More file actions
50 lines (48 loc) · 1.67 KB
/
Copy pathconfig.ts
File metadata and controls
50 lines (48 loc) · 1.67 KB
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
import { cli, field, object, program } from "configliere";
import z from "zod";
import denoJSON from "./deno.json" with { type: "json" };
const url = () =>
z.string().refine((str) => str.match(/^http/), {
message: `must be a hypertext (http) url`,
});
export const config = program({
name: "staticalize",
version: denoJSON.version,
config: object({
site: {
description:
"URL of the website to staticalize. E.g. http://localhost:8000",
...field(url(), cli.argument()),
},
output: {
description: "Directory to place the downloaded site",
...field(z.string(), field.default("dist")),
},
base: {
description: "Base URL of the public website. E.g. http://frontside.com",
...field(url()),
},
canonical: {
description:
"Base URL the site is published at, when that differs from where it is hosted. Only canonical urls use it. Defaults to --base.",
...field(url().optional()),
},
strict: {
description:
"Fail on the first download error instead of collecting all failures and continuing",
...field(z.boolean(), field.default(false)),
},
concurrency: {
description:
"Maximum number of concurrent downloads. Lower values avoid upstream rate limiting.",
...field(z.number(), field.default(75)),
},
retries: {
description:
"Number of times to retry a failed download before giving up. Defaults to 3, or 0 in strict mode.",
// optional rather than defaulted: the default depends on --strict, which
// a field cannot see, so `main.ts` supplies it once both are parsed
...field(z.number().optional()),
},
}),
});