Forráskód Böngészése

fix release desktop builds

Evan Almloff 1 éve
szülő
commit
213b80790b
2 módosított fájl, 12 hozzáadás és 2 törlés
  1. 11 1
      packages/cli/src/builder.rs
  2. 1 1
      packages/desktop/src/webview.rs

+ 11 - 1
packages/cli/src/builder.rs

@@ -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![];
 

+ 1 - 1
packages/desktop/src/webview.rs

@@ -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()
         }
     };