Skip to content

Commit

Permalink
feature: add preferGlobal option (#48)
Browse files Browse the repository at this point in the history
* fix: paths method expect an array

The default return happened to work and resolve to CWD.

* try ls

* ls in place of

* build

* fix: point execa directly at tauri bin
fixes command not found error when using linked tauri.js

* add a preferGlobal option

* Create add-preferGlobal-option.md

Co-authored-by: Noah Klayman <noahklayman@gmail.com>
  • Loading branch information
jbolda and nklayman committed Sep 2, 2020
1 parent 47a9c9f commit a45f21b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/add-preferGlobal-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"action": patch
---

Add option to elect using an existing globally installed version of Tauri.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ inputs:
description: 'whether to include a debug build or not'
npmScript:
description: 'the package.json script to run to build the Tauri app'
preferGlobal:
description: 'set this to true to use a globally installed tauri instead'
outputs:
releaseId:
description: 'The ID of the created release'
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10687,7 +10687,10 @@ function execCommand(command, { cwd }) {
function buildProject(root, debug, { configPath, distPath, iconPath, npmScript }) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => {
if (hasTauriDependency(root)) {
if (core.getInput('preferGlobal') === "true") {
resolve('tauri');
}
else if (hasTauriDependency(root)) {
if (npmScript) {
resolve(usesYarn(root) ? `yarn ${npmScript}` : `npm run ${npmScript}`);
}
Expand Down
5 changes: 4 additions & 1 deletion dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ function execCommand(command, { cwd }) {
function buildProject(root, debug, { configPath, distPath, iconPath, npmScript }) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => {
if (hasTauriDependency(root)) {
if (core.getInput('preferGlobal') === "true") {
resolve('tauri');
}
else if (hasTauriDependency(root)) {
if (npmScript) {
resolve(usesYarn(root) ? `yarn ${npmScript}` : `npm run ${npmScript}`);
}
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ async function buildProject(
{configPath, distPath, iconPath, npmScript}: BuildOptions
): Promise<string[]> {
return new Promise<string>(resolve => {
if (hasTauriDependency(root)) {
if (core.getInput('preferGlobal') === "true") {
resolve('tauri')
} else if (hasTauriDependency(root)) {
if (npmScript) {
resolve(usesYarn(root) ? `yarn ${npmScript}` : `npm run ${npmScript}`)
} else {
Expand Down Expand Up @@ -296,4 +298,4 @@ async function run(): Promise<void> {
}
}

run()
run()

0 comments on commit a45f21b

Please sign in to comment.