feat: commit code

This commit is contained in:
YuKun Liu committed 2022-07-07 23:03:30 +08:00
1 parent f57dc5212b
commit 7860f8b931
2 files changed
+12 -3

No files matched your search

+1
View File
@@ -36,6 +36,7 @@ regex = "1.5.4"
chrono = "0.4.19" chrono = "0.4.19"
anyhow = "1.0.53" anyhow = "1.0.53"
hyper = "0.14.17" hyper = "0.14.17"
loading = "0.3.0"
axum = { version = "0.5.1", features = ["ws", "headers"] } axum = { version = "0.5.1", features = ["ws", "headers"] }
tower-http = { version = "0.2.2", features = ["fs", "trace"] } tower-http = { version = "0.2.2", features = ["fs", "trace"] }
+11 -3
View File
@@ -6,7 +6,7 @@ use crate::{
}; };
use std::{ use std::{
fs::{copy, create_dir_all, remove_dir_all, File}, fs::{copy, create_dir_all, remove_dir_all, File},
io::Read, io::{Read, BufRead},
panic, panic,
path::PathBuf, path::PathBuf,
process::Command, process::Command,
@@ -42,8 +42,9 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<()> {
.arg("build") .arg("build")
.arg("--target") .arg("--target")
.arg("wasm32-unknown-unknown") .arg("wasm32-unknown-unknown")
.stdout(std::process::Stdio::inherit()) .arg("--message-format=json")
.stderr(std::process::Stdio::inherit()); .stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped());
if config.release { if config.release {
cmd.arg("--release"); cmd.arg("--release");
@@ -74,7 +75,14 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<()> {
ExecutableType::Example(name) => cmd.arg("--example").arg(name), ExecutableType::Example(name) => cmd.arg("--example").arg(name),
}; };
let loading = loading::Loading::default();
loading.text("Building");
let output = cmd.output()?; let output = cmd.output()?;
for i in output.stdout.lines() {
// println!("{:?}", i);
}
loading.success("OK");
loading.end();
if !output.status.success() { if !output.status.success() {
log::error!("Build failed!"); log::error!("Build failed!");