~starkingdoms/starkingdoms

ref: 61bde6c6a816bdd3794bb419b7080289354f7f68 starkingdoms/spacetime_rs/src/commands/client.rs -rw-r--r-- 1007 bytes
61bde6c6 — ghostlyzsh gravity is now affecting attached modules 2 years 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
30
31
32
use crate::configure::client::configure_client;
use crate::configure::create_writer;
use crate::ninja::{exec, exec_ninja};
use std::error::Error;
use std::path::PathBuf;

pub fn run_http(_: Vec<String>, root: PathBuf) -> Result<(), Box<dyn Error>> {
    let mut config_file_writer = create_writer(&root)?;

    configure_client(&mut config_file_writer, &root)?;

    exec_ninja(&root, vec!["asset".to_string()])?;

    exec("yarn", &root.join("client"), vec![])?;
    exec(
        "yarn",
        &root.join("client"),
        vec!["run".to_string(), "dev".to_string()],
    )?;

    Ok(())
}

pub fn client_protobuf(_: Vec<String>, root: PathBuf) -> Result<(), Box<dyn Error>> {
    exec("yarn", &root.join("client"), vec![])?;
    exec("yarn", &root.join("client"), vec!["protobuf".to_string()])
}

pub fn build_client_prod(_: Vec<String>, root: PathBuf) -> Result<(), Box<dyn Error>> {
    exec("yarn", &root.join("client"), vec![])?;
    exec("yarn", &root.join("client"), vec!["build".to_string()])
}