Explorar el Código

Feat/bundler (#66)

* feat(updateWebview): and a couple npm ignores

* chore(update): version

* fix(bundler): remove deprecated items
closes #54.
nothingismagick hace 5 años
padre
commit
70ccd1659d

+ 1 - 1
lib/rust/Cargo.toml

@@ -13,7 +13,7 @@ serde = "1.0"
 serde_derive = "1.0"
 dirs = "2.0.2"
 ignore = "0.4.10"
-phf = "0.8.0"
+phf = "0.7.24"
 threadpool = "1.7"
 rand = "0.7"
 reqwest = "0.9"

+ 4 - 4
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@tauri-apps/tauri",
-  "version": "0.0.1-utility.16",
+  "version": "0.0.1-utility.19",
   "description": "Multi-binding collection of libraries and templates for building Tauri apps",
   "bin": {
     "tauri": "./mode/bin/tauri.js"
@@ -52,7 +52,8 @@
     "png2icons": "^2.0.1",
     "read-chunk": "^3.2.0",
     "sharp": "^0.23.2",
-    "webpack-merge": "^4.2.1"
+    "webpack-merge": "^4.2.1",
+    "webpack-shell-plugin": "^0.5.0"
   },
   "devDependencies": {
     "dotenv": "^8.2.0",
@@ -66,8 +67,7 @@
     "jest": "24.9.0",
     "jest-mock-process": "^1.2.0",
     "lint-staged": "^9.4.2",
-    "promise": "^8.0.3",
-    "webpack-shell-plugin": "^0.5.0"
+    "promise": "^8.0.3"
   },
   "husky": {
     "hooks": {

+ 1 - 1
tools/rust/cargo-tauri-bundle/src/bundle/deb_bundle.rs

@@ -252,7 +252,7 @@ fn generate_icon_files(settings: &Settings, data_dir: &PathBuf) -> crate::Result
         }
       }
     } else {
-      let icon = r#try!(image::open(&icon_path));
+      let icon = image::open(&icon_path)?;
       let (width, height) = icon.dimensions();
       let is_high_density = common::is_retina(&icon_path);
       if !sizes.contains(&(width, height, is_high_density)) {

+ 1 - 1
tools/rust/cargo-tauri-bundle/src/bundle/ios_bundle.rs

@@ -102,7 +102,7 @@ fn generate_icon_files(bundle_dir: &Path, settings: &Settings) -> crate::Result<
           }
         }
       } else {
-        let icon = r#try!(image::open(&icon_path));
+        let icon = image::open(&icon_path)?;
         let (width, height) = icon.dimensions();
         let is_retina = common::is_retina(&icon_path);
         if !sizes.contains(&(width, height, is_retina)) {

+ 8 - 8
tools/rust/cargo-tauri-bundle/src/bundle/osx_bundle.rs

@@ -265,8 +265,8 @@ fn create_icns_file(
     match icns::IconType::from_pixel_size_and_density(icon.width(), icon.height(), density) {
       Some(icon_type) => {
         if !family.has_icon_with_type(icon_type) {
-          let icon = r#try!(make_icns_image(icon));
-          r#try!(family.add_icon_with_type(&icon, icon_type));
+          let icon =make_icns_image(icon)?;
+          family.add_icon_with_type(&icon, icon_type)?;
         }
         Ok(())
       }
@@ -280,7 +280,7 @@ fn create_icns_file(
   let mut images_to_resize: Vec<(image::DynamicImage, u32, u32)> = vec![];
   for icon_path in settings.icon_files() {
     let icon_path = icon_path?;
-    let icon = r#try!(image::open(&icon_path));
+    let icon = image::open(&icon_path)?;
     let density = if common::is_retina(&icon_path) { 2 } else { 1 };
     let (w, h) = icon.dimensions();
     let orig_size = min(w, h);
@@ -288,22 +288,22 @@ fn create_icns_file(
     if orig_size > next_size_down {
       images_to_resize.push((icon, next_size_down, density));
     } else {
-      r#try!(add_icon_to_family(icon, density, &mut family));
+      add_icon_to_family(icon, density, &mut family)?;
     }
   }
 
   for (icon, next_size_down, density) in images_to_resize {
     let icon = icon.resize_exact(next_size_down, next_size_down, image::Lanczos3);
-    r#try!(add_icon_to_family(icon, density, &mut family));
+    add_icon_to_family(icon, density, &mut family)?;
   }
 
   if !family.is_empty() {
-    r#try!(fs::create_dir_all(resources_dir));
+    fs::create_dir_all(resources_dir)?;
     let mut dest_path = resources_dir.clone();
     dest_path.push(settings.bundle_name());
     dest_path.set_extension("icns");
-    let icns_file = BufWriter::new(r#try!(File::create(&dest_path)));
-    r#try!(family.write(icns_file));
+    let icns_file = BufWriter::new(File::create(&dest_path)?);
+    family.write(icns_file)?;
     return Ok(Some(dest_path));
   }
 

+ 1 - 1
tools/rust/cargo-tauri-bundle/src/main.rs

@@ -139,7 +139,7 @@ fn run() -> crate::Result<()> {
         .map_err(From::from)
         .and_then(|d| Settings::new(d, m))
         .and_then(|s| {
-          r#try!(build_project_if_unbuilt(&s));
+          build_project_if_unbuilt(&s)?;
           Ok(s)
         })
         .and_then(bundle_project)?;