|
| 1 | +load("@aspect_rules_js//js:defs.bzl", "js_library", "js_run_binary") |
| 2 | +load("@aspect_rules_ts//ts:defs.bzl", "ts_project") |
| 3 | +load("@npm//:defs.bzl", "npm_link_all_packages") |
| 4 | +load("@npm//frontend:vite/package_json.bzl", "bin") |
| 5 | + |
| 6 | +npm_link_all_packages(name = "node_modules") |
| 7 | + |
| 8 | +ts_project( |
| 9 | + name = "project", |
| 10 | + srcs = glob(["src/**"]), |
| 11 | + assets = glob(["src/**/*.css"]), |
| 12 | + declaration = True, |
| 13 | + transpiler = "tsc", |
| 14 | + tsconfig = "tsconfig.json", |
| 15 | + deps = [ |
| 16 | + ":node_modules/@types/react", |
| 17 | + ":node_modules/@types/react-dom", |
| 18 | + ":node_modules/react", |
| 19 | + ":node_modules/react-dom", |
| 20 | + ":node_modules/react-router-dom", |
| 21 | + ":node_modules/tailwindcss", |
| 22 | + ], |
| 23 | +) |
| 24 | + |
| 25 | +js_run_binary( |
| 26 | + name = "frontend", |
| 27 | + srcs = [ |
| 28 | + "index.html", |
| 29 | + ":project", |
| 30 | + ], |
| 31 | + args = ["build"], |
| 32 | + mnemonic = "ViteBuild", |
| 33 | + out_dirs = ["dist"], |
| 34 | + tool = ":vite", |
| 35 | + visibility = ["//:__subpackages__"], |
| 36 | +) |
| 37 | + |
| 38 | +bin.vite_binary( |
| 39 | + name = "vite", |
| 40 | + chdir = package_name(), |
| 41 | + data = ["vite.config"], |
| 42 | +) |
| 43 | + |
| 44 | +js_library( |
| 45 | + name = "vite.config", |
| 46 | + srcs = ["vite.config.mjs"], |
| 47 | + data = [ |
| 48 | + ":node_modules/@tailwindcss/vite", |
| 49 | + ":node_modules/@vitejs/plugin-react", |
| 50 | + ":node_modules/tailwindcss", |
| 51 | + ":node_modules/vite-plugin-svgr", |
| 52 | + ":node_modules/vitest", |
| 53 | + ], |
| 54 | +) |
0 commit comments