mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-18 16:11:38 +03:00
feat(cli): migrate tauri-build version (#8529)
* feat(cli): migrate tauri-build version This changes the migrate command to also migrate the tauri-build dependency to v2, previously it only updated the tauri dependency. * lint
This commit is contained in:
parent
29ced5ceec
commit
0ec28c39f4
6
.changes/migrate-tauri-build-version.md
Normal file
6
.changes/migrate-tauri-build-version.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:feat
|
||||
"@tauri-apps/cli": patch:feat
|
||||
---
|
||||
|
||||
Include tauri-build on the migration script.
|
@ -13,7 +13,7 @@ use std::{
|
||||
use crate::helpers::config::Config;
|
||||
use tauri_bundler::bundle::{PackageType, Settings, SettingsBuilder};
|
||||
|
||||
pub use rust::{manifest, MobileOptions, Options, Rust as AppInterface};
|
||||
pub use rust::{MobileOptions, Options, Rust as AppInterface};
|
||||
|
||||
pub trait DevProcess {
|
||||
fn kill(&self) -> std::io::Result<()>;
|
||||
|
@ -37,6 +37,8 @@ pub fn migrate(tauri_dir: &Path) -> Result<()> {
|
||||
}
|
||||
|
||||
fn migrate_manifest(manifest: &mut Document) -> Result<()> {
|
||||
let version = dependency_version();
|
||||
|
||||
let dependencies = manifest
|
||||
.as_table_mut()
|
||||
.entry("dependencies")
|
||||
@ -44,8 +46,16 @@ fn migrate_manifest(manifest: &mut Document) -> Result<()> {
|
||||
.as_table_mut()
|
||||
.expect("manifest dependencies isn't a table");
|
||||
|
||||
let version = dependency_version();
|
||||
migrate_dependency(dependencies, "tauri", version, &features_to_remove());
|
||||
migrate_dependency(dependencies, "tauri", &version, &features_to_remove());
|
||||
|
||||
let build_dependencies = manifest
|
||||
.as_table_mut()
|
||||
.entry("build-dependencies")
|
||||
.or_insert(Item::Table(Table::new()))
|
||||
.as_table_mut()
|
||||
.expect("manifest build-dependencies isn't a table");
|
||||
|
||||
migrate_dependency(build_dependencies, "tauri-build", &version, &[]);
|
||||
|
||||
let lib = manifest
|
||||
.as_table_mut()
|
||||
@ -116,7 +126,7 @@ fn dependency_version() -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn migrate_dependency(dependencies: &mut Table, name: &str, version: String, remove: &[&str]) {
|
||||
fn migrate_dependency(dependencies: &mut Table, name: &str, version: &str, remove: &[&str]) {
|
||||
let item = dependencies.entry(name).or_insert(Item::None);
|
||||
|
||||
// do not rewrite if dependency uses workspace inheritance
|
||||
@ -138,7 +148,7 @@ fn migrate_dependency(dependencies: &mut Table, name: &str, version: String, rem
|
||||
}
|
||||
}
|
||||
|
||||
fn migrate_dependency_table<D: TableLike>(dep: &mut D, version: String, remove: &[&str]) {
|
||||
fn migrate_dependency_table<D: TableLike>(dep: &mut D, version: &str, remove: &[&str]) {
|
||||
*dep.entry("version").or_insert(Item::None) = Item::Value(version.into());
|
||||
let manifest_features = dep.entry("features").or_insert(Item::None);
|
||||
if let Some(features_array) = manifest_features.as_array_mut() {
|
||||
|
Loading…
Reference in New Issue
Block a user