Skip to content

Migrate from Bun APIs to universal Node.js APIs#1

Merged
EvanBacon merged 4 commits into
mainfrom
worktree-migrate-to-node-apis
Apr 12, 2026
Merged

Migrate from Bun APIs to universal Node.js APIs#1
EvanBacon merged 4 commits into
mainfrom
worktree-migrate-to-node-apis

Conversation

@EvanBacon

Copy link
Copy Markdown
Owner

Summary

  • Replace all Bun-specific APIs (Bun.write, Bun.file, Bun.CryptoHasher, Bun.spawnSync, Bun.spawn, Bun.build, import.meta.dir) with standard Node.js equivalents (node:fs, node:crypto, node:child_process, node:url)
  • Replace Bun.build bundler with esbuild for the build script
  • Replace bun script runner with tsx for TypeScript execution
  • Swap @types/bun for @types/node + esbuild + tsx in devDependencies
  • Project now runs on any Node.js 18+ runtime without requiring Bun

Test plan

  • npx tsc --noEmit passes with zero errors
  • npx tsx scripts/build.ts produces build/cli.mjs (277 KB)
  • npx tsx src/cli.ts --list lists templates correctly
  • npx tsx src/cli.ts MyApp -y generates a valid Xcode project

🤖 Generated with Claude Code

EvanBacon and others added 4 commits April 11, 2026 16:58
Replace all Bun-specific APIs with standard Node.js equivalents so the
project runs on any Node.js 18+ runtime:

- Bun.CryptoHasher -> node:crypto createHash
- Bun.spawnSync -> node:child_process execSync
- Bun.spawn -> node:child_process execFile
- Bun.write / Bun.file -> node:fs writeFileSync / readFileSync
- Bun.build -> esbuild
- import.meta.dir -> fileURLToPath + dirname
- @types/bun -> @types/node
- bun script runner -> tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert scripts back to Bun APIs (build, extract-templates) — these are
dev-only and don't ship. Only src/ (cli.ts, generator.ts) uses Node.js
APIs so the bundled output runs on any Node 18+ runtime.

- Build target changed from "bun" to "node"
- Built shebang changed from #!/usr/bin/env bun to #!/usr/bin/env node
- Scripts and test runner remain on Bun

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@EvanBacon EvanBacon force-pushed the worktree-migrate-to-node-apis branch from bebac97 to dbfd707 Compare April 11, 2026 23:58
@EvanBacon EvanBacon merged commit 2dc0863 into main Apr 12, 2026
2 checks passed
@EvanBacon EvanBacon deleted the worktree-migrate-to-node-apis branch April 12, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants