File tree Expand file tree Collapse file tree 5 files changed +31
-6
lines changed
crates/tauri-cli/src/migrate Expand file tree Collapse file tree 5 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @tauri-apps/cli " : patch:bug
3+ " tauri-cli " : patch:bug
4+ ---
5+
6+ Fail with an error when trying to migrate from v2 alpha
Original file line number Diff line number Diff line change 1+ ---
2+ " @tauri-apps/cli " : patch:bug
3+ " tauri-cli " : patch:bug
4+ ---
5+
6+ Use v2 stable instead of v2-rc when migrating from v2-beta
Original file line number Diff line number Diff line change 33// SPDX-License-Identifier: MIT
44
55pub mod v1;
6- pub mod v2_rc ;
6+ pub mod v2_beta ;
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ fn migrate_npm_dependencies(frontend_dir: &Path) -> Result<()> {
7272 . unwrap_or_default ( )
7373 . unwrap_or_default ( ) ;
7474 if version. starts_with ( '1' ) {
75- install_deps. push ( format ! ( "{pkg}@^2.0.0-rc.0 " ) ) ;
75+ install_deps. push ( format ! ( "{pkg}@^2.0.0" ) ) ;
7676 }
7777 }
7878
@@ -111,7 +111,7 @@ fn migrate_permissions(tauri_dir: &Path) -> Result<()> {
111111}
112112
113113fn migrate_manifest ( manifest : & mut DocumentMut ) -> Result < ( ) > {
114- let version = "2.0.0-rc.0 " ;
114+ let version = "2.0.0" ;
115115
116116 let dependencies = manifest
117117 . as_table_mut ( )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use crate::{
1313
1414use std:: { fs:: read_to_string, str:: FromStr } ;
1515
16- use anyhow:: Context ;
16+ use anyhow:: { bail , Context } ;
1717
1818mod migrations;
1919
@@ -47,9 +47,22 @@ pub fn command() -> Result<()> {
4747 migrations:: v1:: run ( ) . context ( "failed to migrate from v1" ) ?;
4848 } else if tauri_version. major == 2 {
4949 if let Some ( ( pre, _number) ) = tauri_version. pre . as_str ( ) . split_once ( '.' ) {
50- if pre == "beta" {
51- migrations:: v2_rc:: run ( ) . context ( "failed to migrate from v2 beta to rc" ) ?;
50+ match pre {
51+ "beta" => {
52+ migrations:: v2_beta:: run ( ) . context ( "failed to migrate from v2 beta" ) ?;
53+ }
54+ "alpha" => {
55+ bail ! (
56+ "Migrating from v2 alpha ({tauri_version}) to v2 stable is not supported yet, \
57+ if your project started early, try downgrading to v1 and then try again"
58+ )
59+ }
60+ _ => {
61+ bail ! ( "Migrating from {tauri_version} to v2 stable is not supported yet" )
62+ }
5263 }
64+ } else {
65+ log:: info!( "Nothing to do, the tauri version is already at v2 stable" ) ;
5366 }
5467 }
5568
You can’t perform that action at this time.
0 commit comments