mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-24 04:03:52 +03:00
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:
parent
a809cb759f
commit
70ccd1659d
@ -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"
|
||||
|
@ -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": {
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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)?;
|
||||
|
Loading…
Reference in New Issue
Block a user