Skip to content

Commit

Permalink
add and rename anvil
Browse files Browse the repository at this point in the history
  • Loading branch information
sameoldlab committed Apr 3, 2023
1 parent 375ba09 commit c9b412d
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: 'App Name v__VERSION__'
releaseName: 'Anvil UI v__VERSION__'
releaseDraft: false
prerelease: true
31 changes: 31 additions & 0 deletions .scripts/move-binary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

/**
* This script is used to rename the binary with the platform specific postfix.
* When `tauri build` is ran, it looks for the binary name appended with the platform specific postfix.
*/
import { execa } from "execa"
import { existsSync, renameSync } from "fs"

let extension = ""
if (process.platform === "win32") {
extension = ".exe"
}

async function main() {
// get target triple for current platform
const rustInfo = (await execa("rustc", ["-vV"])).stdout
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1]
if (!targetTriple) {
throw new Error("Failed to determine platform target triple")
}
// Rename binary if it does not already exist
if (!existsSync(`public/bin/anvil-${targetTriple}`))
renameSync(`public/bin/anvil${extension}`, `public/bin/anvil-${targetTriple}${extension}`)
}

main().catch((e) => {
throw e
})
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"dev": "node .scripts/move-binary.js && vite",
"build": "node .scripts/move-binary.js && vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
Expand All @@ -30,6 +30,7 @@
"svelte-check": "^3.1.4",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vite": "^4.1.4"
"vite": "^4.1.4",
"execa": "7.0.0"
}
}
70 changes: 70 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/bin/anvil
Binary file not shown.

0 comments on commit c9b412d

Please sign in to comment.