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

This commit is contained in:
Lucas Fernandes Nogueira 2021-04-22 16:28:41 -03:00 committed by GitHub
parent 99307d02c3
commit a670d3a457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

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

View File

@ -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_)?;