fix release desktop builds

This commit is contained in:
Evan Almloff 2023-08-18 09:55:49 -05:00
parent 62f8e0f727
commit 213b80790b
2 changed files with 12 additions and 2 deletions

View file

@ -9,7 +9,7 @@ use indicatif::{ProgressBar, ProgressStyle};
use serde::Serialize;
use std::{
fs::{copy, create_dir_all, File},
io::Read,
io::{Read, Write},
panic,
path::PathBuf,
time::Duration,
@ -353,6 +353,9 @@ pub fn build_desktop(config: &CrateConfig, _is_serve: bool) -> Result<BuildResul
}
}
// Create the __assets_head.html file for bundling
create_assets_head(&config)?;
log::info!(
"🚩 Build completed: [./{}]",
config
@ -372,6 +375,13 @@ pub fn build_desktop(config: &CrateConfig, _is_serve: bool) -> Result<BuildResul
})
}
fn create_assets_head(config: &CrateConfig) -> Result<()> {
let manifest = config.asset_manifest();
let mut file = File::create(config.out_dir.join("__assets_head.html"))?;
file.write_all(manifest.head().as_bytes())?;
Ok(())
}
fn prettier_build(cmd: subprocess::Exec) -> anyhow::Result<Vec<Diagnostic>> {
let mut warning_messages: Vec<Diagnostic> = vec![];

View file

@ -25,7 +25,7 @@ pub fn build(
}
#[cfg(not(debug_assertions))]
{
std::fs::read_to_string("public/assets_head.html").ok()
std::fs::read_to_string("dist/__assets_head.html").ok()
}
};