-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUILD
76 lines (67 loc) · 1.99 KB
/
BUILD
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
65
66
67
68
69
70
71
72
73
74
75
76
load("@build_bazel_rules_nodejs//:defs.bzl", "http_server", "rollup_bundle")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("//:rules/tslint.bzl", "tslint")
load("@bazel_pandoc//:pandoc.bzl", "pandoc")
exports_files(["tsconfig.json"])
buildifier(
name = "buildifier",
lint_mode = "fix",
mode = "fix",
)
buildifier(
name = "buildifier_pre_commit",
mode = "check",
)
tslint(
name = "tslint",
config = "tslint.json",
)
filegroup(
name = "pandoc_inputs",
srcs = [
# README.md must be listed first due to the way the pandoc rule is implemented. See
# https://github.com/ProdriveTechnologies/bazel-pandoc/blob/b69f8591d55f1a80bf22df0009f4f959e57511e1/pandoc.bzl#L13.
"README.md",
"//ui:template.html",
],
)
# Run pandoc on README.md, producing index.html.
pandoc(
name = "index",
src = ":pandoc_inputs",
from_format = "commonmark",
# Surround the generated HTML with content from ui/template.html.
# The filegroup is required as a hack to make ui/template.html available to the action.
options = [
"--standalone",
"--template=ui/template.html",
],
to_format = "html",
)
# TODO: this makes local development slow. Every time a source file changes, the whole bundle has to
# be rebuilt. Ideally, we could serve the sources unbundled, so that each source file change
# would only require recompiling its ts_library and any downstream deps. The rules_typescript
# ts_devserver rule does something like this. However, as of 2019, bundling is still the way to go
# in production. There is value in having our devserver be very similar to the production setup,
# even if it is a bit slow.
rollup_bundle(
name = "rollup",
entry_point = "ui/main",
deps = [
"//ui",
],
)
filegroup(
name = "website",
srcs = [
":index",
":rollup",
"//ui:r5rs.css",
],
)
http_server(
name = "devserver",
data = [
":website",
],
)