{"id":13821893,"url":"https://github.com/mrdziuban/sql-formatter","last_synced_at":"2026-01-24T18:49:22.636Z","repository":{"id":71193619,"uuid":"81376416","full_name":"mrdziuban/sql-formatter","owner":"mrdziuban","description":"Polyglot SQL formatter","archived":false,"fork":false,"pushed_at":"2018-10-21T14:23:40.000Z","size":2658,"stargazers_count":28,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-28T02:43:37.670Z","etag":null,"topics":["formatter","polyglot","sql","whitespace"],"latest_commit_sha":null,"homepage":"http://mattdziuban.com/sql-formatter/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrdziuban.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-02-08T21:12:40.000Z","updated_at":"2022-10-22T14:10:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"de17bf7e-ca0c-40a9-b747-f0703a7bfc35","html_url":"https://github.com/mrdziuban/sql-formatter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdziuban%2Fsql-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdziuban%2Fsql-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdziuban%2Fsql-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdziuban%2Fsql-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrdziuban","download_url":"https://codeload.github.com/mrdziuban/sql-formatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213893315,"owners_count":15653524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formatter","polyglot","sql","whitespace"],"created_at":"2024-08-04T08:01:32.755Z","updated_at":"2026-01-24T18:49:22.584Z","avatar_url":"https://github.com/mrdziuban.png","language":"JavaScript","readme":"# SQL Formatter\n\n[![Build Status](https://travis-ci.org/mrdziuban/sql-formatter.svg?branch=master)](https://travis-ci.org/mrdziuban/sql-formatter)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Setup](#setup)\n  - [Dart](#dart)\n  - [ElixirScript](#elixirscript)\n  - [Elm](#elm)\n  - [ES6](#es6)\n  - [Fable](#fable)\n  - [GopherJS](#gopherjs)\n  - [Opal](#opal)\n  - [PHP](#php)\n  - [PureScript](#purescript)\n  - [Rust](#rust)\n  - [Scala.js](#scalajs)\n- [Development](#development)\n  - [Compile](#compile)\n    - [Compile certain languages](#compile-certain-languages)\n  - [Run](#run)\n  - [Test](#test)\n  - [Build for production](#build-for-production)\n- [Deployment](#deployment)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\nThis is a simple SQL formatter that handles formatting whitespace and capitalization of keywords. I originally wrote\nit for the purpose of learning Elm, but it soon became a project where I could try out languages that I'm\nunfamiliar with and see how many different languages can be compiled down to JavaScript. Most of the languages used,\nplus a lot of others, can be\n[found here](https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js).\n\nThe app logic in each language is compiled to JavaScript using various Webpack loaders,\n[some of which I implemented as wrappers around shell commands](https://github.com/mrdziuban?utf8=%E2%9C%93\u0026tab=repositories\u0026q=-loader\u0026type=\u0026language=).\nThe current languages are:\n\n- [Dart](#dart)\n- [ElixirScript](#elixirscript)\n- [Elm](#elm)\n- [ES6](#es6)\n- [Fable](#fable)\n- [GopherJS](#gopherjs)\n- [Opal](#opal)\n- [PHP](#php)\n- [PureScript](#purescript)\n- [Rust](#rust)\n- [Scala.js](#scalajs)\n\nCheck it out at [http://mattdziuban.com/sql-formatter/](http://mattdziuban.com/sql-formatter/).\n\n![demo](https://cloud.githubusercontent.com/assets/4718399/22834351/d7d838ee-ef82-11e6-8556-ef36db229229.gif)\n\n## Setup\n\nInstall npm dependencies first with `npm install`, then follow the steps for each language below.\n\n### Dart\n\n[Find the correct Dart SDK URL for the desired version and OS here](https://www.dartlang.org/install/archive),\nthen run the following:\n\n```bash\nmkdir -p \"$HOME/.dart\"\ncurl -L \u003cdart-sdk-url\u003e -o \"$HOME/.dart/dart.zip\"\nunzip -q \"$HOME/.dart/dart.zip\" -d \"$HOME/.dart\"\nexport PATH=\"$HOME/.dart/dart-sdk/bin:$PATH\"\npub get\n```\n\n### ElixirScript\n\nFirst, install Erlang and Elixir. On Mac, you can install Erlang with `brew install erlang`. To install Elixir, I\nrecommend using [Kiex](https://github.com/taylor/kiex).\n\nThen install ElixirScript:\n\n```bash\nexport EXS_VERSION=56cb2c5\nmkdir -p \"$HOME/.elixirscript/$EXS_VERSION\"\ncurl -o- -L https://s3.amazonaws.com/mrdziuban-resources/elixirscript-$EXS_VERSION.tar.gz -o \"$HOME/.elixirscript/elixirscript-$EXS_VERSION.tar.gz\" | tar xvzf - -C \"$HOME/.elixirscript/$EXS_VERSION\"\nexport PATH=\"$HOME/.elixirscript/$EXS_VERSION/dist/elixirscript/bin:$PATH\"\n```\n\n### Elm\n\nInstall Elm packages:\n\n```bash\n$(npm bin)/elm-package install\n```\n\n### ES6\n\nThe ES6 build doesn't require any additional dependencies!\n\n### Fable\n\nInstall F#. On Mac, you can run `brew install mono`. On Linux, [check out the docs](http://fsharp.org/use/linux/).\n\n### GopherJS\n\nFirst, [install Go 1.8](https://golang.org/dl/), then run:\n\n```bash\ngo get -u github.com/gopherjs/gopherjs\n```\n\n### Opal\n\nFirst, install Ruby if you don't already have it. I recommend using [RVM](https://rvm.io/). Then run:\n\n```bash\nbundle install\n```\n\n### PHP\n\nInstall PHP (any version 5.3-5.6 should work fine), then install PHPUnit:\n\n```bash\nmkdir -p \"$HOME/.phpunit/bin\"\ncurl -sL https://phar.phpunit.de/phpunit-4.8.phar -o \"$HOME/.phpunit/bin/phpunit\"\nchmod +x \"$HOME/.phpunit/bin/phpunit\"\nexport PATH=\"$HOME/.phpunit/bin:$PATH\"\n```\n\n### PureScript\n\nInstall psc-package and install dependencies:\n\n```bash\nexport PSC_PACKAGE_VERSION=0.2.5\nmkdir -p \"$HOME/.psc-package/$PSC_PACKAGE_VERSION\"\n# Replace macos with linux64 if necessary\ncurl -o- -sL https://github.com/purescript/psc-package/releases/download/v$PSC_PACKAGE_VERSION/macos.tar.gz | tar xzf - -C \"$HOME/.psc-package/$PSC_PACKAGE_VERSION\" --strip-components 1\nexport PATH=\"$HOME/.psc-package/$PSC_PACKAGE_VERSION:$PATH\"\npsc-package update\n```\n\n### Rust\n\nRust has the most experimental compilation process, using\n[support for WebAssembly via nightly builds](https://www.hellorust.com/news/native-wasm-target.html). Run the following:\n\n```bash\n# Install Rust\ncurl -L https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly\nsource ~/.cargo/env\nrustup target add wasm32-unknown-unknown\ncargo install cargo-web\n```\n\n### Scala.js\n\nRun the following to setup SBT:\n\n```bash\nexport SBT_VERSION=0.13.15\nmkdir -p \"$HOME/.sbt-bin/$SBT_VERSION\"\ncurl -o- -L https://dl.bintray.com/sbt/native-packages/sbt/$SBT_VERSION/sbt-$SBT_VERSION.tgz | tar xvzf - -C \"$HOME/.sbt-bin/$SBT_VERSION\" --strip-components 1\nexport PATH=\"$HOME/.sbt-bin/$SBT_VERSION/bin:$PATH\"\n```\n\n## Development\n\n### Compile\n\nCompile all code to JavaScript:\n\n```bash\nnpm run compile\n```\n\n#### Compile certain languages\n\nThe `compile` command accepts comma-separated `only` and `exclude` arguments to filter what languages are compiled,\ne.g.\n\n```bash\n# Only compile ES6 and Opal\nnpm run compile -- --env.only es6,opal\n\n# Compile everything but GopherJS and Dart\nnpm run compile -- --env.exclude gopherjs,dart\n```\n\n### Run\n\nRun the Webpack dev server:\n\n```bash\nnpm run dev\n```\n\n*Note: The `dev` command also accepts the `only` and `exclude` arguments mentioned above*\n\nThen visit [http://localhost:8000](http://localhost:8000) in your browser.\n\n### Test\n\nTests are run using a variety tools to match the different languages. To run them:\n\n```bash\nnpm run test\n```\n\n### Build for production\n\n```bash\nnpm run dist\n```\n\n*Note: The `dist` command also accepts the `only` and `exclude` arguments mentioned above*\n\n## Deployment\n\nDeployment to GitHub pages is [scripted](bin/deploy).\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdziuban%2Fsql-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrdziuban%2Fsql-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdziuban%2Fsql-formatter/lists"}