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
33
34
35
36
37
38
39
40
41
42
43
use clap;
use crate::config::SimiConfig;
use crate::error::*;
use crate::external_cmds as cmds;
#[derive(Clone)]
pub struct BuildArgs {
pub release: bool,
pub nightly: bool,
}
impl BuildArgs {
pub fn from_clap<'a>(matches: &clap::ArgMatches<'a>) -> Self {
Self {
release: matches.is_present("release"),
nightly: !matches.is_present("stable"),
}
}
}
pub fn build(config: &SimiConfig) -> Result<(), Error> {
cmds::cargo_build(config)?;
cmds::wasm_bindgen(config)?;
crate::project::create_simi_app(&config)?;
Ok(())
}
pub fn run(arg: BuildArgs) -> Result<(), Error> {
let config = SimiConfig::from_build(arg)?;
let _ = build(&config)?;
Ok(())
}