Format, compress, and highlight SQL in TypeScript, Node.js, or a terminal.
- Readable SQL formatting
- Compact SQL compression
- Terminal and HTML syntax highlighting
sql-forgecommand-line interface- No database or query-builder dependency
- Node.js 20 or newer
bun add @ngandu-dev/query-formatterimport { compress, format, highlight } from "@ngandu-dev/query-formatter";
format("SELECT id,name FROM users WHERE active=1");
compress("SELECT id, name\nFROM users");
highlight("SELECT * FROM users");Use the lower-level SqlFormatter, HtmlHighlighter, CliHighlighter, or NullHighlighter classes when you need explicit output control.
bunx sql-forge ./query.sqlbun run --filter @ngandu-dev/query-formatter format
bun run --filter @ngandu-dev/query-formatter typecheckbun run --filter @ngandu-dev/query-formatter testSee the repository contributing guide, Code of Conduct, and pull request template.
Please report vulnerabilities privately according to the repository security policy.
Released under the MIT License.