Skip to content

Commit

Permalink
feat: Update to tauri v2-beta (#589)
Browse files Browse the repository at this point in the history
* feat: Update to tauri v2-beta

* changefile

* make --alpha alias for --beta

* wording

* Update tauri-beta-0.md
  • Loading branch information
FabianLars authored Feb 4, 2024
1 parent 1b1834c commit 4dbdcc9
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 47 deletions.
6 changes: 6 additions & 0 deletions .changes/tauri-beta-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-tauri-app": minor
"create-tauri-app-js": minor
---

Updated the templates to Tauri v2 beta.
11 changes: 8 additions & 3 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub fn parse(argv: Vec<OsString>, bin_name: Option<String>) -> anyhow::Result<Ar
{GREEN}-t{RESET}, {GREEN}--template <TEMPLATE>{RESET} Specify the UI template to use [{templates}]
{GREEN}-y{RESET}, {GREEN}--yes{RESET} Skip prompts and use defaults where applicable
{GREEN}-f{RESET}, {GREEN}--force{RESET} Force create the directory even if it is not empty.
{GREEN}--alpha{RESET} Bootstraps a project using [email protected]
{GREEN}--mobile{RESET} Bootstraps a mobile project too. Only availabe with `--alpha` option.
{GREEN}--beta{RESET} Bootstraps a project using [email protected]
{GREEN}--mobile{RESET} Bootstraps a mobile project too. Only availabe with `--beta` option.
{GREEN}-h{RESET}, {GREEN}--help{RESET} Prints help information
{GREEN}-v{RESET}, {GREEN}--version{RESET} Prints version information
"#,
Expand All @@ -82,13 +82,18 @@ pub fn parse(argv: Vec<OsString>, bin_name: Option<String>) -> anyhow::Result<Ar
println!("{}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
if pargs.contains("--alpha") {
eprintln!(
"{BOLD}{YELLOW}warning{RESET}: The `{GREEN}--alpha{RESET}` option is now an alias for `{GREEN}--beta{RESET}` and may be removed in the future."
);
}

let args = Args {
manager: pargs.opt_value_from_str(["-m", "--manager"])?,
template: pargs.opt_value_from_str(["-t", "--template"])?,
skip: pargs.contains(["-y", "--yes"]),
force: pargs.contains(["-f", "--force"]),
alpha: pargs.contains("--alpha"),
alpha: pargs.contains("--alpha") || pargs.contains("--beta"),
mobile: if pargs.contains("--mobile") {
Some(true)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub fn print_missing_deps(pkg_manager: PackageManager, template: Template, alpha
Dep {
name: "Tauri CLI",
instruction: if alpha {
format!("Run `{BLUE}{BOLD}cargo install tauri-cli --version '^2.0.0-alpha'{RESET}`")
format!("Run `{BLUE}{BOLD}cargo install tauri-cli --version '^2.0.0-beta'{RESET}`")
} else {
format!("Run `{BLUE}{BOLD}cargo install tauri-cli{RESET}`")
},
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ where
} = args;
let cwd = std::env::current_dir()?;

// Allow `--mobile` to only be used with `--alpha` for now
// Allow `--mobile` to only be used with `--beta` for now
// TODO: remove this limitation once tauri@v2 is stable
if let Some(mobile) = mobile {
if mobile && !alpha {
eprintln!(
"{BOLD}{RED}error{RESET}: `{GREEN}--mobile{RESET}` option is only available if `{GREEN}--alpha{RESET}` option is also used"
"{BOLD}{RED}error{RESET}: `{GREEN}--mobile{RESET}` option is only available if `{GREEN}--beta{RESET}` option is also used"
);
exit(1);
}
Expand Down Expand Up @@ -280,7 +280,7 @@ where
};

// Prompt for wether to bootstrap a mobile-friendly tauri project
// This should only be prompted if `--alpha` is used on the command line and `--mobile` wasn't.
// This should only be prompted if `--beta` is used on the command line and `--mobile` wasn't.
// TODO: remove this limitation once tauri@v2 is stable
let mobile = match mobile {
Some(mobile) => mobile,
Expand Down
6 changes: 3 additions & 3 deletions templates/_base_/src-tauri/Cargo.toml.lte
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ tauri-build = { version = "1.5", features = [] }
[dependencies]
tauri = { version = "1.5", features = ["shell-open"] }
serde = { version = "1.0", features = ["derive"] }{% else %}[build-dependencies]
tauri-build = { version = "2.0.0-alpha", features = [] }
tauri-build = { version = "2.0.0-beta", features = [] }

[dependencies]
tauri = { version = "2.0.0-alpha", features = [] }
tauri-plugin-shell = "2.0.0-alpha"{% endif %}
tauri = { version = "2.0.0-beta", features = [] }
tauri-plugin-shell = "2.0.0-beta"{% endif %}
serde_json = "1.0"

[features]
Expand Down
16 changes: 16 additions & 0 deletions templates/_base_/src-tauri/capabilities/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "./schemas/desktop-schema.json",
"identifier": "main-capability",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"path:default",
"event:default",
"window:default",
"app:default",
"resources:default",
"menu:default",
"tray:default",
"shell:open"
]
}
6 changes: 3 additions & 3 deletions templates/template-angular/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.2",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.0",
Expand All @@ -36,7 +36,7 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.2.2",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-preact-ts/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
},
"dependencies": {
"preact": "^10.16.0",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@preact/preset-vite": "^2.5.0",
"typescript": "^5.0.2",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-preact/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"dependencies": {
"preact": "^10.16.0",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@preact/preset-vite": "^2.5.0",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-react-ts/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "^5.0.2",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-react/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-solid-ts/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"license": "MIT",
"dependencies": {
"solid-js": "^1.7.8",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"typescript": "^5.0.2",
"vite": "^5.0.0",
"vite-plugin-solid": "^2.8.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-solid/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"license": "MIT",
"dependencies": {
"solid-js": "^1.7.8",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"vite": "^5.0.0",
"vite-plugin-solid": "^2.8.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-svelte-ts/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
Expand All @@ -22,7 +22,7 @@
"tslib": "^2.6.0",
"typescript": "^5.0.2",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-svelte/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"svelte": "^4.2.8",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-vanilla-ts/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %},
"vite": "^5.0.0",
"typescript": "^5.0.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"tauri": "tauri"
},
"devDependencies": {
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"
}
}
6 changes: 3 additions & 3 deletions templates/template-vue-ts/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
},
"dependencies": {
"vue": "^3.3.4",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.3",
"typescript": "^5.0.2",
"vite": "^5.0.0",
"vue-tsc": "^1.8.5",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}
6 changes: 3 additions & 3 deletions templates/template-vue/package.json.lte
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"dependencies": {
"vue": "^3.3.4",
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.3",
"vite": "^5.0.0",
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
"internal-ip": "^7.0.0"{% endif %}
}
}

0 comments on commit 4dbdcc9

Please sign in to comment.