fix(cli): pnpm detection on mobile init and xcode-script (#9553)

* fix(cli): pnpm detection on mobile init

* small outputFiles fix

* same check for xcode-script

* Discard changes to tooling/cli/node/index.js

* Discard changes to tooling/cli/node/index.d.ts

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
Lucas Fernandes Nogueira 2024-05-11 23:32:05 -03:00 committed by GitHub
parent bd64982fe6
commit 4a33bc6a62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 6 deletions

View File

@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---
Fixes `pnpm` detection when initializing and running a mobile project.

View File

@ -103,7 +103,9 @@ pub fn exec(
if let Some(bin_stem) = bin_path.file_stem() { if let Some(bin_stem) = bin_path.file_stem() {
let r = regex::Regex::new("(nodejs|node)\\-?([1-9]*)*$").unwrap(); let r = regex::Regex::new("(nodejs|node)\\-?([1-9]*)*$").unwrap();
if r.is_match(&bin_stem.to_string_lossy()) { if r.is_match(&bin_stem.to_string_lossy()) {
if let Some(npm_execpath) = var_os("npm_execpath") { if var_os("PNPM_PACKAGE_NAME").is_some() {
return ("pnpm".into(), build_args);
} else if let Some(npm_execpath) = var_os("npm_execpath") {
let manager_stem = PathBuf::from(&npm_execpath) let manager_stem = PathBuf::from(&npm_execpath)
.file_stem() .file_stem()
.unwrap() .unwrap()

View File

@ -61,7 +61,7 @@ pub fn command(options: Options) -> Result<()> {
} }
// `xcode-script` is ran from the `gen/apple` folder when not using NPM. // `xcode-script` is ran from the `gen/apple` folder when not using NPM.
if var_os("npm_lifecycle_event").is_none() { if var_os("npm_lifecycle_event").is_none() && var_os("PNPM_PACKAGE_NAME").is_none() {
set_current_dir(current_dir()?.parent().unwrap().parent().unwrap()).unwrap(); set_current_dir(current_dir()?.parent().unwrap().parent().unwrap()).unwrap();
} }

View File

@ -261,12 +261,15 @@ fn read_options(identifier: &str) -> CliOptions {
let runtime = tokio::runtime::Runtime::new().unwrap(); let runtime = tokio::runtime::Runtime::new().unwrap();
let options = runtime let options = runtime
.block_on(async move { .block_on(async move {
let addr_path = temp_dir().join(format!("{identifier}-server-addr"));
let (tx, rx) = WsTransportClientBuilder::default() let (tx, rx) = WsTransportClientBuilder::default()
.build( .build(
format!( format!(
"ws://{}", "ws://{}",
read_to_string(temp_dir().join(format!("{identifier}-server-addr"))) read_to_string(&addr_path).unwrap_or_else(|e| panic!(
.expect("missing addr file") "failed to read missing addr file {}: {e}",
addr_path.display()
))
) )
.parse() .parse()
.unwrap(), .unwrap(),

View File

@ -127,8 +127,9 @@ targets:
name: Build Rust Code name: Build Rust Code
basedOnDependencyAnalysis: false basedOnDependencyAnalysis: false
outputFiles: outputFiles:
- $(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/lib{{app.lib-name}}.a - $(SRCROOT)/Externals/x86_64/${CONFIGURATION}/lib{{app.lib-name}}.a
- $(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/lib{{app.lib-name}}.a - $(SRCROOT)/Externals/arm64/${CONFIGURATION}/lib{{app.lib-name}}.a
- $(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/lib{{app.lib-name}}.a
{{~#if ios-post-compile-scripts}} {{~#if ios-post-compile-scripts}}
postCompileScripts: postCompileScripts:
{{~#each ios-post-compile-scripts}}{{#if this.path}} {{~#each ios-post-compile-scripts}}{{#if this.path}}