fix: prettier_build unavailabe (#1410)

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
YuKun LiuandEvan Almloff authored and GitHub committed 2023-09-02 18:31:34 -05:00
1 parent 94f76946fc
commit 2cfa0e4ea9
4 files changed
+10 -13

No files matched your search

+5 -7
View File
@@ -22,7 +22,7 @@ pub struct BuildResult {
pub elapsed_time: u128,
}
pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
pub fn build(config: &CrateConfig) -> Result<BuildResult> {
// [1] Build the project with cargo, generating a wasm32-unknown-unknown target (is there a more specific, better target to leverage?)
// [2] Generate the appropriate build folders
// [3] Wasm-bindgen the .wasm fiile, and move it into the {builddir}/modules/xxxx/xxxx_bg.wasm
@@ -53,7 +53,8 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
.arg("build")
.arg("--target")
.arg("wasm32-unknown-unknown")
.arg("--message-format=json");
.arg("--message-format=json")
.arg("--quiet");
let cmd = if config.release {
cmd.arg("--release")
@@ -66,8 +67,6 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
cmd
};
let cmd = if quiet { cmd.arg("--quiet") } else { cmd };
let cmd = if config.custom_profile.is_some() {
let custom_profile = config.custom_profile.as_ref().unwrap();
cmd.arg("--profile").arg(custom_profile)
@@ -386,10 +385,9 @@ fn prettier_build(cmd: subprocess::Exec) -> anyhow::Result<Vec<Diagnostic>> {
}
}
StopSpinOnDrop(pb.clone());
let stdout = cmd.detached().stream_stdout()?;
let reader = std::io::BufReader::new(stdout);
for message in cargo_metadata::Message::parse_stream(reader) {
match message.unwrap() {
Message::CompilerMessage(msg) => {
@@ -409,7 +407,7 @@ fn prettier_build(cmd: subprocess::Exec) -> anyhow::Result<Vec<Diagnostic>> {
}
}
Message::CompilerArtifact(artifact) => {
pb.set_message(format!("Compiling {} ", artifact.package_id));
pb.set_message(format!("⚙️ Compiling {} ", artifact.package_id));
pb.tick();
}
Message::BuildScriptExecuted(script) => {