mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
fix(cli): error out when migrating from v2 alpha (#13833)
This commit is contained in:
6
.changes/migrate-alpha-error.md
Normal file
6
.changes/migrate-alpha-error.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@tauri-apps/cli": patch:bug
|
||||
"tauri-cli": patch:bug
|
||||
---
|
||||
|
||||
Fail with an error when trying to migrate from v2 alpha
|
||||
6
.changes/v2-beta-to-stable.md
Normal file
6
.changes/v2-beta-to-stable.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@tauri-apps/cli": patch:bug
|
||||
"tauri-cli": patch:bug
|
||||
---
|
||||
|
||||
Use v2 stable instead of v2-rc when migrating from v2-beta
|
||||
@@ -3,4 +3,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pub mod v1;
|
||||
pub mod v2_rc;
|
||||
pub mod v2_beta;
|
||||
|
||||
@@ -72,7 +72,7 @@ fn migrate_npm_dependencies(frontend_dir: &Path) -> Result<()> {
|
||||
.unwrap_or_default()
|
||||
.unwrap_or_default();
|
||||
if version.starts_with('1') {
|
||||
install_deps.push(format!("{pkg}@^2.0.0-rc.0"));
|
||||
install_deps.push(format!("{pkg}@^2.0.0"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ fn migrate_permissions(tauri_dir: &Path) -> Result<()> {
|
||||
}
|
||||
|
||||
fn migrate_manifest(manifest: &mut DocumentMut) -> Result<()> {
|
||||
let version = "2.0.0-rc.0";
|
||||
let version = "2.0.0";
|
||||
|
||||
let dependencies = manifest
|
||||
.as_table_mut()
|
||||
@@ -13,7 +13,7 @@ use crate::{
|
||||
|
||||
use std::{fs::read_to_string, str::FromStr};
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::{bail, Context};
|
||||
|
||||
mod migrations;
|
||||
|
||||
@@ -47,9 +47,22 @@ pub fn command() -> Result<()> {
|
||||
migrations::v1::run().context("failed to migrate from v1")?;
|
||||
} else if tauri_version.major == 2 {
|
||||
if let Some((pre, _number)) = tauri_version.pre.as_str().split_once('.') {
|
||||
if pre == "beta" {
|
||||
migrations::v2_rc::run().context("failed to migrate from v2 beta to rc")?;
|
||||
match pre {
|
||||
"beta" => {
|
||||
migrations::v2_beta::run().context("failed to migrate from v2 beta")?;
|
||||
}
|
||||
"alpha" => {
|
||||
bail!(
|
||||
"Migrating from v2 alpha ({tauri_version}) to v2 stable is not supported yet, \
|
||||
if your project started early, try downgrading to v1 and then try again"
|
||||
)
|
||||
}
|
||||
_ => {
|
||||
bail!("Migrating from {tauri_version} to v2 stable is not supported yet")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::info!("Nothing to do, the tauri version is already at v2 stable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user