Skip to content

Commit

Permalink
publish: v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ugo-studio committed Jun 19, 2024
1 parent db151bb commit 205bc62
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ jobs:
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.

- name: setup node
uses: actions/setup-node@v4

- uses: oven-sh/setup-bun@v1
with:
node-version: lts/*
cache: 'npm' # Set this to npm, yarn or pnpm.
bun-version: latest

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand All @@ -55,7 +53,7 @@ jobs:

- name: install frontend dependencies
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
run: npm install # change this to npm or pnpm depending on which one you use.
run: bun install

- uses: tauri-apps/tauri-action@v0
env:
Expand Down
9 changes: 5 additions & 4 deletions bin/server/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "server-bun",
"name": "fileserver",
"description": "file server from filestream app",
"module": "index.ts",
"type": "module",
"scripts": {
"dev": "bun --watch run ./index.ts \"http://localhost:1420/\"",
"build": "npm run es-build && npm run bun-build",
"build": "bun run es-build && bun run bun-build",
"es-build": "esbuild ./index.ts --platform=node --format=cjs --bundle --outfile=dist/index.js",
"pkg-build": "pkg dist/index.js -t latest -o ../../src-tauri/bin/server-x86_64-pc-windows-msvc",
"bun-build": "bun build --compile --minify --sourcemap ./dist/index.js --outfile ../../src-tauri/bin/server-x86_64-pc-windows-msvc"
"pkg-build": "pkg dist/index.js -t latest -o ../../src-tauri/bin/server",
"bun-build": "bun build --compile --minify --sourcemap ./dist/index.js --outfile ../../src-tauri/bin/server"
},
"peerDependencies": {
"typescript": "^5.0.0"
Expand Down
Binary file modified bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "",
"type": "module",
"scripts": {
"build-bin": "cd ./bin/server/ && bun run build",
"dev": "vite dev --host 0.0.0.0",
"build": "vite build",
"build": "vite build && bun run build-bin && bun run ./scripts/build.ts",
"build-bin": "cd ./bin/server/ && bun run 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 @@ -17,6 +17,7 @@
"@fontsource/fira-mono": "^5.0.13",
"@fontsource/poppins": "^5.0.14",
"@tauri-apps/api": "^1",
"@types/node": "^20.14.5",
"@types/uuid": "^9.0.8",
"device-detector-js": "^3.0.3",
"myfetchapi": "^1.6.0",
Expand Down
23 changes: 23 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { execFileSync } from "child_process";
import { rename } from "fs/promises";

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

async function main() {
const rustInfo = execFileSync("rustc", ["-vV"]).toString("utf8");
const targetTriple = (/host: (\S+)/g.exec(rustInfo) ?? [])[1]?.trim();
if (!targetTriple) {
console.error("Failed to determine platform target triple");
}
await rename(
`src-tauri/bin/server${extension}`,
`src-tauri/bin/server-${targetTriple}${extension}`
);
}

main().catch((e) => {
throw e;
});

0 comments on commit 205bc62

Please sign in to comment.