@ngandu-dev/query-formatter
v2.0.0
Published
Format, compress, and highlight SQL in TypeScript and Node.js.
Maintainers
Readme
@ngandu-dev/query-formatter
Format, compress, and highlight SQL in TypeScript, Node.js, or a terminal.
Features
- Readable SQL formatting
- Compact SQL compression
- Terminal and HTML syntax highlighting
sql-forgecommand-line interface- No database or query-builder dependency
Requirements
- Node.js 20 or newer
Installation
bun add @ngandu-dev/query-formatterQuick start
import { 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");Usage
Use the lower-level SqlFormatter, HtmlHighlighter, CliHighlighter, or NullHighlighter classes when you need explicit output control.
bunx sql-forge ./query.sqlDevelopment
bun run --filter @ngandu-dev/query-formatter format
bun run --filter @ngandu-dev/query-formatter typecheckTesting
bun run --filter @ngandu-dev/query-formatter testContributing
See CONTRIBUTING.md and the repository pull request template.
Security
Please report vulnerabilities privately according to SECURITY.md.
License
Released under the MIT License.
