Skip to content

Commit a10f122

Browse files
committed
Unify setup scripts into one
`setup.ts` can run OS-specific setup scripts by detecting OS
1 parent 009671f commit a10f122

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

bun.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@commitlint/cli": "^19.8.1",
5252
"@tailwindcss/vite": "^4.1.11",
5353
"@tauri-apps/cli": "^2",
54+
"@types/bun": "^1.2.21",
5455
"@types/node": "^24.1.0",
5556
"@types/react": "^19.1.8",
5657
"@types/react-dom": "^19.1.6",
@@ -452,6 +453,8 @@
452453

453454
"@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.20.7" } }, "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng=="],
454455

456+
"@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.2.21" } }, "sha512-NiDnvEqmbfQ6dmZ3EeUO577s4P5bf4HCTXtI6trMc6f6RzirY5IrF3aIookuSpyslFzrnvv2lmEWv5HyC1X79A=="],
457+
455458
"@types/conventional-commits-parser": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-7uz5EHdzz2TqoMfV7ee61Egf5y6NkcO4FB/1iCCQnbeiI1F3xzv3vK5dBCXUCLQgGYS+mUeigK1iKQzvED+QnQ=="],
456459

457460
"@types/estree": ["@types/[email protected]", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
@@ -514,6 +517,8 @@
514517

515518
"browserslist": ["[email protected]", "", { "dependencies": { "caniuse-lite": "^1.0.30001726", "electron-to-chromium": "^1.5.173", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw=="],
516519

520+
"bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-sa2Tj77Ijc/NTLS0/Odjq/qngmEPZfbfnOERi0KRUYhT9R8M4VBioWVmMWE5GrYbKMc+5lVybXygLdibHaqVqw=="],
521+
517522
"callsites": ["[email protected]", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="],
518523

519524
"caniuse-lite": ["[email protected]", "", {}, "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q=="],

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
"clean": "concurrently --names \"node,rust\" --prefix-colors \"cyan,yellow\" \"rimraf dist build node_modules bun.lockb && bun install\" \"cargo clean && cargo build\"",
1717
"prepare": "simple-git-hooks",
1818
"commitlint": "commitlint",
19-
"setup": "chmod +x scripts/linux/setup.sh && ./scripts/linux/setup.sh",
20-
"setup:linux": "chmod +x scripts/linux/setup.sh && ./scripts/linux/setup.sh",
21-
"setup-win": "powershell -ExecutionPolicy Bypass -File ./scripts/windows/setup.ps1",
19+
"setup": "bun setup.ts",
2220
"dev": "bun run tauri dev"
2321
},
2422
"dependencies": {
@@ -69,6 +67,7 @@
6967
"@commitlint/cli": "^19.8.1",
7068
"@tailwindcss/vite": "^4.1.11",
7169
"@tauri-apps/cli": "^2",
70+
"@types/bun": "^1.2.21",
7271
"@types/node": "^24.1.0",
7372
"@types/react": "^19.1.8",
7473
"@types/react-dom": "^19.1.6",

setup.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os from "node:os";
2+
import { $ } from "bun";
3+
4+
const WINDOWS = "win32";
5+
const MAC = "darwin";
6+
const LINUX = "linux";
7+
8+
const platform = os.platform();
9+
10+
if (platform === WINDOWS) {
11+
await $`powershell -ExecutionPolicy Bypass -File ./scripts/windows/setup.ps1`;
12+
} else if (platform === MAC || platform === LINUX) {
13+
await $`chmod +x scripts/linux/setup.sh && ./scripts/linux/setup.sh`;
14+
}

0 commit comments

Comments
 (0)