@ngandu-dev/query-formatter
v2.0.2
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 the repository contributing guide, Code of Conduct, and pull request template.
Security
Please report vulnerabilities privately according to the repository security policy.
License
Released under the MIT License.
