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 61297088b7
commit 83c3792130
No known key found for this signature in database
GPG Key ID: 21AD3B3C266BDE3D
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,6 @@
name: 'tauri-build'
description: 'Build tauri binaries for MacOS, Windows and Linux'
icon: 'download-cloud'
icon: 'box'
color: 'blue'
author: 'Tauri Programme within The Commons Conservancy'
inputs:

View File

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