From 45ac5276d4b95db0bf08e1038f8eb778693bebd2 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Thu, 5 Dec 2024 01:10:42 +0100 Subject: [PATCH] Compile frontend when deploying --- deploy.nu | 5 +++++ frontend/deploy.nu | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/deploy.nu b/deploy.nu index 684ad0b..912f29f 100644 --- a/deploy.nu +++ b/deploy.nu @@ -17,6 +17,11 @@ def main [host: string, destination: string, ssh_key: path] { scp ...$args } + cd frontend + source frontend/deploy.nu + main true + cd .. + cargo test cargo build --target $target --release invoke_ssh [sudo systemctl stop recipes] diff --git a/frontend/deploy.nu b/frontend/deploy.nu index ca50923..6a69206 100644 --- a/frontend/deploy.nu +++ b/frontend/deploy.nu @@ -1,3 +1,12 @@ -wasm-pack build --target web -cp pkg/frontend.js ../backend/static -cp pkg/frontend_bg.wasm ../backend/static \ No newline at end of file +def main [release: bool = false] { + + mut wasm_pack_args = [ build --target web ] + if $release { + $wasm_pack_args = $wasm_pack_args ++ [ --release ] + } + + wasm-pack ...$wasm_pack_args + + cp pkg/frontend.js ../backend/static + cp pkg/frontend_bg.wasm ../backend/static +} \ No newline at end of file -- 2.45.2