Эх сурвалжийг харах

fix(cli.rs): check if distDir exists after running `beforeDevCommand` (#1586)

Lucas Fernandes Nogueira 4 жил өмнө
parent
commit
a670d3a457

+ 5 - 0
.changes/cli-rs-dist-validation.md

@@ -0,0 +1,5 @@
+---
+"cli.rs": patch
+---
+
+Check if distDir assets are built after running `beforeDevCommand`.

+ 8 - 8
tooling/cli.rs/src/build.rs

@@ -64,14 +64,6 @@ impl Build {
     let config_guard = config.lock().unwrap();
     let config_ = config_guard.as_ref().unwrap();
 
-    let web_asset_path = PathBuf::from(&config_.build.dist_dir);
-    if !web_asset_path.exists() {
-      return Err(anyhow::anyhow!(
-        "Unable to find your web assets, did you forget to build your web app? Your distDir is set to \"{:?}\".",
-        web_asset_path
-      ));
-    }
-
     if let Some(before_build) = &config_.build.before_build_command {
       if !before_build.is_empty() {
         logger.log(format!("Running `{}`", before_build));
@@ -92,6 +84,14 @@ impl Build {
       }
     }
 
+    let web_asset_path = PathBuf::from(&config_.build.dist_dir);
+    if !web_asset_path.exists() {
+      return Err(anyhow::anyhow!(
+        "Unable to find your web assets, did you forget to build your web app? Your distDir is set to \"{:?}\".",
+        web_asset_path
+      ));
+    }
+
     rust::build_project(self.debug)?;
 
     let app_settings = rust::AppSettings::new(&config_)?;