mirror of https://github.com/tauri-apps/tauri
* update tauri module versions * update bundler * update node cli Co-authored-by: Tensor-Programming <abeltensor@tensor-programming.com>
This commit is contained in:
parent
b9c0118c0e
commit
f69d9213f7
|
@ -89,6 +89,9 @@ jobs:
|
|||
- name: install cli deps via yarn
|
||||
working-directory: ./cli/tauri.js
|
||||
run: yarn
|
||||
- name: build cli
|
||||
working-directory: ./cli/tauri.js
|
||||
run: yarn build
|
||||
- name: cache node modules
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name: clippy check
|
||||
name: clippy and eslint check
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -23,3 +23,15 @@ jobs:
|
|||
env:
|
||||
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/test/fixture/dist
|
||||
TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/test/fixture/src-tauri
|
||||
|
||||
eslint-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- name: install deps via yarn
|
||||
working-directory: ./cli/tauri.js
|
||||
run: yarn
|
||||
- name: run eslint
|
||||
working-directory: ./cli/tauri.js
|
||||
run: yarn lint
|
||||
|
|
|
@ -36,6 +36,9 @@ typings/
|
|||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional yarn cache directory
|
||||
.yarn
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
|
@ -63,6 +66,7 @@ package-lock.json
|
|||
proptest-regressions/
|
||||
TODO.md
|
||||
|
||||
|
||||
# Tauri output
|
||||
/bundle.json
|
||||
/config.json
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
@ECHO OFF
|
||||
ECHO Make EXE From BAT
|
||||
ECHO.
|
||||
ECHO.
|
||||
|
||||
REM Usage:
|
||||
REM MakeExeFromBat BatFileToConvert [IncludeFile1] [IncludeFile2] [...]
|
||||
REM
|
||||
REM Required Parameters:
|
||||
REM BatFileToConvert
|
||||
REM Source batch file to use to produce the output Exe file.
|
||||
REM
|
||||
REM Optional Parameters:
|
||||
REM IncludeFile
|
||||
REM Additional files to include in the Exe file.
|
||||
REM You can include external tools used by the batch file so they are available on the executing machine.
|
||||
|
||||
SETLOCAL
|
||||
|
||||
REM Configuration (no quotes needed):
|
||||
SET PathTo7Zip=
|
||||
|
||||
|
||||
REM ---- Do not modify anything below this line ----
|
||||
|
||||
SET OutputFile="%~n1.exe"
|
||||
SET SourceFiles="%TEMP%MakeEXE_files.txt"
|
||||
SET Config="%TEMP%MakeEXE_config.txt"
|
||||
SET Source7ZFile="%Temp%MakeEXE.7z"
|
||||
|
||||
REM Remove existing files
|
||||
IF EXIST %OutputFile% DEL %OutputFile%
|
||||
|
||||
REM Build source archive
|
||||
ECHO "%~dpnx1" > %SourceFiles%
|
||||
:AddInclude
|
||||
IF {%2}=={} GOTO EndInclude
|
||||
ECHO "%~dpnx2" >> %SourceFiles%
|
||||
SHIFT /2
|
||||
GOTO AddInclude
|
||||
:EndInclude
|
||||
"%PathTo7Zip%7za.exe" a %Source7ZFile% @%SourceFiles%
|
||||
|
||||
REM Build config file
|
||||
ECHO ;!@Install@!UTF-8! > %Config%
|
||||
ECHO RunProgram="%~nx1" >> %Config%
|
||||
ECHO ;!@InstallEnd@! >> %Config%
|
||||
|
||||
REM Build EXE
|
||||
COPY /B "%PathTo7Zip%7zsd.sfx" + %Config% + %Source7ZFile% %OutputFile%
|
||||
|
||||
REM Clean up
|
||||
IF EXIST %SourceFiles% DEL %SourceFiles%
|
||||
IF EXIST %Config% DEL %Config%
|
||||
IF EXIST %Source7ZFile% DEL %Source7ZFile%
|
||||
|
||||
ENDLOCAL
|
|
@ -6,8 +6,7 @@
|
|||
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
|
||||
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
|
||||
|
||||
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library
|
||||
)
|
||||
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
|
||||
[![devto](https://img.shields.io/badge/documentation-wiki-purple.svg)](https://github.com/tauri-apps/tauri/wiki)
|
||||
|
||||
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
|
||||
|
@ -18,9 +17,9 @@ Tauri is a tool for building tiny, blazing fast binaries for all major desktop p
|
|||
|
||||
| Component | Version | Lin | Win | Mac |
|
||||
|-----------|---------|-----|-----|-----|
|
||||
| tauri.js CLI | ![](https://img.shields.io/npm/v/tauri.svg) |✅|✅|✅|
|
||||
| tauri core | ![](https://img.shields.io/crates/v/tauri.svg) |✅|✅|✅|
|
||||
| tauri bundler | ![](https://img.shields.io/crates/v/tauri-bundler.svg) |✅|✅|✅ |
|
||||
| tauri.js CLI | [![](https://img.shields.io/npm/v/tauri.svg)](https://www.npmjs.com/package/tauri) |✅|✅|✅|
|
||||
| tauri core | [![](https://img.shields.io/crates/v/tauri.svg)](https://crates.io/crates/tauri) |✅|✅|✅|
|
||||
| tauri bundler | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) |✅|✅|✅ |
|
||||
|
||||
## Who Tauri is For
|
||||
Because of the way Tauri has been built and can be extended, developers
|
||||
|
|
|
@ -2,7 +2,7 @@ workspace = {}
|
|||
|
||||
[package]
|
||||
name = "tauri-bundler"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
authors = ["George Burton <burtonageo@gmail.com>", "Lucas Fernandes Gonçalves Nogueira <lucas@quasar.dev>", "Daniel Thompson-Yvetot <denjell@sfosc.org>", "Tensor Programming <tensordeveloper@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
keywords = ["bundle", "cargo", "tauri"]
|
||||
|
@ -32,8 +32,6 @@ toml = "0.5.6"
|
|||
uuid = { version = "0.8", features = ["v5"] }
|
||||
walkdir = "2"
|
||||
|
||||
tauri-utils = {version = "0.4", path = "../../tauri-utils"}
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
attohttpc = { version = "0.11.1" }
|
||||
regex = { version = "1" }
|
||||
|
|
|
@ -11,6 +11,7 @@ mod ios_bundle;
|
|||
mod msi_bundle;
|
||||
mod osx_bundle;
|
||||
mod path_utils;
|
||||
mod platform;
|
||||
mod rpm_bundle;
|
||||
mod settings;
|
||||
#[cfg(target_os = "windows")]
|
||||
|
|
|
@ -27,9 +27,9 @@ use image::png::{PNGDecoder, PNGEncoder};
|
|||
use image::{self, GenericImageView, ImageDecoder};
|
||||
use libflate::gzip;
|
||||
use md5;
|
||||
use std::process::{Command, Stdio};
|
||||
use tar;
|
||||
use walkdir::WalkDir;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::convert::TryInto;
|
||||
|
@ -105,9 +105,17 @@ pub fn generate_folders(settings: &Settings, package_dir: &Path) -> crate::Resul
|
|||
generate_icon_files(settings, &data_dir).chain_err(|| "Failed to create icon files")?;
|
||||
generate_desktop_file(settings, &data_dir).chain_err(|| "Failed to create desktop file")?;
|
||||
|
||||
generate_bootstrap_file(settings, &data_dir).chain_err(|| "Failed to generate bootstrap file")?;
|
||||
|
||||
Ok(data_dir)
|
||||
}
|
||||
|
||||
fn generate_bootstrap_file(settings: &Settings, data_dir: &Path) -> crate::Result<()> {
|
||||
let bin_name = settings.binary_name();
|
||||
let bin_dir = data_dir.join("usr/bin");
|
||||
|
||||
let bootstrap_file_name = format!("__{}-bootstrapper", bin_name);
|
||||
let bootstrapper_file_path = bin_dir
|
||||
.join(bootstrap_file_name.clone());
|
||||
let bootstrapper_file_path = bin_dir.join(bootstrap_file_name.clone());
|
||||
let bootstrapper_file = &mut common::create_file(&bootstrapper_file_path)?;
|
||||
println!("{:?}", bootstrapper_file_path);
|
||||
write!(
|
||||
|
@ -119,23 +127,23 @@ export NVM_DIR=\"$([ -z \"${{XDG_CONFIG_HOME-}}\" ] && printf %s \"${{HOME}}/.nv
|
|||
|
||||
if [ -e ~/.bash_profile ]
|
||||
then
|
||||
source ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
fi
|
||||
if [ -e ~/.zprofile ]
|
||||
then
|
||||
source ~/.zprofile
|
||||
source ~/.zprofile
|
||||
fi
|
||||
if [ -e ~/.profile ]
|
||||
then
|
||||
source ~/.profile
|
||||
source ~/.profile
|
||||
fi
|
||||
if [ -e ~/.bashrc ]
|
||||
then
|
||||
source ~/.bashrc
|
||||
source ~/.bashrc
|
||||
fi
|
||||
if [ -e ~/.zshrc ]
|
||||
then
|
||||
source ~/.zshrc
|
||||
source ~/.zshrc
|
||||
fi
|
||||
|
||||
echo $PATH
|
||||
|
@ -145,10 +153,10 @@ source /etc/profile
|
|||
if pidof -x \"{}\" >/dev/null; then
|
||||
exit 0
|
||||
else
|
||||
Exec=/usr/bin/env /usr/bin/{} $@ & disown
|
||||
Exec=/usr/bin/env /usr/bin/{} $@ & disown
|
||||
fi
|
||||
exit 0
|
||||
", bootstrap_file_name, bin_name
|
||||
exit 0",
|
||||
bootstrap_file_name, bin_name
|
||||
)?;
|
||||
bootstrapper_file.flush()?;
|
||||
|
||||
|
@ -158,10 +166,9 @@ exit 0
|
|||
.current_dir(&bin_dir)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.expect("Failed to chmod script");
|
||||
.spawn()?;
|
||||
|
||||
Ok(data_dir)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Generate the application desktop file and store it under the `data_dir`.
|
||||
|
|
|
@ -22,154 +22,133 @@ use std::fs::{self, File};
|
|||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
|
||||
pub fn bundle_project(settings: &Settings) -> ::Result<Vec<PathBuf>> {
|
||||
common::print_warning("iOS bundle support is still experimental.")?;
|
||||
|
||||
let app_bundle_name = format!("{}.app", settings.bundle_name());
|
||||
common::print_bundling(&app_bundle_name)?;
|
||||
let bundle_dir = settings
|
||||
.project_out_directory()
|
||||
.join("bundle/ios")
|
||||
.join(&app_bundle_name);
|
||||
let bundle_dir = settings.project_out_directory().join("bundle/ios").join(&app_bundle_name);
|
||||
if bundle_dir.exists() {
|
||||
fs::remove_dir_all(&bundle_dir)
|
||||
.chain_err(|| format!("Failed to remove old {}", app_bundle_name))?;
|
||||
fs::remove_dir_all(&bundle_dir).chain_err(|| {
|
||||
format!("Failed to remove old {}", app_bundle_name)
|
||||
})?;
|
||||
}
|
||||
fs::create_dir_all(&bundle_dir)
|
||||
.chain_err(|| format!("Failed to create bundle directory at {:?}", bundle_dir))?;
|
||||
fs::create_dir_all(&bundle_dir).chain_err(|| {
|
||||
format!("Failed to create bundle directory at {:?}", bundle_dir)
|
||||
})?;
|
||||
|
||||
settings.copy_resources(bundle_dir);
|
||||
for src in settings.resource_files() {
|
||||
let src = src?;
|
||||
let dest = bundle_dir.join(common::resource_relpath(&src));
|
||||
common::copy_file(&src, &dest).chain_err(|| {
|
||||
format!("Failed to copy resource file {:?}", src)
|
||||
})?;
|
||||
}
|
||||
|
||||
let icon_filenames =
|
||||
generate_icon_files(&bundle_dir, settings).chain_err(|| "Failed to create app icons")?;
|
||||
generate_info_plist(&bundle_dir, settings, &icon_filenames)
|
||||
.chain_err(|| "Failed to create Info.plist")?;
|
||||
let icon_filenames = generate_icon_files(&bundle_dir, settings).chain_err(|| {
|
||||
"Failed to create app icons"
|
||||
})?;
|
||||
generate_info_plist(&bundle_dir, settings, &icon_filenames).chain_err(|| {
|
||||
"Failed to create Info.plist"
|
||||
})?;
|
||||
let bin_path = bundle_dir.join(&settings.bundle_name());
|
||||
common::copy_file(settings.binary_path(), &bin_path)
|
||||
.chain_err(|| format!("Failed to copy binary from {:?}", settings.binary_path()))?;
|
||||
common::copy_file(settings.binary_path(), &bin_path).chain_err(|| {
|
||||
format!("Failed to copy binary from {:?}", settings.binary_path())
|
||||
})?;
|
||||
Ok(vec![bundle_dir])
|
||||
}
|
||||
|
||||
/// Generate the icon files and store them under the `bundle_dir`.
|
||||
fn generate_icon_files(bundle_dir: &Path, settings: &Settings) -> crate::Result<Vec<String>> {
|
||||
fn generate_icon_files(bundle_dir: &Path, settings: &Settings) -> ::Result<Vec<String>> {
|
||||
let mut filenames = Vec::new();
|
||||
{
|
||||
let mut get_dest_path = |width: u32, height: u32, is_retina: bool| {
|
||||
let filename = format!(
|
||||
"icon_{}x{}{}.png",
|
||||
width,
|
||||
height,
|
||||
if is_retina { "@2x" } else { "" }
|
||||
);
|
||||
let path = bundle_dir.join(&filename);
|
||||
filenames.push(filename);
|
||||
path
|
||||
};
|
||||
let mut sizes = BTreeSet::new();
|
||||
// Prefer PNG files.
|
||||
for icon_path in settings.icon_files() {
|
||||
let icon_path = icon_path?;
|
||||
if icon_path.extension() != Some(OsStr::new("png")) {
|
||||
continue;
|
||||
}
|
||||
let decoder = PNGDecoder::new(File::open(&icon_path)?)?;
|
||||
let width = decoder.dimensions().0.try_into()?;
|
||||
let height = decoder.dimensions().1.try_into()?;
|
||||
let is_retina = common::is_retina(&icon_path);
|
||||
if !sizes.contains(&(width, height, is_retina)) {
|
||||
sizes.insert((width, height, is_retina));
|
||||
let dest_path = get_dest_path(width, height, is_retina);
|
||||
common::copy_file(&icon_path, &dest_path)?;
|
||||
}
|
||||
}
|
||||
// Fall back to non-PNG files for any missing sizes.
|
||||
for icon_path in settings.icon_files() {
|
||||
let icon_path = icon_path?;
|
||||
if icon_path.extension() == Some(OsStr::new("png")) {
|
||||
continue;
|
||||
} else if icon_path.extension() == Some(OsStr::new("icns")) {
|
||||
let icon_family = icns::IconFamily::read(File::open(&icon_path)?)?;
|
||||
for icon_type in icon_family.available_icons() {
|
||||
let width = icon_type.screen_width();
|
||||
let height = icon_type.screen_height();
|
||||
let is_retina = icon_type.pixel_density() > 1;
|
||||
if !sizes.contains(&(width, height, is_retina)) {
|
||||
sizes.insert((width, height, is_retina));
|
||||
let dest_path = get_dest_path(width, height, is_retina);
|
||||
let icon = icon_family.get_icon_with_type(icon_type)?;
|
||||
icon.write_png(File::create(dest_path)?)?;
|
||||
let mut get_dest_path = |width: u32, height: u32, is_retina: bool| {
|
||||
let filename = format!("icon_{}x{}{}.png",
|
||||
width,
|
||||
height,
|
||||
if is_retina { "@2x" } else { "" });
|
||||
let path = bundle_dir.join(&filename);
|
||||
filenames.push(filename);
|
||||
path
|
||||
};
|
||||
let mut sizes = BTreeSet::new();
|
||||
// Prefer PNG files.
|
||||
for icon_path in settings.icon_files() {
|
||||
let icon_path = icon_path?;
|
||||
if icon_path.extension() != Some(OsStr::new("png")) {
|
||||
continue;
|
||||
}
|
||||
let mut decoder = PNGDecoder::new(File::open(&icon_path)?);
|
||||
let (width, height) = decoder.dimensions()?;
|
||||
let is_retina = common::is_retina(&icon_path);
|
||||
if !sizes.contains(&(width, height, is_retina)) {
|
||||
sizes.insert((width, height, is_retina));
|
||||
let dest_path = get_dest_path(width, height, is_retina);
|
||||
common::copy_file(&icon_path, &dest_path)?;
|
||||
}
|
||||
}
|
||||
// Fall back to non-PNG files for any missing sizes.
|
||||
for icon_path in settings.icon_files() {
|
||||
let icon_path = icon_path?;
|
||||
if icon_path.extension() == Some(OsStr::new("png")) {
|
||||
continue;
|
||||
} else if icon_path.extension() == Some(OsStr::new("icns")) {
|
||||
let icon_family = icns::IconFamily::read(File::open(&icon_path)?)?;
|
||||
for icon_type in icon_family.available_icons() {
|
||||
let width = icon_type.screen_width();
|
||||
let height = icon_type.screen_height();
|
||||
let is_retina = icon_type.pixel_density() > 1;
|
||||
if !sizes.contains(&(width, height, is_retina)) {
|
||||
sizes.insert((width, height, is_retina));
|
||||
let dest_path = get_dest_path(width, height, is_retina);
|
||||
let icon = icon_family.get_icon_with_type(icon_type)?;
|
||||
icon.write_png(File::create(dest_path)?)?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let icon = try!(image::open(&icon_path));
|
||||
let (width, height) = icon.dimensions();
|
||||
let is_retina = common::is_retina(&icon_path);
|
||||
if !sizes.contains(&(width, height, is_retina)) {
|
||||
sizes.insert((width, height, is_retina));
|
||||
let dest_path = get_dest_path(width, height, is_retina);
|
||||
let encoder = PNGEncoder::new(common::create_file(&dest_path)?);
|
||||
encoder.encode(&icon.raw_pixels(), width, height, icon.color())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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)) {
|
||||
sizes.insert((width, height, is_retina));
|
||||
let dest_path = get_dest_path(width, height, is_retina);
|
||||
let encoder = PNGEncoder::new(common::create_file(&dest_path)?);
|
||||
encoder.encode(&icon.raw_pixels(), width, height, icon.color())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(filenames)
|
||||
}
|
||||
|
||||
fn generate_info_plist(
|
||||
bundle_dir: &Path,
|
||||
settings: &Settings,
|
||||
icon_filenames: &Vec<String>,
|
||||
) -> crate::Result<()> {
|
||||
fn generate_info_plist(bundle_dir: &Path, settings: &Settings, icon_filenames: &Vec<String>) -> ::Result<()> {
|
||||
let file = &mut common::create_file(&bundle_dir.join("Info.plist"))?;
|
||||
write!(
|
||||
file,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \
|
||||
\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n\
|
||||
<plist version=\"1.0\">\n\
|
||||
<dict>\n"
|
||||
)?;
|
||||
write!(file,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \
|
||||
\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n\
|
||||
<plist version=\"1.0\">\n\
|
||||
<dict>\n")?;
|
||||
|
||||
write!(file, " <key>CFBundleIdentifier</key>\n <string>{}</string>\n", settings.bundle_identifier())?;
|
||||
write!(file, " <key>CFBundleDisplayName</key>\n <string>{}</string>\n", settings.bundle_name())?;
|
||||
write!(file, " <key>CFBundleName</key>\n <string>{}</string>\n", settings.bundle_name())?;
|
||||
write!(file, " <key>CFBundleExecutable</key>\n <string>{}</string>\n", settings.binary_name())?;
|
||||
write!(file, " <key>CFBundleVersion</key>\n <string>{}</string>\n", settings.version_string())?;
|
||||
write!(file, " <key>CFBundleShortVersionString</key>\n <string>{}</string>\n", settings.version_string())?;
|
||||
write!(file, " <key>CFBundleDevelopmentRegion</key>\n <string>en_US</string>\n")?;
|
||||
|
||||
write!(
|
||||
file,
|
||||
" <key>CFBundleIdentifier</key>\n <string>{}</string>\n",
|
||||
settings.bundle_identifier()
|
||||
)?;
|
||||
write!(
|
||||
file,
|
||||
" <key>CFBundleDisplayName</key>\n <string>{}</string>\n",
|
||||
settings.bundle_name()
|
||||
)?;
|
||||
write!(
|
||||
file,
|
||||
" <key>CFBundleName</key>\n <string>{}</string>\n",
|
||||
settings.bundle_name()
|
||||
)?;
|
||||
write!(
|
||||
file,
|
||||
" <key>CFBundleExecutable</key>\n <string>{}</string>\n",
|
||||
settings.binary_name()
|
||||
)?;
|
||||
write!(
|
||||
file,
|
||||
" <key>CFBundleVersion</key>\n <string>{}</string>\n",
|
||||
settings.version_string()
|
||||
)?;
|
||||
write!(
|
||||
file,
|
||||
" <key>CFBundleDevelopmentRegion</key>\n <string>en_US</string>\n"
|
||||
)?;
|
||||
|
||||
if !icon_filenames.is_empty() {
|
||||
write!(file, " <key>CFBundleIconFiles</key>\n <array>\n")?;
|
||||
for filename in icon_filenames {
|
||||
write!(file, " <string>{}</string>\n", filename)?;
|
||||
}
|
||||
write!(file, " </array>\n")?;
|
||||
write!(file, " <key>CFBundleIconFiles</key>\n <array>\n")?;
|
||||
for filename in icon_filenames {
|
||||
write!(file, " <string>{}</string>\n", filename)?;
|
||||
}
|
||||
write!(file, " </array>\n")?;
|
||||
}
|
||||
write!(file, " <key>LSRequiresIPhoneOS</key>\n <true/>\n")?;
|
||||
write!(file, "</dict>\n</plist>\n")?;
|
||||
file.flush()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
|
@ -134,8 +134,7 @@ exit 0",
|
|||
.current_dir(&bundle_dir.join("MacOS/"))
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.expect("Failed to chmod script");
|
||||
.spawn()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/// Try to determine the current target triple.
|
||||
///
|
||||
/// Returns a target triple (e.g. `x86_64-unknown-linux-gnu` or `i686-pc-windows-msvc`) or an
|
||||
/// `Error::Config` if the current config cannot be determined or is not some combination of the
|
||||
/// following values:
|
||||
/// `linux, mac, windows` -- `i686, x86, armv7` -- `gnu, musl, msvc`
|
||||
///
|
||||
/// * Errors:
|
||||
/// * Unexpected system config
|
||||
pub fn target_triple() -> Result<String, crate::Error> {
|
||||
let arch = if cfg!(target_arch = "x86") {
|
||||
"i686"
|
||||
} else if cfg!(target_arch = "x86_64") {
|
||||
"x86_64"
|
||||
} else if cfg!(target_arch = "arm") {
|
||||
"armv7"
|
||||
} else {
|
||||
return Err(crate::Error::from(
|
||||
"Unable to determine target-architecture",
|
||||
));
|
||||
};
|
||||
|
||||
let os = if cfg!(target_os = "linux") {
|
||||
"unknown-linux"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"apple-darwin"
|
||||
} else if cfg!(target_os = "windows") {
|
||||
"pc-windows"
|
||||
} else if cfg!(target_os = "freebsd") {
|
||||
"unknown-freebsd"
|
||||
} else {
|
||||
return Err(crate::Error::from("Unable to determine target-os"));
|
||||
};
|
||||
|
||||
let os = if cfg!(target_os = "macos") || cfg!(target_os = "freebsd") {
|
||||
String::from(os)
|
||||
} else {
|
||||
let env = if cfg!(target_env = "gnu") {
|
||||
"gnu"
|
||||
} else if cfg!(target_env = "musl") {
|
||||
"musl"
|
||||
} else if cfg!(target_env = "msvc") {
|
||||
"msvc"
|
||||
} else {
|
||||
return Err(crate::Error::from("Unable to determine target-environment"));
|
||||
};
|
||||
|
||||
format!("{}-{}", os, env)
|
||||
};
|
||||
|
||||
Ok(format!("{}-{}", arch, os))
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
use super::category::AppCategory;
|
||||
use crate::bundle::common;
|
||||
use crate::bundle::platform::target_triple;
|
||||
|
||||
use clap::ArgMatches;
|
||||
use error_chain::bail;
|
||||
use glob;
|
||||
use serde::Deserialize;
|
||||
use target_build_utils::TargetInfo;
|
||||
use tauri_utils::platform::target_triple;
|
||||
use toml;
|
||||
use walkdir;
|
||||
|
||||
|
@ -435,7 +435,7 @@ impl Settings {
|
|||
}
|
||||
|
||||
pub fn exception_domain(&self) -> Option<&String> {
|
||||
return self.bundle_settings.exception_domain.as_ref()
|
||||
return self.bundle_settings.exception_domain.as_ref();
|
||||
}
|
||||
|
||||
// copy external binaries to a path.
|
||||
|
|
|
@ -20,7 +20,6 @@ error_chain! {
|
|||
Walkdir(::walkdir::Error);
|
||||
StripError(std::path::StripPrefixError);
|
||||
ConvertError(std::num::TryFromIntError);
|
||||
PlatformError(::tauri_utils::Error);
|
||||
RegexError(::regex::Error) #[cfg(windows)];
|
||||
HttpError(::attohttpc::Error) #[cfg(windows)];
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ module.exports = {
|
|||
'security/detect-possible-timing-attacks': 'error',
|
||||
'security/detect-pseudoRandomBytes': 'error',
|
||||
'space-before-function-paren': 'off',
|
||||
'@typescript-eslint/default-param-last': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 0,
|
||||
'@typescript-eslint/space-before-function-paren': [
|
||||
'error',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tauri",
|
||||
"version": "0.4.3",
|
||||
"version": "0.4.4",
|
||||
"description": "Multi-binding collection of libraries and templates for building Tauri apps",
|
||||
"bin": {
|
||||
"tauri": "./bin/tauri.js"
|
||||
|
@ -107,7 +107,6 @@
|
|||
}
|
||||
},
|
||||
"lint-staged": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
"eslint --fix"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -61,7 +61,7 @@ const checkSrc = async (src: string): Promise<boolean | sharp.Sharp> => {
|
|||
process.exit(1)
|
||||
} else {
|
||||
const buffer = await readChunk(src, 0, 8)
|
||||
if (isPng(buffer) === true) {
|
||||
if (isPng(buffer)) {
|
||||
return (image = sharp(src))
|
||||
} else {
|
||||
image = false
|
||||
|
@ -309,7 +309,7 @@ const tauricon = (exports.tauricon = {
|
|||
// prevent overlay or pure
|
||||
block = true
|
||||
}
|
||||
if (block === true || options.splashscreen_type === 'generate') {
|
||||
if (block || options.splashscreen_type === 'generate') {
|
||||
await this.validate(src, target)
|
||||
if (!image) {
|
||||
process.exit(1)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
WixTools
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
|
|
@ -18,20 +18,32 @@
|
|||
* and also whitelist them based upon the developer's settings.
|
||||
*/
|
||||
|
||||
// makes the window.external.invoke API available after window.location.href changes
|
||||
if (navigator.platform != "Win64" && navigator.plaform != "Win32") {
|
||||
window.external = this
|
||||
if (navigator.platform == "MacIntel") {
|
||||
// makes the window.external.invoke API available after window.location.href changes
|
||||
|
||||
switch (navigator.platform) {
|
||||
case "Macintosh":
|
||||
case "MacPPC":
|
||||
case "MacIntel":
|
||||
case "Mac68K":
|
||||
window.external = this
|
||||
invoke = function (x) {
|
||||
webkit.messageHandlers.invoke.postMessage(x);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
case "Windows":
|
||||
case "WinCE":
|
||||
case "Win32":
|
||||
case "Win64":
|
||||
break;
|
||||
default:
|
||||
window.external = this
|
||||
invoke = function (x) {
|
||||
window.webkit.messageHandlers.external.postMessage(x);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 0x10000)
|
||||
.toString(16)
|
||||
|
@ -61,10 +73,10 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
|||
* @private
|
||||
*/
|
||||
var __whitelistWarning = function (func) {
|
||||
console.warn('%c[Tauri] Danger \ntauri.' + func + ' not whitelisted 💣\n%c\nAdd to tauri.conf.json: \n\ntauri: \n whitelist: { \n ' + func + ': true \n\nReference: https://github.com/tauri-apps/tauri/wiki' + func , 'background: red; color: white; font-weight: 800; padding: 2px; font-size:1.5em', ' ')
|
||||
return __reject()
|
||||
}
|
||||
<% } %>
|
||||
console.warn('%c[Tauri] Danger \ntauri.' + func + ' not whitelisted 💣\n%c\nAdd to tauri.conf.json: \n\ntauri: \n whitelist: { \n ' + func + ': true \n\nReference: https://github.com/tauri-apps/tauri/wiki' + func, 'background: red; color: white; font-weight: 800; padding: 2px; font-size:1.5em', ' ')
|
||||
return __reject()
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
/**
|
||||
|
@ -106,18 +118,18 @@ window.tauri = {
|
|||
listen: function listen(event, handler) {
|
||||
<% if (tauri.whitelist.event === true || tauri.whitelist.all === true) { %>
|
||||
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
this.invoke({
|
||||
cmd: 'listen',
|
||||
event: event,
|
||||
handler: window.tauri.transformCallback(handler, once),
|
||||
once: once
|
||||
});
|
||||
this.invoke({
|
||||
cmd: 'listen',
|
||||
event: event,
|
||||
handler: window.tauri.transformCallback(handler, once),
|
||||
once: once
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('event')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -130,17 +142,17 @@ window.tauri = {
|
|||
<% } %>
|
||||
emit: function emit(evt, payload) {
|
||||
<% if (tauri.whitelist.event === true || tauri.whitelist.all === true) { %>
|
||||
this.invoke({
|
||||
cmd: 'emit',
|
||||
event: evt,
|
||||
payload: payload || ''
|
||||
});
|
||||
this.invoke({
|
||||
cmd: 'emit',
|
||||
event: evt,
|
||||
payload: payload || ''
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('event')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -197,17 +209,17 @@ window.tauri = {
|
|||
<% } %>
|
||||
readTextFile: function readTextFile(path) {
|
||||
<% if (tauri.whitelist.readTextFile === true || tauri.whitelist.all === true) { %>
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'readTextFile',
|
||||
path: path
|
||||
});
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'readTextFile',
|
||||
path: path
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('readTextFile')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -221,17 +233,17 @@ window.tauri = {
|
|||
<% } %>
|
||||
readBinaryFile: function readBinaryFile(path) {
|
||||
<% if (tauri.whitelist.readBinaryFile === true || tauri.whitelist.all === true) { %>
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'readBinaryFile',
|
||||
path: path
|
||||
});
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'readBinaryFile',
|
||||
path: path
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('readBinaryFile')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -246,18 +258,18 @@ window.tauri = {
|
|||
<% } %>
|
||||
writeFile: function writeFile(cfg) {
|
||||
<% if (tauri.whitelist.writeFile === true || tauri.whitelist.all === true) { %>
|
||||
Object.freeze(cfg);
|
||||
this.invoke({
|
||||
cmd: 'writeFile',
|
||||
file: cfg.file,
|
||||
contents: cfg.contents
|
||||
});
|
||||
Object.freeze(cfg);
|
||||
this.invoke({
|
||||
cmd: 'writeFile',
|
||||
file: cfg.file,
|
||||
contents: cfg.contents
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('writeFile')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -272,17 +284,17 @@ window.tauri = {
|
|||
listFiles: function listFiles(path) {
|
||||
<% if (tauri.whitelist.listFiles === true || tauri.whitelist.all === true) { %>
|
||||
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'listFiles',
|
||||
path: path
|
||||
});
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'listFiles',
|
||||
path: path
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('listDirs')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -296,17 +308,17 @@ window.tauri = {
|
|||
<% } %>
|
||||
listDirs: function listDirs(path) {
|
||||
<% if (tauri.whitelist.listDirs === true || tauri.whitelist.all === true) { %>
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'listDirs',
|
||||
path: path
|
||||
});
|
||||
Object.freeze(path);
|
||||
return this.promisified({
|
||||
cmd: 'listDirs',
|
||||
path: path
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('listDirs')
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -318,17 +330,17 @@ window.tauri = {
|
|||
<% } %>
|
||||
setTitle: function setTitle(title) {
|
||||
<% if (tauri.whitelist.setTitle === true || tauri.whitelist.all === true) { %>
|
||||
Object.freeze(title);
|
||||
this.invoke({
|
||||
cmd: 'setTitle',
|
||||
title: title
|
||||
});
|
||||
Object.freeze(title);
|
||||
this.invoke({
|
||||
cmd: 'setTitle',
|
||||
title: title
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('setTitle')
|
||||
<% } %>
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -340,17 +352,17 @@ window.tauri = {
|
|||
<% } %>
|
||||
open: function open(uri) {
|
||||
<% if (tauri.whitelist.open === true || tauri.whitelist.all === true) { %>
|
||||
Object.freeze(uri);
|
||||
this.invoke({
|
||||
cmd: 'open',
|
||||
uri: uri
|
||||
});
|
||||
Object.freeze(uri);
|
||||
this.invoke({
|
||||
cmd: 'open',
|
||||
uri: uri
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('open')
|
||||
<% } %>
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
<% if (ctx.dev) { %>
|
||||
|
@ -366,26 +378,26 @@ window.tauri = {
|
|||
execute: function execute(command, args) {
|
||||
<% if (tauri.whitelist.execute === true || tauri.whitelist.all === true) { %>
|
||||
|
||||
Object.freeze(command);
|
||||
Object.freeze(command);
|
||||
|
||||
if (typeof args === 'string' || _typeof(args) === 'object') {
|
||||
Object.freeze(args);
|
||||
}
|
||||
if (typeof args === 'string' || _typeof(args) === 'object') {
|
||||
Object.freeze(args);
|
||||
}
|
||||
|
||||
return this.promisified({
|
||||
cmd: 'execute',
|
||||
command: command,
|
||||
args: typeof args === 'string' ? [args] : args
|
||||
});
|
||||
return this.promisified({
|
||||
cmd: 'execute',
|
||||
command: command,
|
||||
args: typeof args === 'string' ? [args] : args
|
||||
});
|
||||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('execute')
|
||||
<% } %>
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
bridge: function bridge(command, payload) {
|
||||
bridge: function bridge(command, payload) {
|
||||
<% if (tauri.whitelist.bridge === true || tauri.whitelist.all === true) { %>
|
||||
|
||||
Object.freeze(command);
|
||||
|
@ -402,18 +414,18 @@ window.tauri = {
|
|||
<% } else { %>
|
||||
<% if (ctx.dev) { %>
|
||||
return __whitelistWarning('bridge')
|
||||
<% } %>
|
||||
<% } %>
|
||||
return __reject()
|
||||
<% } %>
|
||||
<% } %>
|
||||
},
|
||||
|
||||
loadAsset: function loadAsset(assetName, assetType) {
|
||||
return this.promisified({
|
||||
cmd: 'loadAsset',
|
||||
asset: assetName,
|
||||
asset_type: assetType || 'unknown'
|
||||
})
|
||||
}
|
||||
loadAsset: function loadAsset(assetName, assetType) {
|
||||
return this.promisified({
|
||||
cmd: 'loadAsset',
|
||||
asset: assetName,
|
||||
asset_type: assetType || 'unknown'
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// init tauri API
|
||||
|
@ -443,8 +455,8 @@ document.addEventListener('error', function (e) {
|
|||
}
|
||||
}, true)
|
||||
|
||||
// open <a href="..."> links with the Tauri API
|
||||
function __openLinks () {
|
||||
// open <a href="..."> links with the Tauri API
|
||||
function __openLinks() {
|
||||
document.querySelector('body').addEventListener('click', function (e) {
|
||||
var target = e.target
|
||||
while (target != null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tauri-api"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
authors = ["Lucas Fernandes Gonçalves Nogueira <lucas@quasar.dev>", "Daniel Thompson-Yvetot <denjell@sfosc.org>", "Tensor Programming <tensordeveloper@gmail.com>"]
|
||||
license = "MIT"
|
||||
homepage = "https://tauri.studio"
|
||||
|
|
|
@ -28,9 +28,7 @@ pub fn format_command(path: String, command: String) -> String {
|
|||
pub fn relative_command(command: String) -> crate::Result<String> {
|
||||
match std::env::current_exe()?.parent() {
|
||||
Some(exe_dir) => Ok(format_command(exe_dir.display().to_string(), command)),
|
||||
None => {
|
||||
Err(crate::ErrorKind::Command("Could not evaluate executable dir".to_string()).into())
|
||||
}
|
||||
None => Err(crate::ErrorKind::Command("Could not evaluate executable dir".to_string()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tauri-updater"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = ["Lucas Fernandes Gonçalves Nogueira <lucas@quasar.dev>", "Daniel Thompson-Yvetot <denjell@sfosc.org>", "Tensor Programming <tensordeveloper@gmail.com>"]
|
||||
license = "MIT"
|
||||
homepage = "https://tauri.studio"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tauri-utils"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = ["Lucas Fernandes Gonçalves Nogueira <lucas@quasar.dev>", "Daniel Thompson-Yvetot <denjell@sfosc.org>", "Tensor Programming <tensordeveloper@gmail.com>"]
|
||||
license = "MIT"
|
||||
homepage = "https://tauri.studio"
|
||||
|
|
|
@ -34,9 +34,8 @@ pub fn target_triple() -> Result<String, crate::Error> {
|
|||
return Err(crate::Error::from("Unable to determine target-os"));
|
||||
};
|
||||
|
||||
let s;
|
||||
let os = if cfg!(target_os = "macos") || cfg!(target_os = "freebsd") {
|
||||
os
|
||||
String::from(os)
|
||||
} else {
|
||||
let env = if cfg!(target_env = "gnu") {
|
||||
"gnu"
|
||||
|
@ -47,8 +46,8 @@ pub fn target_triple() -> Result<String, crate::Error> {
|
|||
} else {
|
||||
return Err(crate::Error::from("Unable to determine target-environment"));
|
||||
};
|
||||
s = format!("{}-{}", os, env);
|
||||
&s
|
||||
|
||||
format!("{}-{}", os, env)
|
||||
};
|
||||
|
||||
Ok(format!("{}-{}", arch, os))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tauri"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
authors = ["Lucas Fernandes Gonçalves Nogueira <lucas@quasar.dev>", "Daniel Thompson-Yvetot <denjell@sfosc.org>", "Tensor Programming <tensordeveloper@gmail.com>"]
|
||||
license = "MIT"
|
||||
homepage = "https://tauri.studio"
|
||||
|
|
Loading…
Reference in New Issue