fix(cli): `ios dev` and `ios build` support for `bun` (#10569)

This commit is contained in:
Lucas Fernandes Nogueira 2024-08-13 09:00:41 -03:00 committed by GitHub
parent 41c7a6646b
commit 712f1049fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---
Fixes running `ios dev` and `ios build` using `bun`.

View File

@ -14,7 +14,7 @@ use clap::Parser;
use std::{
collections::HashMap,
env::{current_dir, set_current_dir, var_os},
env::{current_dir, set_current_dir, var, var_os},
ffi::OsStr,
path::{Path, PathBuf},
process::Command,
@ -62,7 +62,10 @@ pub fn command(options: Options) -> Result<()> {
}
// `xcode-script` is ran from the `gen/apple` folder when not using NPM.
if var_os("npm_lifecycle_event").is_none() && var_os("PNPM_PACKAGE_NAME").is_none() {
// so we must change working directory to the src-tauri folder to resolve the tauri dir
if (var_os("npm_lifecycle_event").is_none() && var_os("PNPM_PACKAGE_NAME").is_none())
|| var("npm_config_user_agent").map_or(false, |agent| agent.starts_with("bun"))
{
set_current_dir(current_dir()?.parent().unwrap().parent().unwrap()).unwrap();
}