This is a simple SQL formatter that handles formatting whitespace and capitalization of keywords. I originally wrote it for the purpose of learning Elm, but it soon became a project where I could try out languages that I'm unfamiliar with and see how many different languages can be compiled down to JavaScript. Most of the languages used, plus a lot of others, can be found here.
The app logic in each language is compiled to JavaScript using various Webpack loaders, some of which I implemented as wrappers around shell commands. The current languages are:
Check it out at http://mattdziuban.com/sql-formatter/.
Install npm dependencies first with npm install, then follow the steps for each language below.
Find the correct Dart SDK URL for the desired version and OS here, then run the following:
mkdir -p "$HOME/.dart"
curl -L <dart-sdk-url> -o "$HOME/.dart/dart.zip"
unzip -q "$HOME/.dart/dart.zip" -d "$HOME/.dart"
export PATH="$HOME/.dart/dart-sdk/bin:$PATH"
pub getFirst, install Erlang and Elixir. On Mac, you can install Erlang with brew install erlang. To install Elixir, I
recommend using Kiex.
Then install ElixirScript:
export EXS_VERSION=56cb2c5
mkdir -p "$HOME/.elixirscript/$EXS_VERSION"
curl -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"
export PATH="$HOME/.elixirscript/$EXS_VERSION/dist/elixirscript/bin:$PATH"Install Elm packages:
$(npm bin)/elm-package installThe ES6 build doesn't require any additional dependencies!
Install F#. On Mac, you can run brew install mono. On Linux, check out the docs.
First, install Go 1.8, then run:
go get -u github.com/gopherjs/gopherjsFirst, install Ruby if you don't already have it. I recommend using RVM. Then run:
bundle installInstall PHP (any version 5.3-5.6 should work fine), then install PHPUnit:
mkdir -p "$HOME/.phpunit/bin"
curl -sL https://phar.phpunit.de/phpunit-4.8.phar -o "$HOME/.phpunit/bin/phpunit"
chmod +x "$HOME/.phpunit/bin/phpunit"
export PATH="$HOME/.phpunit/bin:$PATH"Install psc-package and install dependencies:
export PSC_PACKAGE_VERSION=0.2.5
mkdir -p "$HOME/.psc-package/$PSC_PACKAGE_VERSION"
# Replace macos with linux64 if necessary
curl -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
export PATH="$HOME/.psc-package/$PSC_PACKAGE_VERSION:$PATH"
psc-package updateRust has the most experimental compilation process, using support for WebAssembly via nightly builds. Run the following:
# Install Rust
curl -L https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly
source ~/.cargo/env
rustup target add wasm32-unknown-unknown
cargo install cargo-webRun the following to setup SBT:
export SBT_VERSION=0.13.15
mkdir -p "$HOME/.sbt-bin/$SBT_VERSION"
curl -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
export PATH="$HOME/.sbt-bin/$SBT_VERSION/bin:$PATH"Compile all code to JavaScript:
npm run compileThe compile command accepts comma-separated only and exclude arguments to filter what languages are compiled,
e.g.
# Only compile ES6 and Opal
npm run compile -- --env.only es6,opal
# Compile everything but GopherJS and Dart
npm run compile -- --env.exclude gopherjs,dartRun the Webpack dev server:
npm run devNote: The dev command also accepts the only and exclude arguments mentioned above
Then visit http://localhost:8000 in your browser.
Tests are run using a variety tools to match the different languages. To run them:
npm run testnpm run distNote: The dist command also accepts the only and exclude arguments mentioned above
Deployment to GitHub pages is scripted.
