Skip to content

Commit 9f34823

Browse files
committed
Switch to bun
1 parent 9a4db75 commit 9f34823

26 files changed

+1068
-384
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v4
1414

15+
- name: Setup Bun
16+
uses: oven-sh/setup-bun@v1
17+
18+
- name: Install dependencies
19+
run: bun install
20+
21+
- name: Check formatting
22+
run: bun run format:check
23+
24+
- name: Lint code
25+
run: bun run lint:check
26+
27+
- name: Typecheck
28+
run: bun run typecheck
29+
1530
- name: Setup Flyctl
1631
uses: superfly/flyctl-actions/setup-flyctl@v1
1732

@@ -24,8 +39,8 @@ jobs:
2439
GITHUB_APP_PRIVATE_KEY="${{ secrets.GITHUB_APP_PRIVATE_KEY }}"
2540
env:
2641
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
27-
42+
2843
- name: Deploy
2944
run: flyctl deploy --remote-only
3045
env:
31-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
46+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ temp/
3535
*.tar
3636

3737
# IDE
38-
.vscode/
3938
.idea/
4039

4140
# Test artifacts

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"quickfix.biome": "explicit",
6+
"source.organizeImports.biome": "explicit"
7+
},
8+
"[typescript]": {
9+
"editor.defaultFormatter": "biomejs.biome"
10+
},
11+
"[javascript]": {
12+
"editor.defaultFormatter": "biomejs.biome"
13+
},
14+
"biome.lsp.bin": "./node_modules/@biomejs/biome/bin/biome"
15+
}

Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
2-
FROM node:20-alpine
1+
FROM oven/bun:1.1 AS build
32
WORKDIR /app
4-
COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* ./
5-
RUN npm ci || yarn || pnpm i
3+
COPY package.json bunfig.toml ./
4+
RUN bun install
65
COPY tsconfig.json ./tsconfig.json
76
COPY src ./src
8-
RUN npm run build
7+
RUN bun run typecheck && bun run build
8+
9+
FROM oven/bun:1.1
10+
WORKDIR /app
11+
COPY --from=build /app/package.json ./
12+
COPY --from=build /app/node_modules ./node_modules
13+
COPY --from=build /app/dist ./dist
914
ENV NODE_ENV=production
1015
EXPOSE 8080
11-
CMD ["node", "dist/app.js"]
16+
CMD ["bun", "run", "dist/app.js"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Philipp Nagel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999

100100
## Local development
101101
```bash
102-
npm install
103-
npm run dev
102+
bun install
103+
bun run dev
104104
```
105105
Environment variables (use Fly secrets in production):
106106
```
@@ -114,7 +114,7 @@ MARKET_B=100
114114

115115
## Files
116116
- `src/` core TypeScript:
117-
- `app.ts` Express server
117+
- `app.ts` Bun server
118118
- `webhooks.ts` GitHub webhook handlers (create, trade, balance, resolve)
119119
- `lmsr.ts` AMM functions
120120
- `snapshot.ts` signed market snapshot (with `seq`)

biome.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "tab",
14+
"lineWidth": 100,
15+
"lineEnding": "lf"
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true,
21+
"suspicious": {
22+
"noExplicitAny": "warn",
23+
"noDoubleEquals": "error"
24+
},
25+
"style": {
26+
"useConst": "error",
27+
"noUnusedTemplateLiteral": "error",
28+
"noNonNullAssertion": "warn"
29+
},
30+
"correctness": {
31+
"noUnusedVariables": "error",
32+
"noUndeclaredVariables": "error"
33+
},
34+
"complexity": {
35+
"noForEach": "off"
36+
}
37+
}
38+
},
39+
"javascript": {
40+
"formatter": {
41+
"quoteStyle": "double",
42+
"trailingCommas": "es5",
43+
"semicolons": "always",
44+
"arrowParentheses": "asNeeded"
45+
}
46+
},
47+
"assist": {
48+
"enabled": true,
49+
"actions": {
50+
"source": {
51+
"organizeImports": "on"
52+
}
53+
}
54+
}
55+
}

bun.lockb

24.9 KB
Binary file not shown.

bunfig.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[log]
2+
level = "info"
3+
4+
[scripts]
5+
dev = "bun run src/app.ts"
6+
typecheck = "tsc --noEmit"
7+
build = "tsc"
8+
start = "bun run dist/app.js"
9+
10+
[install]
11+
registry = "https://registry.npmjs.org"

package.json

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
21
{
3-
"name": "github-prediction-market",
4-
"version": "0.1.0",
5-
"type": "module",
6-
"scripts": {
7-
"dev": "ts-node-esm src/app.ts",
8-
"start": "node dist/app.js",
9-
"build": "tsc"
10-
},
11-
"dependencies": {
12-
"@octokit/rest": "^20.0.0",
13-
"@octokit/webhooks": "^12.0.0",
14-
"@octokit/auth-app": "^6.0.0",
15-
"express": "^4.19.2",
16-
"dotenv": "^16.4.5"
17-
},
18-
"devDependencies": {
19-
"typescript": "^5.4.0",
20-
"ts-node": "^10.9.2"
21-
}
2+
"name": "ganttmarket",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"scripts": {
6+
"dev": "bun run src/app.ts",
7+
"typecheck": "tsc --noEmit",
8+
"build": "tsc",
9+
"start": "bun run dist/app.js",
10+
"format": "biome format --write .",
11+
"format:check": "biome format .",
12+
"lint": "biome lint --write .",
13+
"lint:check": "biome lint .",
14+
"check": "biome check --write .",
15+
"check:ci": "biome ci . && bun run typecheck"
16+
},
17+
"dependencies": {
18+
"@octokit/rest": "^20.0.0",
19+
"@octokit/auth-app": "^6.0.0",
20+
"dotenv": "^16.4.5"
21+
},
22+
"devDependencies": {
23+
"@biomejs/biome": "^2.2.5",
24+
"@types/bun": "^1.3.0",
25+
"typescript": "^5.4.0"
26+
}
2227
}

0 commit comments

Comments
 (0)