Skip to content

feat: build standalone executables with Bun - #268

Merged
joe-re merged 2 commits into
releasefrom
feat/bun-binary
Sep 28, 2026
Merged

joe-re merged 2 commits into
releasefrom
feat/bun-binary

Conversation

@joe-re

@joe-re joe-re commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Standalone executables of sql-language-server and sqlint built with bun build --compile, so they can be installed without Node.js (Homebrew / GitHub Releases).

Build

  • pnpm build:binary [target ...] (scripts/build-binaries.mjs) builds both commands for darwin-arm64, darwin-x64, linux-x64, linux-arm64, windows-x64 and packs one archive per platform (.tar.gz, .zip for Windows) with checksums.txt
  • Bun is pinned in .bun-version (1.4.2). Bun 1.4+ is required: 1.3 has no node:sqlite
  • ssh2's optional native addons are marked external (it falls back to pure JS)
  • Executables are ~65 MB each, archives ~52 MB

Verification

  • scripts/smoke-binary.mjs <dir> checks --version, an LSP session over stdio (lint diagnostics, and completion of a table read from a sqlite project through node:sqlite), sqlint --stdin and sqlint <file>
  • New CI jobs: binaries cross-compiles everything on Linux; binaries-smoke runs the smoke test on Linux x64, Linux arm64, macOS arm64, macOS x64 (Rosetta on an arm64 runner) and Windows

Release

  • .github/workflows/release-binaries.yaml runs on a vX.Y.Z tag (or manually): checks the tag matches packages/server version, builds, smoke-tests, attaches the archives, checksums.txt and a generated Homebrew formula to the GitHub Release
  • If a HOMEBREW_TAP_TOKEN secret is set, it also pushes Formula/sql-language-server.rb to joe-re/homebrew-tap (brew install joe-re/tap/sql-language-server). Without it, that step is skipped.

CLI fixes found with the executables

  • $0 is bun in a compiled executable: set scriptName and an explicit --version for both commands
  • sqlint --stdin printed nothing under Bun: stdin is now read with for await, and the close → process.exit(0) handler is removed. The file argument is taken from the command handler's argv instead of re-parsing process.argv

Test plan

  • Local: darwin-arm64 executables pass the smoke test (7/7)
  • build / lint / typecheck / all tests
  • Generated formula passes ruby -c
  • CI: cross-compile + smoke tests on all five platforms (7/7 checks each)

- scripts/build-binaries.mjs builds sql-language-server and sqlint with
  `bun build --compile` for darwin-arm64 / darwin-x64 / linux-x64 /
  linux-arm64 / windows-x64 and packs them per platform with checksums
  (pnpm build:binary). Bun is pinned in .bun-version; 1.4+ is required for
  node:sqlite.
- scripts/smoke-binary.mjs checks --version, an LSP session over stdio
  (diagnostics, and completion of a table read through node:sqlite) and
  sqlint, and runs in CI on Linux x64 / arm64, macOS arm64 / x64 (Rosetta)
  and Windows.
- release-binaries workflow attaches the archives to the GitHub Release of
  a vX.Y.Z tag, generates a Homebrew formula (scripts/homebrew-formula.mjs)
  and updates joe-re/homebrew-tap when HOMEBREW_TAP_TOKEN is set.
- sql-language-server / sqlint: set the command name and --version, since
  $0 is `bun` in a compiled executable.
- sqlint: read the whole stdin with for await; the `close` handler exited
  before --stdin input was linted under Bun. Take the file from the command
  arguments instead of re-parsing process.argv.
- README: installation with Homebrew and standalone executables.
@joe-re
joe-re merged commit dbab8d8 into release Sep 28, 2026
11 checks passed
@joe-re
joe-re deleted the feat/bun-binary branch September 28, 2026 11:25
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.

1 participant