~starkingdoms/starkingdoms

ref: d5ae439e152b678cacc34b43f9090e33c0b9cb20 starkingdoms/crates/xtask/src/unified_web.rs -rw-r--r-- 1.0 KiB
d5ae439e — core fix: actually install the cli (2) 17 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::env::set_current_dir;
use crate::Task;
use crate::util::{cargo, wasmopt, wbg, workspace_dir};

#[derive(Default)]
pub struct RunClientWeb;
impl Task for RunClientWeb {
    fn name(&self) -> &'static str {
        "unified:web:client"
    }
    fn help(&self) -> &'static str {
        "Build the client (web)"
    }

    fn run(&self, _args: Vec<String>) {
        set_current_dir(workspace_dir().join("crates/unified/")).unwrap();
        cargo("build --profile wasm-release -F wasm -F client --package starkingdoms --target wasm32-unknown-unknown".to_string());

        let wks = workspace_dir();
        let target_dir = wks.join("target/").join("wasm32-unknown-unknown/").join("wasm-release/");

        let unopt = target_dir.join("starkingdoms.wasm");
        let opt = target_dir.join("starkingdoms-opt.wasm");
        let bundle = target_dir.join("bundle/");

        wasmopt(format!("{} -O -o {}", unopt.display(), opt.display()));
        wbg(format!("--out-dir {} {} --target web", bundle.display(), opt.display()))
    }
}