Skip to content

Commit

Permalink
update migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Aug 25, 2024
1 parent 5926351 commit 876e92d
Showing 1 changed file with 56 additions and 7 deletions.
63 changes: 56 additions & 7 deletions tooling/cli/src/migrate/migrations/v1/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,39 @@ fn process_bundle(config: &mut Map<String, Value>, migrated: &MigratedConfig) {
license_file = Some(license);
}
}

// Windows
if let Some(windows) = bundle_config.get_mut("windows") {
if let Some(wix) = windows.get_mut("wix").and_then(|v| v.as_object_mut()) {
if let Some(license_path) = wix.remove("license") {
license_file = Some(license_path);
if let Some(windows) = windows.as_object_mut() {
if let Some(wix) = windows.get_mut("wix").and_then(|v| v.as_object_mut()) {
if let Some(license_path) = wix.remove("license") {
license_file = Some(license_path);
}
}
}
if let Some(nsis) = windows.get_mut("nsis").and_then(|v| v.as_object_mut()) {
if let Some(license_path) = nsis.remove("license") {
license_file = Some(license_path);
if let Some(nsis) = windows.get_mut("nsis").and_then(|v| v.as_object_mut()) {
if let Some(license_path) = nsis.remove("license") {
license_file = Some(license_path);
}
}

if let Some((fixed_runtime_path, key)) = windows
.remove("webviewFixedRuntimePath")
.map(|v| (v, "webviewInstallMode"))
.or_else(|| {
windows
.remove("webview-fixed-runtime-path")
.map(|v| (v, "webview-install-mode"))
})
{
if !fixed_runtime_path.is_null() {
windows.insert(
key.into(),
serde_json::json!({
"type": "fixedRuntime",
"path": fixed_runtime_path
}),
);
}
}
}
}
Expand Down Expand Up @@ -1083,4 +1107,29 @@ mod test {
original["build"]["frontendDist"]
);
}

#[test]
fn migrate_webview_fixed_runtime_path() {
let original = serde_json::json!({
"tauri": {
"bundle": {
"windows": {
"webviewFixedRuntimePath": "./path/to/runtime"
}
}
}
});

let migrated = migrate(&original);

assert_eq!(
migrated["bundle"]["windows"]["webviewInstallMode"]["type"],
"fixedRuntime"
);

assert_eq!(
migrated["bundle"]["windows"]["webviewInstallMode"]["path"],
original["tauri"]["bundle"]["windows"]["webviewFixedRuntimePath"]
);
}
}

0 comments on commit 876e92d

Please sign in to comment.