Repository navigation
feat: build standalone executables with Bun - #268
Merged
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Standalone executables of
sql-language-serverandsqlintbuilt withbun 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,.zipfor Windows) withchecksums.txt.bun-version(1.4.2). Bun 1.4+ is required: 1.3 has nonode:sqliteVerification
scripts/smoke-binary.mjs <dir>checks--version, an LSP session over stdio (lint diagnostics, and completion of a table read from a sqlite project throughnode:sqlite),sqlint --stdinandsqlint <file>binariescross-compiles everything on Linux;binaries-smokeruns the smoke test on Linux x64, Linux arm64, macOS arm64, macOS x64 (Rosetta on an arm64 runner) and WindowsRelease
.github/workflows/release-binaries.yamlruns on avX.Y.Ztag (or manually): checks the tag matchespackages/serverversion, builds, smoke-tests, attaches the archives,checksums.txtand a generated Homebrew formula to the GitHub ReleaseHOMEBREW_TAP_TOKENsecret is set, it also pushesFormula/sql-language-server.rbtojoe-re/homebrew-tap(brew install joe-re/tap/sql-language-server). Without it, that step is skipped.CLI fixes found with the executables
$0isbunin a compiled executable: setscriptNameand an explicit--versionfor both commandssqlint --stdinprinted nothing under Bun: stdin is now read withfor await, and theclose→process.exit(0)handler is removed. The file argument is taken from the command handler'sargvinstead of re-parsingprocess.argvTest plan
ruby -c