Skip to content

Commit cf1b054

Browse files
yasserfclaude
andcommitted
feat: bun first-class support
Adds first-class Bun support, rebuilt cleanly on top of latest main so it carries only Bun-related changes (the earlier branch had accumulated unrelated changesets, docs, and a stale db-codegen snapshot already superseded in main). - @pikku/bun-server: Bun HTTP + WebSocket runtime with health checks and graceful shutdown. - @pikku/kysely-bun-sqlite: Bun-native SQLite Kysely adapter + coercion plugin. - templates/bun + verifiers/bun-server: Bun starter template and verifier. - CI: Bun added to the template matrix; setup-bun + dist .d.ts in the build artifact for Bun file: deps. - create: --skip-install so the CI harness can patch deps before installing. - test-template.sh: Bun package-manager path. Its file: patch now scans templates/ too, forces every @pikku/* to the in-repo copy via bun overrides, and de-duplicates deps across dependency types (a package in both dependencies and devDependencies made bun emit a broken self-referential symlink, breaking tsc/runtime resolution). - tsconfig/skipLibCheck and node:test-mock shims so non-Bun verifiers and core tests tolerate bun-types / Bun's node:test. Also untracks .claude/scheduled_tasks.lock and gitignores it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5dc6362 commit cf1b054

51 files changed

Lines changed: 1404 additions & 92 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@pikku/bun-server': patch
3+
'@pikku/kysely-bun-sqlite': patch
4+
---
5+
6+
feat: bun first-class support — new `@pikku/bun-server` runtime and `@pikku/kysely-bun-sqlite` dialect, bun template, CI matrix with `package-manager: [yarn, bun]`, and bun verifier.

.claude/scheduled_tasks.lock

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/actions/build/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ runs:
8282
with:
8383
name: build-output
8484
path: |
85-
packages/**/dist
86-
packages/**/bin
87-
templates/**/.pikku
88-
templates/**/dist
85+
packages/**/dist/**
86+
packages/**/bin/**
87+
templates/**/.pikku/**
88+
templates/**/dist/**
8989
include-hidden-files: true
9090
retention-days: 1
9191

.github/actions/setup/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ runs:
1818
with:
1919
node-version: ${{ inputs.node-version }}
2020
cache: yarn
21+
- uses: oven-sh/setup-bun@v2
22+
with:
23+
bun-version: latest
2124
- name: Download build output
2225
if: ${{ inputs.download-build == 'true' }}
2326
uses: actions/download-artifact@v4

.github/workflows/develop.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
steps:
6464
- uses: actions/checkout@v4
6565
- name: Install native build tools
66-
run: apt-get update && apt-get install -y build-essential python3
66+
run: apt-get update && apt-get install -y build-essential python3 unzip
6767
- uses: ./.github/actions/setup
6868
- uses: ./.github/actions/e2e-codegen
6969
- name: Run e2e tests
@@ -225,16 +225,32 @@ jobs:
225225
remote-rpc-pg,
226226
remote-rpc-redis,
227227
ai-postgres,
228+
bun,
228229
]
229-
package-manager: [yarn]
230+
package-manager: [yarn, bun]
231+
exclude:
232+
- package-manager: bun
233+
template: uws
234+
- package-manager: bun
235+
template: aws-lambda
236+
- package-manager: bun
237+
template: aws-lambda-websocket
238+
- package-manager: bun
239+
template: cloudflare-workers
240+
- package-manager: bun
241+
template: cloudflare-websocket
242+
- package-manager: bun
243+
template: nextjs
244+
- package-manager: bun
245+
template: nextjs-full
230246
steps:
231247
- uses: actions/checkout@v4
232248
- uses: ./.github/actions/setup
233249
with:
234250
node-version: ${{ matrix.version }}
235251
- name: Test template
236252
timeout-minutes: 2
237-
run: ./scripts/test-template.sh ${{ matrix.template }} ${{ github.ref_name }}
253+
run: ./scripts/test-template.sh ${{ matrix.template }} ${{ github.ref_name }} ${{ matrix.package-manager }}
238254
env:
239255
TEMPLATE_V8_COVERAGE_DIR: ${{ runner.temp }}/template-coverage/${{ matrix.template }}/raw
240256
- name: Generate template coverage report

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ typings/
139139

140140
# Claude Code worktrees
141141
.claude/worktrees/
142+
.claude/scheduled_tasks.lock
143+
144+
# Bun lockfile — repo is yarn-based; bun is only used to run `bun test` against
145+
# the yarn-installed node_modules, so its lockfile is not tracked.
146+
bun.lock
142147

143148
# Bun build cache
144149
*.bun-build

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"test:e2e:ai": "yarn workspace @pikku/e2e test:ai",
4646
"test": "yarn workspaces foreach -A --exclude '@pikku/templates-*' --exclude '@pikku/verifiers-*' --exclude '@pikku/addon-console' --exclude '@pikku/console' --exclude '@pikku/e2e' run test",
4747
"test:coverage": "yarn workspaces foreach -A run test:coverage",
48+
"test:bun": "bun test packages/core/src packages/openapi-parser/src packages/openapi-to-zod-schema/src packages/pikku/src packages/runtimes/cloudflare/src packages/schedule/src packages/services/kysely-bun-sqlite/src",
4849
"lint": "npx --yes oxlint@latest",
4950
"prettier": "npx --yes prettier . --write --log-level warn",
5051
"typedoc": "npx --yes typedoc --tsconfig tsconfig.typedoc.json",

packages/cli/build.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,26 @@ trap 'rm -rf "$_bootstrap_dir"' EXIT
2020
# module load, so it must be installed alongside it. This stays @pikku/auth-js
2121
# until a CLI release that imports @pikku/better-auth is published, after which
2222
# this should flip to "@pikku/better-auth".
23-
npm install --prefix "$_bootstrap_dir" --no-save --no-package-lock \
24-
"@pikku/cli@${PIKKU_CLI_VERSION}" "@pikku/auth-js"
23+
#
24+
# The `overrides` neutralises an unconverted `workspace:*` specifier that can
25+
# leak into a published @pikku/cli manifest (e.g. @pikku/cli@0.12.36 shipped
26+
# `@pikku/better-auth: workspace:*`, which npm cannot resolve). Declaring the
27+
# bootstrap deps in a package.json is what lets the override apply during
28+
# resolution — npm ignores `overrides` for packages passed as install args.
29+
cat > "$_bootstrap_dir/package.json" <<JSON
30+
{
31+
"name": "pikku-bootstrap",
32+
"private": true,
33+
"dependencies": {
34+
"@pikku/cli": "${PIKKU_CLI_VERSION}",
35+
"@pikku/auth-js": "latest"
36+
},
37+
"overrides": {
38+
"@pikku/better-auth": "latest"
39+
}
40+
}
41+
JSON
42+
(cd "$_bootstrap_dir" && npm install --no-save --no-package-lock)
2543
"$_bootstrap_dir/node_modules/.bin/pikku"
2644
rm -rf "$_bootstrap_dir"
2745

@@ -84,7 +102,12 @@ yarn tsc -b
84102

85103
# Copy schema file
86104
echo "Copying schema file..."
87-
cp .pikku/schemas/schemas/PikkuCLIConfig.schema.json cli.schema.json
105+
schema_src=$(find .pikku/schemas -maxdepth 2 -name "PikkuCLIConfig.schema.json" | head -1)
106+
if [ -n "$schema_src" ]; then
107+
cp "$schema_src" cli.schema.json
108+
else
109+
echo "Warning: PikkuCLIConfig.schema.json not found, skipping schema copy"
110+
fi
88111

89112
echo "Copying console app..."
90113
rm -rf console-app

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"picoquery": "^2.5.0"
6161
},
6262
"devDependencies": {
63+
"@types/json-schema": "^7.0.15",
6364
"@types/node": "^24.11.0",
6465
"tsx": "^4.21.0",
6566
"typescript": "^5.9"

packages/core/src/dev/hot-reload.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ const ensureRecursiveWatchAvailable = async (
3232
t: TestContext,
3333
dir: string
3434
): Promise<boolean> => {
35+
if ('bun' in process.versions) {
36+
t.skip('tsx esm dynamic reload not supported under bun')
37+
return false
38+
}
39+
3540
if (process.platform === 'darwin') {
3641
t.skip('recursive fs.watch is unreliable on darwin')
3742
return false

0 commit comments

Comments
 (0)