use tauri cli directly if no runner is given

This commit is contained in:
Jonas Kruckenberg 2022-05-07 13:49:49 +02:00
parent 8de43ed4e1
commit f3451b2fac
No known key found for this signature in database
GPG Key ID: 21AD3B3C266BDE3D

View File

@ -1,3 +1,4 @@
import { run } from '@tauri-apps/cli'
import {execa} from 'execa' import {execa} from 'execa'
import {join} from 'path' import {join} from 'path'
import glob from 'tiny-glob' import glob from 'tiny-glob'
@ -13,7 +14,7 @@ interface BuildOptions {
export async function buildProject(options: BuildOptions): Promise<string[]> { export async function buildProject(options: BuildOptions): Promise<string[]> {
const projectPath = options.configPath || process.cwd() const projectPath = options.configPath || process.cwd()
const runner = options.runner || 'tauri'
let args: string[] = options.args || [] let args: string[] = options.args || []
if (options.configPath) { if (options.configPath) {
@ -24,7 +25,13 @@ export async function buildProject(options: BuildOptions): Promise<string[]> {
args.push('--target', options.target) args.push('--target', options.target)
} }
await execa(runner, args, {cwd: projectPath, stdio: 'inherit'}) process.chdir(projectPath)
if (options.runner) {
await execa(options.runner, args, { stdio: 'inherit' })
} else {
await run(args, '')
}
const profile = options.debug ? 'debug' : 'release' const profile = options.debug ? 'debug' : 'release'
const outDir = options.target const outDir = options.target