-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
mod.ts
64 lines (58 loc) · 2.25 KB
/
mod.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
import Site from "./core/site.ts";
import url, { Options as UrlOptions } from "./plugins/url.ts";
import json, { Options as JsonOptions } from "./plugins/json.ts";
import markdown, { Options as MarkdownOptions } from "./plugins/markdown.ts";
import modules, { Options as ModulesOptions } from "./plugins/modules.ts";
import vento, { Options as VentoOptions } from "./plugins/vento.ts";
import search, { Options as SearchOptions } from "./plugins/search.ts";
import paginate, { Options as PaginateOptions } from "./plugins/paginate.ts";
import toml, { Options as TomlOptions } from "./plugins/toml.ts";
import yaml, { Options as YamlOptions } from "./plugins/yaml.ts";
import { getOptionsFromCli } from "./core/utils/cli_options.ts";
import { parseDateFromBasename } from "./core/utils/date.ts";
import type { DeepPartial } from "./core/utils/object.ts";
import type { SiteOptions } from "./core/site.ts";
export interface PluginOptions {
url?: UrlOptions;
json?: JsonOptions;
markdown?: MarkdownOptions;
modules?: ModulesOptions;
vento?: VentoOptions;
search?: SearchOptions;
paginate?: PaginateOptions;
toml?: TomlOptions;
yaml?: YamlOptions;
}
export default function lume(
options: DeepPartial<SiteOptions> = {},
pluginOptions: PluginOptions = {},
cliOptions = true,
): Site {
if (cliOptions) {
getOptionsFromCli(options);
}
const site = new Site(options as Partial<SiteOptions>);
// Ignore some files by the watcher
site.options.watcher.ignore.push("/deno.lock");
site.options.watcher.ignore.push("/node_modules/.deno");
site.options.watcher.ignore.push("/.git");
site.options.watcher.ignore.push((path) => path.endsWith("/.DS_Store"));
return site
.ignore("node_modules")
.ignore("import_map.json")
.ignore("deno.json")
.ignore("deno.jsonc")
.ignore("deno.lock")
.ignore((path) => path.endsWith(".d.ts"))
.mergeKey("tags", "stringArray")
.parseBasename(parseDateFromBasename)
.use(url(pluginOptions.url))
.use(json(pluginOptions.json))
.use(markdown(pluginOptions.markdown))
.use(modules(pluginOptions.modules))
.use(vento(pluginOptions.vento))
.use(paginate(pluginOptions.paginate))
.use(search(pluginOptions.search))
.use(toml(pluginOptions.toml))
.use(yaml(pluginOptions.yaml));
}