Skip to content

Commit c9b412d

Browse files
committed
add and rename anvil
1 parent 375ba09 commit c9b412d

File tree

5 files changed

+106
-4
lines changed

5 files changed

+106
-4
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ jobs:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4646
with:
4747
tagName: ${{ github.ref_name }}
48-
releaseName: 'App Name v__VERSION__'
48+
releaseName: 'Anvil UI v__VERSION__'
4949
releaseDraft: false
5050
prerelease: true

.scripts/move-binary.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2+
// SPDX-License-Identifier: Apache-2.0
3+
// SPDX-License-Identifier: MIT
4+
5+
/**
6+
* This script is used to rename the binary with the platform specific postfix.
7+
* When `tauri build` is ran, it looks for the binary name appended with the platform specific postfix.
8+
*/
9+
import { execa } from "execa"
10+
import { existsSync, renameSync } from "fs"
11+
12+
let extension = ""
13+
if (process.platform === "win32") {
14+
extension = ".exe"
15+
}
16+
17+
async function main() {
18+
// get target triple for current platform
19+
const rustInfo = (await execa("rustc", ["-vV"])).stdout
20+
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1]
21+
if (!targetTriple) {
22+
throw new Error("Failed to determine platform target triple")
23+
}
24+
// Rename binary if it does not already exist
25+
if (!existsSync(`public/bin/anvil-${targetTriple}`))
26+
renameSync(`public/bin/anvil${extension}`, `public/bin/anvil-${targetTriple}${extension}`)
27+
}
28+
29+
main().catch((e) => {
30+
throw e
31+
})

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7-
"dev": "vite",
8-
"build": "vite build",
7+
"dev": "node .scripts/move-binary.js && vite",
8+
"build": "node .scripts/move-binary.js && vite build",
99
"preview": "vite preview",
1010
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1111
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
@@ -30,6 +30,7 @@
3030
"svelte-check": "^3.1.4",
3131
"tslib": "^2.5.0",
3232
"typescript": "^4.9.5",
33-
"vite": "^4.1.4"
33+
"vite": "^4.1.4",
34+
"execa": "7.0.0"
3435
}
3536
}

pnpm-lock.yaml

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/bin/anvil

11.3 MB
Binary file not shown.

0 commit comments

Comments
 (0)