Feat/bundler (#66)

* feat(updateWebview): and a couple npm ignores

* chore(update): version

* fix(bundler): remove deprecated items
closes #54.
This commit is contained in:
nothingismagick 2019-11-24 19:42:34 +01:00 committed by GitHub
parent a809cb759f
commit 70ccd1659d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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