Mercurial
diff hg-web/BUILD @ 190:a2725419f988 hg-web
Updated so that bun builds will with already existing js files.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sat, 24 Jan 2026 21:06:42 -0800 |
| parents | 32ce881452fa |
| children | a06710325c30 |
line wrap: on
line diff
--- a/hg-web/BUILD Fri Jan 23 22:50:28 2026 -0800 +++ b/hg-web/BUILD Sat Jan 24 21:06:42 2026 -0800 @@ -1,88 +1,66 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary") -load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "bun_build") +load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "bun_bundle") -# External -move_files_into_dir( - name = "external_js_ts_moved", - srcs = [ - "//markdown_converter:markdown_to_html_wasm", - ], - dest = "src", -) - +# Source files filegroup( - name = "external_js_ts", - srcs = [":external_js_ts_moved"], + name = "src_ts_files", + srcs = glob([ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.js", + "src/**/*.jsx", + ], allow_empty = True), ) -# Internal -filegroup( - name = "raw_file", - srcs = glob(["src/**"]), -) - -filegroup( - name = "all_ts_files", - srcs = [":external_js_ts"] + glob([ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.jsx", - ], allow_empty=True) -) - -# Generate js file... -bun_build( +# Bundle TypeScript with Bun +bun_bundle( name = "page", src = "src/main.tsx", - src_folder = "hg-web", - data = [ - "//third_party/bun:bun_files", - ":all_ts_files", + deps = [ + ":src_ts_files", + "//markdown_converter:markdown_to_html_wasm", ], visibility = ["//visibility:public"], ) +# Prepare compiled assets move_files_into_dir( - name = "compiled_ts", + name = "compiled_js", srcs = [ ":page", + "//markdown_converter:markdown_to_html_wasm", + "//third_party/highlight:js", ], dest = "src", ) move_files_into_dir( name = "public_files", - srcs = [ - "//mrjunejune:public_files" - ], + srcs = ["//mrjunejune:public_files"], dest = "src/public", ) filegroup( - name = "src_files", - srcs = [":raw_file", ":compiled_ts", "public_files"], + name = "all_assets", + srcs = glob(["src/**"]) + [":compiled_js", ":public_files"], ) -# Binary +# Server binaries cc_binary( name = "hg_web_server", srcs = ["main.c"], - deps = [ - "//seobeo:seobeo", - ], - data = [":src_files"], + deps = ["//seobeo:seobeo"], + data = [":all_assets"], +) + +cc_binary( + name = "hg_web_server_debug", + srcs = ["main.c"], + deps = ["//seobeo:seobeo"], + data = [":all_assets"], ) bundle( name = "hg_web_server_bundle", binary = ":hg_web_server", ) - -cc_binary( - name = "hg_web_server_debug", - srcs = ["main.c"], - deps = ["//seobeo:seobeo"], - data = [":src_files"], -) -