refactor(examples): remove unused files (#3762)

This commit is contained in:
Lucas Fernandes Nogueira 2022-03-23 16:45:43 -07:00 committed by GitHub
parent 55c8680590
commit f1637d62df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
76 changed files with 158 additions and 4024 deletions

View File

@ -266,39 +266,39 @@ icon-png = [ "infer", "png" ]
[[example]]
name = "commands"
path = "../../examples/commands/src-tauri/src/main.rs"
path = "../../examples/commands/main.rs"
[[example]]
name = "helloworld"
path = "../../examples/helloworld/src-tauri/src/main.rs"
path = "../../examples/helloworld/main.rs"
[[example]]
name = "multiwindow"
path = "../../examples/multiwindow/src-tauri/src/main.rs"
path = "../../examples/multiwindow/main.rs"
required-features = [ "window-create" ]
[[example]]
name = "parent-window"
path = "../../examples/parent-window/src-tauri/src/main.rs"
path = "../../examples/parent-window/main.rs"
[[example]]
name = "navigation"
path = "../../examples/navigation/src-tauri/src/main.rs"
path = "../../examples/navigation/main.rs"
required-features = [ "window-create" ]
[[example]]
name = "splashscreen"
path = "../../examples/splashscreen/src-tauri/src/main.rs"
path = "../../examples/splashscreen/main.rs"
[[example]]
name = "state"
path = "../../examples/state/src-tauri/src/main.rs"
path = "../../examples/state/main.rs"
[[example]]
name = "streaming"
path = "../../examples/streaming/src-tauri/src/main.rs"
path = "../../examples/streaming/main.rs"
[[example]]
name = "isolation"
path = "../../examples/isolation/src-tauri/src/main.rs"
path = "../../examples/isolation/main.rs"
required-features = [ "isolation" ]

View File

@ -870,6 +870,10 @@ mod test {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUldUTE5QWWxkQnlZOVJZVGdpKzJmRWZ0SkRvWS9TdFpqTU9xcm1mUmJSSG5OWVlwSklrWkN1SFpWbmh4SDlBcTU3SXpjbm0xMmRjRkphbkpVeGhGcTdrdzlrWGpGVWZQSWdzPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNTkyOTE1MDU3CWZpbGU6L1VzZXJzL3J1bm5lci9ydW5uZXJzLzIuMjYzLjAvd29yay90YXVyaS90YXVyaS90YXVyaS9leGFtcGxlcy9jb21tdW5pY2F0aW9uL3NyYy10YXVyaS90YXJnZXQvZGVidWcvYnVuZGxlL29zeC9hcHAuYXBwLnRhci5negp4ZHFlUkJTVnpGUXdDdEhydTE5TGgvRlVPeVhjTnM5RHdmaGx3c0ZPWjZXWnFwVDRNWEFSbUJTZ1ZkU1IwckJGdmlwSzJPd00zZEZFN2hJOFUvL1FDZz09Cg==",
"url": "https://github.com/lemarier/tauri-test/releases/download/v1.0.0/app.app.tar.gz"
},
"darwin-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUldUTE5QWWxkQnlZOVJZVGdpKzJmRWZ0SkRvWS9TdFpqTU9xcm1mUmJSSG5OWVlwSklrWkN1SFpWbmh4SDlBcTU3SXpjbm0xMmRjRkphbkpVeGhGcTdrdzlrWGpGVWZQSWdzPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNTkyOTE1MDU3CWZpbGU6L1VzZXJzL3J1bm5lci9ydW5uZXJzLzIuMjYzLjAvd29yay90YXVyaS90YXVyaS90YXVyaS9leGFtcGxlcy9jb21tdW5pY2F0aW9uL3NyYy10YXVyaS90YXJnZXQvZGVidWcvYnVuZGxlL29zeC9hcHAuYXBwLnRhci5negp4ZHFlUkJTVnpGUXdDdEhydTE5TGgvRlVPeVhjTnM5RHdmaGx3c0ZPWjZXWnFwVDRNWEFSbUJTZ1ZkU1IwckJGdmlwSzJPd00zZEZFN2hJOFUvL1FDZz09Cg==",
"url": "https://github.com/lemarier/tauri-test/releases/download/v1.0.0/app.app.tar.gz"
},
"linux-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUldUTE5QWWxkQnlZOWZSM29hTFNmUEdXMHRoOC81WDFFVVFRaXdWOUdXUUdwT0NlMldqdXkyaWVieXpoUmdZeXBJaXRqSm1YVmczNXdRL1Brc0tHb1NOTzhrL1hadFcxdmdnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNTkyOTE3MzQzCWZpbGU6L2hvbWUvcnVubmVyL3dvcmsvdGF1cmkvdGF1cmkvdGF1cmkvZXhhbXBsZXMvY29tbXVuaWNhdGlvbi9zcmMtdGF1cmkvdGFyZ2V0L2RlYnVnL2J1bmRsZS9hcHBpbWFnZS9hcHAuQXBwSW1hZ2UudGFyLmd6CmRUTUM2bWxnbEtTbUhOZGtERUtaZnpUMG5qbVo5TGhtZWE1SFNWMk5OOENaVEZHcnAvVW0zc1A2ajJEbWZUbU0yalRHT0FYYjJNVTVHOHdTQlYwQkF3PT0K",
"url": "https://github.com/lemarier/tauri-test/releases/download/v1.0.0/app.AppImage.tar.gz"
@ -945,7 +949,6 @@ mod test {
.url(mockito::server_url())
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -965,7 +968,6 @@ mod test {
.url(mockito::server_url())
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -986,7 +988,6 @@ mod test {
.url(mockito::server_url())
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -1012,7 +1013,6 @@ mod test {
.url(mockito::server_url())
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(!updater.should_update);
@ -1039,7 +1039,6 @@ mod test {
))
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -1070,7 +1069,6 @@ mod test {
)
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -1086,7 +1084,6 @@ mod test {
.to_string()])
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -1114,7 +1111,6 @@ mod test {
))
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(updater.should_update);
@ -1141,7 +1137,6 @@ mod test {
))
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check update");
assert!(!updater.should_update);
@ -1162,7 +1157,6 @@ mod test {
.current_version("0.0.1")
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check remote update");
assert!(updater.should_update);
@ -1182,7 +1176,6 @@ mod test {
.current_version("0.0.1")
.build());
assert!(check_update.is_ok());
let updater = check_update.expect("Can't check remote update");
assert!(updater.should_update);
@ -1293,9 +1286,6 @@ mod test {
env::set_var("APPIMAGE", my_executable);
}
// make sure the process worked
assert!(check_update.is_ok());
// unwrap our results
let updater = check_update.expect("Can't check remote update");

View File

@ -188,7 +188,7 @@ fn main() {
async_stateful_command_with_result,
])
.run(tauri::generate_context!(
"../../examples/commands/src-tauri/tauri.conf.json"
"../../examples/commands/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -1,7 +0,0 @@
{
"name": "state",
"version": "1.0.0",
"scripts": {
"tauri": "node ../../tooling/cli/node/tauri.js"
}
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,18 +0,0 @@
[package]
name = "commands"
version = "0.1.0"
description = "A simple Tauri Application showcasing the commands API"
edition = "2021"
rust-version = "1.57"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../core/tauri", features = [] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": ["../index.html"],
"devPath": ["../index.html"],
"distDir": ["index.html"],
"devPath": ["index.html"],
"beforeDevCommand": "",
"beforeBuildCommand": "",
"withGlobalTauri": true
@ -12,11 +12,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -10,7 +10,7 @@
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!(
"../../examples/helloworld/src-tauri/tauri.conf.json"
"../../examples/helloworld/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -1,7 +0,0 @@
{
"name": "hello-world",
"version": "1.0.0",
"scripts": {
"tauri": "node ../../tooling/cli/node/tauri.js"
}
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,18 +0,0 @@
[package]
name = "helloworld"
version = "0.1.0"
description = "A very simple Tauri Appplication"
edition = "2021"
rust-version = "1.57"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../core/tauri", features = [] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": ["../index.html"],
"devPath": ["../index.html"],
"distDir": ["index.html"],
"devPath": ["index.html"],
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
@ -11,11 +11,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -0,0 +1,3 @@
# Isolation Example
To execute run the following on the root directory of the repository: `cargo run --example isolation --features isolation`.

View File

@ -24,7 +24,7 @@ fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![ping])
.run(tauri::generate_context!(
"../../examples/isolation/src-tauri/tauri.conf.json"
"../../examples/isolation/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -1,10 +0,0 @@
{
"name": "isolation",
"license": "Apache-2.0 OR MIT",
"scripts": {
"tauri": "node ../../tooling/cli/node/tauri.js"
},
"dependencies": {
"@tauri-apps/api": "../../tooling/api/dist"
}
}

View File

@ -1,5 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools
.cargo

View File

@ -1 +0,0 @@
../../../.license_template

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
[package]
name = "app"
version = "0.1.0"
description = "An example Tauri Application showcasing the isolation pattern"
edition = "2021"
license = "Apache-2.0 OR MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "isolation" ] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { path = "../../../core/tauri", features = [ "isolation" ] }
[features]
default = [ "custom-protocol", "isolation" ]
isolation = [ "tauri/isolation", "tauri-build/isolation" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1 +0,0 @@
../../../LICENSE_APACHE-2.0

View File

@ -1 +0,0 @@
../../../LICENSE_MIT

View File

@ -1,13 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
)
.expect("could not build tauri application");
}

View File

@ -4,8 +4,8 @@
"version": "0.1.0"
},
"build": {
"distDir": "../dist",
"devPath": "../dist",
"distDir": "dist",
"devPath": "dist",
"beforeDevCommand": "",
"beforeBuildCommand": "",
"withGlobalTauri": true
@ -14,7 +14,7 @@
"pattern": {
"use": "isolation",
"options": {
"dir": "../isolation-dist"
"dir": "isolation-dist"
}
},
"bundle": {
@ -22,11 +22,11 @@
"targets": "all",
"identifier": "com.tauri.isolation",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -1,13 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@tauri-apps/api@../../tooling/api/dist":
version "1.0.0-rc.0"
dependencies:
type-fest "2.5.1"
type-fest@2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.5.1.tgz#17ba4f36a6abfabf0a92005d045dca77564607b0"
integrity sha512-JDcsxbLR6Z6OcL7TnGAAAGQrY4g7Q4EEALMT4Kp6FQuIc0JLQvOF3l7ejFvx8o5GmLlfMseTWUL++sYFP+o8kw==

View File

@ -26,7 +26,7 @@ fn main() {
)
.unwrap() // safe to unwrap: window label is valid
.run(tauri::generate_context!(
"../../examples/multiwindow/src-tauri/tauri.conf.json"
"../../examples/multiwindow/tauri.conf.json"
))
.expect("failed to run tauri application");
}

View File

@ -1,11 +0,0 @@
{
"name": "multiwindow-example",
"version": "1.0.0",
"description": "A Tauri example showcasing Tauri's multiwindow ability",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"tauri": "node ../../tooling/cli/node/tauri.js"
},
"private": true
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,17 +0,0 @@
[package]
name = "multiwindow"
version = "0.1.0"
description = "An example Tauri Multi-Window Application"
edition = "2021"
rust-version = "1.57"
license = "Apache-2.0 OR MIT"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build" }
[dependencies]
tauri = { path = "../../../core/tauri", features = ["window-create"] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": ["../index.html"],
"devPath": ["../index.html"],
"distDir": ["index.html"],
"devPath": ["index.html"],
"withGlobalTauri": true
},
"tauri": {
@ -10,11 +10,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

View File

@ -2,4 +2,4 @@
A very simple Tauri Appplication with frontend navigation.
To execute run the following on the root directory of the repository: `cargo run --example navigation`.
To execute run the following on the root directory of the repository: `cargo run --example navigation --features window-create`.

View File

@ -10,7 +10,7 @@
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!(
"../../examples/navigation/src-tauri/tauri.conf.json"
"../../examples/navigation/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -1,7 +0,0 @@
{
"name": "navigation",
"version": "1.0.0",
"scripts": {
"tauri": "node ../../tooling/cli/node/tauri.js"
}
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,18 +0,0 @@
[package]
name = "navigation"
version = "0.1.0"
description = "A very simple Tauri Appplication with navigation"
edition = "2021"
rust-version = "1.57"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../core/tauri", features = ["window-create"] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": "../public",
"devPath": "../public",
"distDir": "public",
"devPath": "public",
"beforeDevCommand": "",
"beforeBuildCommand": "",
"withGlobalTauri": true
@ -12,11 +12,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -7,9 +7,26 @@
windows_subsystem = "windows"
)]
use tauri::{WindowBuilder, WindowUrl};
#[cfg(any(windows, target_os = "macos"))]
use tauri::Manager;
use tauri::{command, window, AppHandle, WindowBuilder, WindowUrl};
mod commands;
#[command]
fn create_child_window(id: String, app: AppHandle) {
#[cfg(any(windows, target_os = "macos"))]
let main = app.get_window("main").unwrap();
let child = window::WindowBuilder::new(&app, id, WindowUrl::default())
.title("Child")
.inner_size(400.0, 300.0);
#[cfg(target_os = "macos")]
let child = child.parent_window(main.ns_window().unwrap());
#[cfg(windows)]
let child = child.parent_window(main.hwnd().unwrap());
child.build().unwrap();
}
fn main() {
tauri::Builder::default()
@ -19,7 +36,7 @@ fn main() {
println!("got 'clicked' event on window '{}'", label);
});
})
.invoke_handler(tauri::generate_handler![commands::create_child_window])
.invoke_handler(tauri::generate_handler![create_child_window])
.create_window(
"main".to_string(),
WindowUrl::default(),
@ -32,7 +49,7 @@ fn main() {
)
.unwrap() // safe to unwrap: window label is valid
.run(tauri::generate_context!(
"../../examples/parent-window/src-tauri/tauri.conf.json"
"../../examples/parent-window/tauri.conf.json"
))
.expect("failed to run tauri application");
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,17 +0,0 @@
[package]
name = "parent-window"
version = "0.1.0"
description = "An example Tauri Multi-Window Application"
edition = "2021"
rust-version = "1.57"
license = "Apache-2.0 OR MIT"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build" }
[dependencies]
tauri = { path = "../../../core/tauri" }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,22 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri::{command, window, AppHandle, Manager, WindowUrl};
#[command]
pub fn create_child_window(id: String, app: AppHandle) {
#[cfg(any(windows, target_os = "macos"))]
let main = app.get_window("main").unwrap();
let child = window::WindowBuilder::new(&app, id, WindowUrl::default())
.title("Child")
.inner_size(400.0, 300.0);
#[cfg(target_os = "macos")]
let child = child.parent_window(main.ns_window().unwrap());
#[cfg(windows)]
let child = child.parent_window(main.hwnd().unwrap());
child.build().unwrap();
}

View File

@ -1,11 +1,7 @@
{
"build": {
"distDir": [
"../index.html"
],
"devPath": [
"../index.html"
],
"distDir": ["index.html"],
"devPath": ["index.html"],
"withGlobalTauri": true
},
"tauri": {
@ -14,11 +10,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -1,5 +1,43 @@
# Resource example
This example demonstrates the Tauri bundle resources functionality. The example adds `src-tauri/assets/index.js` as a resource (defined on `tauri.conf.json > tauri > bundle > resources`) and executes it using `Node.js`, locating the JavaScript file using the `tauri::api::path::resolve_path` API.
This example demonstrates the Tauri bundle resources functionality. The example adds `src-tauri/assets/index.js` as a resource (defined on `tauri.conf.json > tauri > bundle > resources`) and executes it using `Node.js`, locating the JavaScript file using the `tauri::App::path_resolver` APIs.
To execute run the following on the root directory of the repository: `cargo run --example resources`.
## Running the example
- Compile Tauri
go to root of the Tauri repo and run:
Linux / Mac:
```
# choose to install node cli (1)
bash .scripts/setup.sh
```
Windows:
```
./.scripts/setup.ps1
```
- Install dependencies (Run inside of this folder `examples/resources/`)
```bash
# with yarn
$ yarn
# with npm
$ npm install
$ yarn tauri
$ yarn package
```
- Run the app in development mode (Run inside of this folder `examples/resources/`)
```bash
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
```
- Build an run the release app (Run inside of this folder `examples/resources/`)
```bash
$ yarn tauri build
$ ./src-tauri/target/release/app
```

View File

@ -7,8 +7,5 @@ This example demonstrates how a splashscreen can be implemented when waiting on
Run the following scripts on the root directory of the repository:
```bash
# runs the example that wait on a Rust initialization script to show the main window
$ cargo run --example splashscreen
# runs the example that wait on the UI to load to show the main window
$ cargo run --example splashscreen --features ui
```

View File

@ -8,7 +8,6 @@
)]
// Application code for a splashscreen system that waits on a Rust initialization script
#[cfg(not(feature = "ui"))]
mod rust {
use std::{thread::sleep, time::Duration};
use tauri::Manager;
@ -36,14 +35,13 @@ mod rust {
})
.invoke_handler(tauri::generate_handler![close_splashscreen])
.run(tauri::generate_context!(
"../../examples/splashscreen/src-tauri/tauri.conf.json"
"../../examples/splashscreen/tauri.conf.json"
))
.expect("failed to run app");
}
}
// Application code for a splashscreen system that waits for the UI
#[cfg(feature = "ui")]
mod ui {
use std::sync::{Arc, Mutex};
use tauri::{Manager, State, Window};
@ -79,15 +77,18 @@ mod ui {
})
.invoke_handler(tauri::generate_handler![close_splashscreen])
.run(tauri::generate_context!(
"../../examples/splashscreen/src-tauri/tauri.conf.json"
"../../examples/splashscreen/tauri.conf.json"
))
.expect("error while running tauri application");
}
}
fn main() {
#[cfg(feature = "ui")]
ui::main();
#[cfg(not(feature = "ui"))]
rust::main();
// toggle this flag to experiment with different splashscreen usages
let ui = false;
if ui {
ui::main();
} else {
rust::main();
}
}

View File

@ -1,11 +0,0 @@
{
"name": "splashscreen-example",
"version": "1.0.0",
"description": "A Tauri example showcasing Tauri's multiwindow ability with a splashscreen",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"tauri": "node ../../tooling/cli/node/tauri.js"
},
"private": true
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,18 +0,0 @@
[package]
name = "splashscreen"
version = "0.1.0"
description = "An example Tauri Application with a splashscreen"
edition = "2021"
rust-version = "1.57"
license = "Apache-2.0 OR MIT"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build" }
[dependencies]
tauri = { path = "../../../core/tauri", features = [] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]
ui = []

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": "../dist",
"devPath": "../dist",
"distDir": "dist",
"devPath": "dist",
"withGlobalTauri": true
},
"tauri": {
@ -10,11 +10,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

View File

@ -82,7 +82,7 @@ fn main() {
connection_send
])
.run(tauri::generate_context!(
"../../examples/state/src-tauri/tauri.conf.json"
"../../examples/state/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -1,7 +0,0 @@
{
"name": "hello-world",
"version": "1.0.0",
"scripts": {
"tauri": "ncargo tauri"
}
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,18 +0,0 @@
[package]
name = "state"
version = "0.1.0"
description = "A simple Tauri Appplication showcase the state functionality"
edition = "2021"
rust-version = "1.57"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../core/tauri", features = [] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": ["../index.html"],
"devPath": ["../index.html"],
"distDir": ["index.html"],
"devPath": ["index.html"],
"beforeDevCommand": "",
"beforeBuildCommand": "",
"withGlobalTauri": true
@ -12,11 +12,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],

View File

@ -110,7 +110,7 @@ fn main() {
response.mimetype("video/mp4").status(status_code).body(buf)
})
.run(tauri::generate_context!(
"../../examples/streaming/src-tauri/tauri.conf.json"
"../../examples/streaming/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -1,7 +0,0 @@
{
"name": "streaming",
"version": "1.0.0",
"scripts": {
"tauri": "node ../../tooling/cli/node/tauri.js"
}
}

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,18 +0,0 @@
[package]
name = "streaming"
version = "0.1.0"
description = "A very simple Tauri Appplication"
edition = "2021"
rust-version = "1.57"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../core/tauri", features = [] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -1,14 +0,0 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri_build::{try_build, Attributes, WindowsAttributes};
fn main() {
if let Err(error) = try_build(
Attributes::new()
.windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")),
) {
panic!("error found during tauri-build: {:#?}", error);
}
}

View File

@ -1,7 +1,7 @@
{
"build": {
"distDir": ["../index.html"],
"devPath": ["../index.html"],
"distDir": ["index.html"],
"devPath": ["index.html"],
"beforeDevCommand": "",
"beforeBuildCommand": "",
"withGlobalTauri": true
@ -12,11 +12,11 @@
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"../../.icons/32x32.png",
"../../.icons/128x128.png",
"../../.icons/128x128@2x.png",
"../../.icons/icon.icns",
"../../.icons/icon.ico"
"../.icons/32x32.png",
"../.icons/128x128.png",
"../.icons/128x128@2x.png",
"../.icons/icon.icns",
"../.icons/icon.ico"
],
"resources": [],
"externalBin": [],