Greg Magolan | a8f559a | 2019-02-01 16:10:36 -0800 | [diff] [blame] | 1 | load("//:defs.bzl", "ts_devserver") |
| 2 | load("//internal:defaults.bzl", "ts_library") |
Paul Gschwendtner | 4a5ce0d | 2019-01-17 19:49:54 -0800 | [diff] [blame] | 3 | |
| 4 | ts_library( |
| 5 | name = "app", |
| 6 | srcs = ["app.ts"], |
| 7 | tsconfig = "//examples:tsconfig.json", |
| 8 | deps = [ |
| 9 | "@npm//@types/node", |
| 10 | ], |
| 11 | ) |
| 12 | |
| 13 | ts_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 | |
| 34 | genrule( |
| 35 | name = "say-hello", |
| 36 | outs = ["say-hello.js"], |
| 37 | cmd = "echo 'console.log(\"Hello!\")' > $@", |
| 38 | ) |
| 39 | |
| 40 | genrule( |
| 41 | name = "print-host", |
| 42 | outs = ["test/print-host.js"], |
| 43 | cmd = "echo 'console.log(location.host)' > $@", |
| 44 | ) |