Skip to content

Commit 4dbdcc9

Browse files
authored
feat: Update to tauri v2-beta (#589)
* feat: Update to tauri v2-beta * changefile * make --alpha alias for --beta * wording * Update tauri-beta-0.md
1 parent 1b1834c commit 4dbdcc9

19 files changed

Lines changed: 74 additions & 47 deletions

File tree

.changes/tauri-beta-0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-tauri-app": minor
3+
"create-tauri-app-js": minor
4+
---
5+
6+
Updated the templates to Tauri v2 beta.

src/args.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ pub fn parse(argv: Vec<OsString>, bin_name: Option<String>) -> anyhow::Result<Ar
5454
{GREEN}-t{RESET}, {GREEN}--template <TEMPLATE>{RESET} Specify the UI template to use [{templates}]
5555
{GREEN}-y{RESET}, {GREEN}--yes{RESET} Skip prompts and use defaults where applicable
5656
{GREEN}-f{RESET}, {GREEN}--force{RESET} Force create the directory even if it is not empty.
57-
{GREEN}--alpha{RESET} Bootstraps a project using tauri@2.0-alpha
58-
{GREEN}--mobile{RESET} Bootstraps a mobile project too. Only availabe with `--alpha` option.
57+
{GREEN}--beta{RESET} Bootstraps a project using tauri@2.0-alpha
58+
{GREEN}--mobile{RESET} Bootstraps a mobile project too. Only availabe with `--beta` option.
5959
{GREEN}-h{RESET}, {GREEN}--help{RESET} Prints help information
6060
{GREEN}-v{RESET}, {GREEN}--version{RESET} Prints version information
6161
"#,
@@ -82,13 +82,18 @@ pub fn parse(argv: Vec<OsString>, bin_name: Option<String>) -> anyhow::Result<Ar
8282
println!("{}", env!("CARGO_PKG_VERSION"));
8383
std::process::exit(0);
8484
}
85+
if pargs.contains("--alpha") {
86+
eprintln!(
87+
"{BOLD}{YELLOW}warning{RESET}: The `{GREEN}--alpha{RESET}` option is now an alias for `{GREEN}--beta{RESET}` and may be removed in the future."
88+
);
89+
}
8590

8691
let args = Args {
8792
manager: pargs.opt_value_from_str(["-m", "--manager"])?,
8893
template: pargs.opt_value_from_str(["-t", "--template"])?,
8994
skip: pargs.contains(["-y", "--yes"]),
9095
force: pargs.contains(["-f", "--force"]),
91-
alpha: pargs.contains("--alpha"),
96+
alpha: pargs.contains("--alpha") || pargs.contains("--beta"),
9297
mobile: if pargs.contains("--mobile") {
9398
Some(true)
9499
} else {

src/deps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub fn print_missing_deps(pkg_manager: PackageManager, template: Template, alpha
191191
Dep {
192192
name: "Tauri CLI",
193193
instruction: if alpha {
194-
format!("Run `{BLUE}{BOLD}cargo install tauri-cli --version '^2.0.0-alpha'{RESET}`")
194+
format!("Run `{BLUE}{BOLD}cargo install tauri-cli --version '^2.0.0-beta'{RESET}`")
195195
} else {
196196
format!("Run `{BLUE}{BOLD}cargo install tauri-cli{RESET}`")
197197
},

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ where
7575
} = args;
7676
let cwd = std::env::current_dir()?;
7777

78-
// Allow `--mobile` to only be used with `--alpha` for now
78+
// Allow `--mobile` to only be used with `--beta` for now
7979
// TODO: remove this limitation once tauri@v2 is stable
8080
if let Some(mobile) = mobile {
8181
if mobile && !alpha {
8282
eprintln!(
83-
"{BOLD}{RED}error{RESET}: `{GREEN}--mobile{RESET}` option is only available if `{GREEN}--alpha{RESET}` option is also used"
83+
"{BOLD}{RED}error{RESET}: `{GREEN}--mobile{RESET}` option is only available if `{GREEN}--beta{RESET}` option is also used"
8484
);
8585
exit(1);
8686
}
@@ -280,7 +280,7 @@ where
280280
};
281281

282282
// Prompt for wether to bootstrap a mobile-friendly tauri project
283-
// This should only be prompted if `--alpha` is used on the command line and `--mobile` wasn't.
283+
// This should only be prompted if `--beta` is used on the command line and `--mobile` wasn't.
284284
// TODO: remove this limitation once tauri@v2 is stable
285285
let mobile = match mobile {
286286
Some(mobile) => mobile,

templates/_base_/src-tauri/Cargo.toml.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ tauri-build = { version = "1.5", features = [] }
1717
[dependencies]
1818
tauri = { version = "1.5", features = ["shell-open"] }
1919
serde = { version = "1.0", features = ["derive"] }{% else %}[build-dependencies]
20-
tauri-build = { version = "2.0.0-alpha", features = [] }
20+
tauri-build = { version = "2.0.0-beta", features = [] }
2121

2222
[dependencies]
23-
tauri = { version = "2.0.0-alpha", features = [] }
24-
tauri-plugin-shell = "2.0.0-alpha"{% endif %}
23+
tauri = { version = "2.0.0-beta", features = [] }
24+
tauri-plugin-shell = "2.0.0-beta"{% endif %}
2525
serde_json = "1.0"
2626

2727
[features]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "./schemas/desktop-schema.json",
3+
"identifier": "main-capability",
4+
"description": "Capability for the main window",
5+
"windows": ["main"],
6+
"permissions": [
7+
"path:default",
8+
"event:default",
9+
"window:default",
10+
"app:default",
11+
"resources:default",
12+
"menu:default",
13+
"tray:default",
14+
"shell:open"
15+
]
16+
}

templates/template-angular/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"rxjs": "~7.8.0",
2222
"tslib": "^2.3.0",
2323
"zone.js": "~0.14.2",
24-
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
25-
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
24+
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
25+
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
2626
},
2727
"devDependencies": {
2828
"@angular-devkit/build-angular": "^17.0.0",
@@ -36,7 +36,7 @@
3636
"karma-jasmine": "~5.1.0",
3737
"karma-jasmine-html-reporter": "~2.1.0",
3838
"typescript": "~5.2.2",
39-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
39+
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
4040
"internal-ip": "^7.0.0"{% endif %}
4141
}
4242
}

templates/template-preact-ts/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
},
1212
"dependencies": {
1313
"preact": "^10.16.0",
14-
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
15-
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
14+
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
15+
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
1616
},
1717
"devDependencies": {
1818
"@preact/preset-vite": "^2.5.0",
1919
"typescript": "^5.0.2",
2020
"vite": "^5.0.0",
21-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
21+
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
2222
"internal-ip": "^7.0.0"{% endif %}
2323
}
2424
}

templates/template-preact/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
},
1212
"dependencies": {
1313
"preact": "^10.16.0",
14-
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
15-
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
14+
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
15+
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
1616
},
1717
"devDependencies": {
1818
"@preact/preset-vite": "^2.5.0",
1919
"vite": "^5.0.0",
20-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
20+
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
2121
"internal-ip": "^7.0.0"{% endif %}
2222
}
2323
}

templates/template-react-ts/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
"dependencies": {
1313
"react": "^18.2.0",
1414
"react-dom": "^18.2.0",
15-
"@tauri-apps/api": "^{% if alpha %}2.0.0-alpha.13{% else %}1.5.2{% endif %}"{% if alpha %},
16-
"@tauri-apps/plugin-shell": "^2.0.0-alpha.3"{% endif %}
15+
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
16+
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
1717
},
1818
"devDependencies": {
1919
"@types/react": "^18.2.15",
2020
"@types/react-dom": "^18.2.7",
2121
"@vitejs/plugin-react": "^4.2.1",
2222
"typescript": "^5.0.2",
2323
"vite": "^5.0.0",
24-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-alpha.20{% else %}1.5.8{% endif %}"{% if mobile %},
24+
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
2525
"internal-ip": "^7.0.0"{% endif %}
2626
}
2727
}

0 commit comments

Comments
 (0)