fix release desktop builds

This commit is contained in:
Evan Almloff committed 2023-08-18 09:55:49 -05:00
1 parent 62f8e0f727
commit 213b80790b
2 files changed
+12 -2

No files matched your search

+11 -1
View File
@@ -9,7 +9,7 @@ use indicatif::{ProgressBar, ProgressStyle};
use serde::Serialize; use serde::Serialize;
use std::{ use std::{
fs::{copy, create_dir_all, File}, fs::{copy, create_dir_all, File},
io::Read, io::{Read, Write},
panic, panic,
path::PathBuf, path::PathBuf,
time::Duration, 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!( log::info!(
"🚩 Build completed: [./{}]", "🚩 Build completed: [./{}]",
config 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>> { fn prettier_build(cmd: subprocess::Exec) -> anyhow::Result<Vec<Diagnostic>> {
let mut warning_messages: Vec<Diagnostic> = vec![]; let mut warning_messages: Vec<Diagnostic> = vec![];
+1 -1
View File
@@ -25,7 +25,7 @@ pub fn build(
} }
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
{ {
std::fs::read_to_string("public/assets_head.html").ok() std::fs::read_to_string("dist/__assets_head.html").ok()
} }
}; };