mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 11:13:40 +03:00
fix(cli): only add --
to generated android template for npm (#6508)
This commit is contained in:
parent
d5ac76b53c
commit
c787f749de
6
.changes/cli-pnpm.md
Normal file
6
.changes/cli-pnpm.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
'cli.rs': 'patch'
|
||||
'cli.js': 'patch'
|
||||
---
|
||||
|
||||
Fix android project build crashing when using `pnpm` caused by extra `--`.
|
@ -1,7 +1,3 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const { existsSync, readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
@ -15,7 +11,8 @@ function isMusl() {
|
||||
// For Node 10
|
||||
if (!process.report || typeof process.report.getReport !== 'function') {
|
||||
try {
|
||||
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
||||
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
||||
return readFileSync(lddPath, 'utf8').includes('musl')
|
||||
} catch (e) {
|
||||
return true
|
||||
}
|
||||
@ -105,6 +102,15 @@ switch (platform) {
|
||||
}
|
||||
break
|
||||
case 'darwin':
|
||||
localFileExisted = existsSync(join(__dirname, 'cli.darwin-universal.node'))
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./cli.darwin-universal.node')
|
||||
} else {
|
||||
nativeBinding = require('@tauri-apps/cli-darwin-universal')
|
||||
}
|
||||
break
|
||||
} catch {}
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
localFileExisted = existsSync(join(__dirname, 'cli.darwin-x64.node'))
|
||||
|
@ -124,19 +124,22 @@ pub fn exec(
|
||||
if r.is_match(&bin_stem) {
|
||||
if let Some(npm_execpath) = var_os("npm_execpath").map(PathBuf::from) {
|
||||
let manager_stem = npm_execpath.file_stem().unwrap().to_os_string();
|
||||
let manager = if manager_stem == "npm-cli" {
|
||||
binary = if manager_stem == "npm-cli" {
|
||||
"npm".into()
|
||||
} else {
|
||||
manager_stem
|
||||
};
|
||||
binary = manager;
|
||||
if !build_args.is_empty() {
|
||||
// remove script path, we'll use `npm_lifecycle_event` instead
|
||||
build_args.remove(0);
|
||||
}
|
||||
build_args.insert(0, "--".into());
|
||||
if binary == "npm" {
|
||||
build_args.insert(0, "--".into());
|
||||
}
|
||||
build_args.insert(0, var("npm_lifecycle_event").unwrap());
|
||||
build_args.insert(0, "run".into());
|
||||
if binary == "npm" {
|
||||
build_args.insert(0, "run".into());
|
||||
}
|
||||
}
|
||||
}
|
||||
map.insert("tauri-binary", binary.to_string_lossy());
|
||||
|
Loading…
Reference in New Issue
Block a user