From: Greg Burri Date: Thu, 5 Dec 2024 00:10:42 +0000 (+0100) Subject: Compile frontend when deploying X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=45ac5276d4b95db0bf08e1038f8eb778693bebd2;p=recipes.git Compile frontend when deploying --- 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