blob: efa1f62856ee6928350f517d581cea191e060479 [file] [log] [blame]
Greg Magolana8f559a2019-02-01 16:10:36 -08001load("//:defs.bzl", "ts_devserver")
2load("//internal:defaults.bzl", "ts_library")
Paul Gschwendtner4a5ce0d2019-01-17 19:49:54 -08003
4ts_library(
5 name = "app",
6 srcs = ["app.ts"],
7 tsconfig = "//examples:tsconfig.json",
8 deps = [
9 "@npm//@types/node",
10 ],
11)
12
13ts_devserver(
14 name = "devserver",
15 additional_root_paths = [
16 "npm/node_modules/tslib",
17 "build_bazel_rules_typescript/examples/devserver/",
18 ],
19 port = 80,
20 serving_path = "/bundle.js",
21 static_files = [
22 # Files you want to import from the "additional_root_paths", still need to be explicitly specified
23 # as files that should be served. The root paths just make it more convenient to import those dependencies.
24 "@npm//tslib",
25 ":say-hello",
26 ":print-host",
27 ":index.html",
28 ],
29 # Dependencies that produce JavaScript output will be automatically picked up by ConcatJS and will be
30 # part of the serving_path bundle.
31 deps = [":app"],
32)
33
34genrule(
35 name = "say-hello",
36 outs = ["say-hello.js"],
37 cmd = "echo 'console.log(\"Hello!\")' > $@",
38)
39
40genrule(
41 name = "print-host",
42 outs = ["test/print-host.js"],
43 cmd = "echo 'console.log(location.host)' > $@",
44)