feat: migrate from npm to bun and fix analytics map height
Switch package manager and runtime from Node.js/npm to Bun across Docker, CI, and scripts. The SQLite driver remains better-sqlite3 due to Next.js Turbopack being unable to resolve bun:sqlite during build-time page pre-rendering. Also fix the world map not rendering in the analytics page — the overflowX wrapper added for mobile broke the flex height chain, collapsing the map to 0px. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ node_modules
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
package-lock.json
|
||||
|
||||
# Build outputs
|
||||
.next
|
||||
|
||||
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@@ -22,14 +22,13 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v6
|
||||
- name: Set up Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run unit and integration tests
|
||||
run: npm test
|
||||
run: bun run test
|
||||
|
||||
@@ -509,11 +509,9 @@ export default function AnalyticsClient() {
|
||||
<Typography variant="subtitle1" fontWeight={600} sx={{ mb: 1 }}>
|
||||
Traffic by Country
|
||||
</Typography>
|
||||
<Box sx={{ flex: 1, minHeight: 0 }}>
|
||||
<Box sx={{ overflowX: "auto", width: "100%" }}>
|
||||
<Box sx={{ flex: 1, minHeight: 280 }}>
|
||||
<WorldMap data={countries} selectedCountry={selectedCountry} />
|
||||
</Box>
|
||||
</Box>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Grid>
|
||||
|
||||
@@ -65,7 +65,7 @@ services:
|
||||
networks:
|
||||
- caddy-network
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
FROM node:25-slim AS base
|
||||
FROM oven/bun:1-slim AS base
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS deps
|
||||
@@ -12,9 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY package.json package-lock.json* ./
|
||||
# Install dependencies
|
||||
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
FROM base AS builder
|
||||
ENV NODE_ENV=production
|
||||
@@ -25,7 +24,7 @@ ENV DATABASE_URL=file:/tmp/build.db
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
# Build the Next.js application
|
||||
RUN npm run build && rm -f /tmp/build.db
|
||||
RUN bun run build && rm -f /tmp/build.db
|
||||
|
||||
FROM base AS runner
|
||||
# Accept build args for user/group IDs to support rootless operation
|
||||
|
||||
@@ -8,4 +8,4 @@ echo "Ensuring database directory exists..."
|
||||
mkdir -p "$DB_DIR"
|
||||
|
||||
echo "Starting application..."
|
||||
exec env HOSTNAME=0.0.0.0 node server.js
|
||||
exec env HOSTNAME=0.0.0.0 bun server.js
|
||||
|
||||
7925
package-lock.json
generated
7925
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -44,6 +44,7 @@
|
||||
"topojson-client": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@next/eslint-plugin-next": "^16.1.7",
|
||||
"@playwright/test": "^1.58.2",
|
||||
|
||||
@@ -20,16 +20,16 @@ typecheck_status=0
|
||||
vitest_status=0
|
||||
e2e_status=0
|
||||
|
||||
run_step "Lint" npm run lint
|
||||
run_step "Lint" bun run lint
|
||||
lint_status=$?
|
||||
|
||||
run_step "Typecheck" npm run typecheck
|
||||
run_step "Typecheck" bun run typecheck
|
||||
typecheck_status=$?
|
||||
|
||||
run_step "Vitest" npm run test
|
||||
run_step "Vitest" bun run test
|
||||
vitest_status=$?
|
||||
|
||||
run_step "Playwright" npm run test:e2e
|
||||
run_step "Playwright" bun run test:e2e
|
||||
e2e_status=$?
|
||||
|
||||
printf '\n==> Summary\n'
|
||||
|
||||
Reference in New Issue
Block a user