Skip to content

Commit

Permalink
feat(cli): add support to Svelte and Vue.js code on v1 migration (#10544
Browse files Browse the repository at this point in the history
)

* feat(cli): add support to Svelte and Vue.js code on v1 migration

* clippy
  • Loading branch information
lucasfernog authored Aug 12, 2024
1 parent 3998570 commit 3bec7b1
Show file tree
Hide file tree
Showing 9 changed files with 746 additions and 235 deletions.
6 changes: 6 additions & 0 deletions .changes/migrate-vue-svelte.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": patch:feat
"@tauri-apps/cli": patch:feat
---

v1 migrate script now migrates Svelte and Vue.js code.
1 change: 1 addition & 0 deletions tooling/cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tooling/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ magic_string = "0.3"
phf = { version = "0.11", features = ["macros"] }
walkdir = "2"
elf = "0.7"
memchr = "2"

[target."cfg(windows)".dependencies.windows-sys]
version = "0.52"
Expand Down
33 changes: 1 addition & 32 deletions tooling/cli/src/helpers/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::{path::Path, process::Command};
use std::process::Command;

use anyhow::Context;

Expand All @@ -17,37 +17,6 @@ pub struct CargoInstallOptions<'a> {
pub target: Option<&'a str>,
}

pub fn install(dependencies: &[String], cwd: Option<&Path>) -> crate::Result<()> {
let dependencies_str = if dependencies.len() > 1 {
"dependencies"
} else {
"dependency"
};
log::info!(
"Installing Cargo {dependencies_str} {}...",
dependencies
.iter()
.map(|d| format!("\"{d}\""))
.collect::<Vec<_>>()
.join(", ")
);

let mut cmd = Command::new("cargo");
cmd.arg("add").args(dependencies);

if let Some(cwd) = cwd {
cmd.current_dir(cwd);
}

let status = cmd.status().with_context(|| "failed to run cargo")?;

if !status.success() {
anyhow::bail!("Failed to install Cargo {dependencies_str}");
}

Ok(())
}

pub fn install_one(options: CargoInstallOptions) -> crate::Result<()> {
let mut cargo = Command::new("cargo");
cargo.arg("add");
Expand Down
Loading

0 comments on commit 3bec7b1

Please sign in to comment.