Compare commits

..

1 Commits

Author SHA1 Message Date
33edc5c9f1 fix: add .ona and drizzle to oxfmt ignore
oxfmt was reformatting generated drizzle migration snapshots and
crashing on .ona/review/comments.json. Also runs the formatter
across the full codebase.

Co-authored-by: Ona <no-reply@ona.com>
2026-04-12 17:26:55 +00:00
7 changed files with 58 additions and 71 deletions

45
.ona/automations.yaml Normal file
View File

@@ -0,0 +1,45 @@
services:
expo:
name: Expo Dev Server
description: Expo development server for aelis-client
triggeredBy:
- postDevcontainerStart
commands:
start: cd apps/aelis-client && ./scripts/run-dev-server.sh
drizzle-studio:
name: Drizzle Studio
description: Drizzle Studio database browser for aelis-backend
triggeredBy:
- manual
commands:
start: |
FORWARD_URL=$(gitpod environment port open 4983 --name drizzle-studio-server | sed 's|https://||')
echo "Drizzle Studio: https://local.drizzle.studio/?host=${FORWARD_URL}&port=443"
cd apps/aelis-backend && bunx drizzle-kit studio --host 0.0.0.0 --port 4983
aelis-backend:
name: Aelis Backend
description: Hono API server for aelis-backend (port 3000)
triggeredBy:
- manual
commands:
start: |
gitpod --context environment environment port open 3000 --name "Aelis Backend" --protocol http
TS_IP=$(tailscale ip -4)
echo ""
echo "------------------ Bun Debugger ------------------"
echo "https://debug.bun.sh/#${TS_IP}:6499"
echo "------------------ Bun Debugger ------------------"
echo ""
cd apps/aelis-backend && bun run dev
admin-dashboard:
name: Admin Dashboard
description: Vite dev server for admin-dashboard (port 5174)
triggeredBy:
- manual
commands:
start: |
gitpod --context environment environment port open 5174 --name "Admin Dashboard" --protocol http
cd apps/admin-dashboard && bun run dev --host

View File

@@ -12,7 +12,6 @@ export default defineConfig({
},
},
server: {
host: "0.0.0.0",
port: 5174,
allowedHosts: true,
},

View File

@@ -122,6 +122,5 @@ const app = main()
export default {
port: 3000,
hostname: "0.0.0.0",
fetch: app.fetch,
}

View File

@@ -7,7 +7,6 @@
import type { ServerWebSocket } from "bun"
const PROXY_PORT = parseInt(process.env.PROXY_PORT || "8080", 10)
const PROXY_HOST = process.env.PROXY_HOST || "0.0.0.0"
const METRO_PORT = parseInt(process.env.METRO_PORT || "8081", 10)
const METRO_BASE = `http://127.0.0.1:${METRO_PORT}`
@@ -24,15 +23,7 @@ interface WsData {
isDevice: boolean
}
interface DebugTarget {
webSocketDebuggerUrl: string
reactNative?: {
capabilities?: { prefersFuseboxFrontend?: boolean }
}
}
Bun.serve<WsData>({
hostname: PROXY_HOST,
port: PROXY_PORT,
async fetch(req, server) {
@@ -64,11 +55,10 @@ Bun.serve<WsData>({
// HTTP proxy
const upstream = `${METRO_BASE}${url.pathname}${url.search}`
const body = req.body ? await req.arrayBuffer() : undefined
const res = await fetch(upstream, {
method: req.method,
headers: forwardHeaders(req.headers),
body,
body: req.body,
redirect: "manual",
})
@@ -114,10 +104,14 @@ async function printDebuggerUrl() {
const res = await fetch(`${METRO_BASE}/json`)
if (!res.ok) return
const parsedTargets: unknown = await res.json()
if (!Array.isArray(parsedTargets)) return
interface DebugTarget {
webSocketDebuggerUrl: string
reactNative?: {
capabilities?: { prefersFuseboxFrontend?: boolean }
}
}
const targets = parsedTargets.filter(isDebugTarget)
const targets: DebugTarget[] = await res.json()
const target = targets.find((t) => t.reactNative?.capabilities?.prefersFuseboxFrontend)
if (!target) return
@@ -130,25 +124,4 @@ async function printDebuggerUrl() {
)
}
console.log(
`[proxy] listening on ${PROXY_HOST}:${PROXY_PORT}, forwarding to 127.0.0.1:${METRO_PORT}`,
)
function isDebugTarget(value: unknown): value is DebugTarget {
if (!isRecord(value) || typeof value.webSocketDebuggerUrl !== "string") return false
const reactNative = value.reactNative
if (reactNative === undefined) return true
if (!isRecord(reactNative)) return false
const capabilities = reactNative.capabilities
if (capabilities === undefined) return true
if (!isRecord(capabilities)) return false
const prefersFuseboxFrontend = capabilities.prefersFuseboxFrontend
return prefersFuseboxFrontend === undefined || typeof prefersFuseboxFrontend === "boolean"
}
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null
}
console.log(`[proxy] listening on :${PROXY_PORT}, forwarding to 127.0.0.1:${METRO_PORT}`)

View File

@@ -9,6 +9,7 @@ const tsIp = (await $`tailscale ip -4`.text()).trim()
const base = `http://${tsIp}:${PROXY_PORT}`
interface DebugTarget {
devtoolsFrontendUrl: string
webSocketDebuggerUrl: string
reactNative?: {
capabilities?: {
@@ -23,13 +24,7 @@ if (!res.ok) {
process.exit(1)
}
const parsedTargets: unknown = await res.json()
if (!Array.isArray(parsedTargets)) {
console.error("Invalid /json response from Metro.")
process.exit(1)
}
const targets = parsedTargets.filter(isDebugTarget)
const targets: DebugTarget[] = await res.json()
const target = targets.find((t) => t.reactNative?.capabilities?.prefersFuseboxFrontend)
if (!target) {
@@ -55,22 +50,3 @@ try {
console.log("Open the URL above in Chrome.")
}
}
function isDebugTarget(value: unknown): value is DebugTarget {
if (!isRecord(value) || typeof value.webSocketDebuggerUrl !== "string") return false
const reactNative = value.reactNative
if (reactNative === undefined) return true
if (!isRecord(reactNative)) return false
const capabilities = reactNative.capabilities
if (capabilities === undefined) return true
if (!isRecord(capabilities)) return false
const prefersFuseboxFrontend = capabilities.prefersFuseboxFrontend
return prefersFuseboxFrontend === undefined || typeof prefersFuseboxFrontend === "boolean"
}
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null
}

View File

@@ -3,7 +3,6 @@ set -euo pipefail
PROXY_PORT=8080
METRO_PORT=8081
TS_IP=$(tailscale ip -4)
# Start a reverse proxy so Metro sees all requests as loopback.
# This makes debugger endpoints (/debugger-frontend, /json, /open-debugger)
@@ -12,5 +11,5 @@ PROXY_PORT=$PROXY_PORT METRO_PORT=$METRO_PORT bun run scripts/dev-proxy.ts &
PROXY_PID=$!
trap "kill $PROXY_PID 2>/dev/null" EXIT
echo "Expo proxy: http://${TS_IP}:${PROXY_PORT}"
EXPO_PACKAGER_PROXY_URL=http://${TS_IP}:$PROXY_PORT bunx expo start --localhost -p $METRO_PORT
EXPO_PACKAGER_PROXY_URL=http://$(tailscale ip -4):$PROXY_PORT bunx expo start --localhost -p $METRO_PORT

View File

@@ -7,10 +7,6 @@
],
"type": "module",
"scripts": {
"expo": "cd apps/aelis-client && bun run start",
"drizzle-studio": "TS_IP=$(tailscale ip -4); echo \"Drizzle Studio: https://local.drizzle.studio/?host=${TS_IP}&port=4983\"; cd apps/aelis-backend && bunx drizzle-kit studio --host 0.0.0.0 --port 4983",
"aelis-backend": "TS_IP=$(tailscale ip -4); echo \"Aelis Backend: http://${TS_IP}:3000\"; echo \"\"; echo \"------------------ Bun Debugger ------------------\"; echo \"https://debug.bun.sh/#${TS_IP}:6499\"; echo \"------------------ Bun Debugger ------------------\"; echo \"\"; cd apps/aelis-backend && bun run dev",
"admin-dashboard": "TS_IP=$(tailscale ip -4); echo \"Admin Dashboard: http://${TS_IP}:5174\"; cd apps/admin-dashboard && bun run dev --host 0.0.0.0",
"test": "bun run --filter '*' test",
"lint": "oxlint .",
"lint:fix": "oxlint --fix .",