|
| 1 | +load("@npm//:defs.bzl", "npm_link_all_packages") |
| 2 | +load("@rules_angular//src/architect:ng_application.bzl", "ng_application") |
| 3 | +load("@rules_angular//src/architect:ng_config.bzl", "ng_config") |
| 4 | +load("@rules_angular//src/architect:ng_test.bzl", "ng_test") |
| 5 | + |
| 6 | +package(default_visibility = ["//visibility:public"]) |
| 7 | + |
| 8 | +npm_link_all_packages( |
| 9 | + name = "node_modules", |
| 10 | +) |
| 11 | + |
| 12 | +APPLICATION_FILES = [ |
| 13 | + "//dev-app/public", |
| 14 | +] + glob( |
| 15 | + ["src/**/*"], |
| 16 | + exclude = ["src/**/*.spec.ts"], |
| 17 | +) |
| 18 | + |
| 19 | +APPLICATION_DEPS = [ |
| 20 | + ":node_modules/typescript", |
| 21 | +] |
| 22 | + |
| 23 | +TEST_FILES = APPLICATION_FILES + glob(["src/app/**/*.spec.ts"]) |
| 24 | + |
| 25 | +TEST_DEPS = APPLICATION_DEPS + [ |
| 26 | + ":node_modules/jsdom", |
| 27 | + ":node_modules/vitest", |
| 28 | + ":tsconfig.app.json", |
| 29 | +] |
| 30 | + |
| 31 | +ng_config(name = "ng_config") |
| 32 | + |
| 33 | +ng_application( |
| 34 | + name = "build", |
| 35 | + srcs = APPLICATION_FILES + APPLICATION_DEPS, |
| 36 | + args = [ |
| 37 | + "--configuration", |
| 38 | + "development", |
| 39 | + ], |
| 40 | + env = { |
| 41 | + "NG_BUILD_PARTIAL_SSR": "1", |
| 42 | + }, |
| 43 | + ng_config = ":ng_config", |
| 44 | + node_modules = ":node_modules", |
| 45 | + project_name = "dev-app", |
| 46 | + tags = [ |
| 47 | + # Tagged as manual as both build and build.production use the same output directory. |
| 48 | + "manual", |
| 49 | + ], |
| 50 | +) |
| 51 | + |
| 52 | +ng_application( |
| 53 | + name = "build.production", |
| 54 | + srcs = APPLICATION_FILES + APPLICATION_DEPS, |
| 55 | + args = [ |
| 56 | + "--configuration", |
| 57 | + "production", |
| 58 | + ], |
| 59 | + env = { |
| 60 | + "NG_BUILD_OPTIMIZE_CHUNKS": "1", |
| 61 | + }, |
| 62 | + ng_config = ":ng_config", |
| 63 | + node_modules = ":node_modules", |
| 64 | + project_name = "dev-app", |
| 65 | + tags = [ |
| 66 | + # Tagged as manual as both build and build.production use the same output directory. |
| 67 | + "manual", |
| 68 | + ], |
| 69 | +) |
| 70 | + |
| 71 | +ng_test( |
| 72 | + name = "test", |
| 73 | + srcs = TEST_FILES + TEST_DEPS, |
| 74 | + ng_config = ":ng_config", |
| 75 | + node_modules = ":node_modules", |
| 76 | + project_name = "dev-app", |
| 77 | +) |
0 commit comments