Add phoenix documentation and full pre-commit.

pull/12/head
Joshua Potter 2023-12-02 06:32:19 -07:00
parent 17b2076711
commit 62bb6b202e
2 changed files with 18 additions and 5 deletions

View File

@ -1,13 +1,24 @@
#!/usr/bin/env bash
set -e
filesToFormat=$(
mixFiles=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
)
for path in $filesToFormat
for path in $mixFiles
do
mix format "$path"
git add "$path"
done
webFiles=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
)
for path in $webFiles
do
prettier --write "$path"
git add "$path"
done

View File

@ -78,12 +78,14 @@ supports lock versions 1 and 2.
## Language Server
The [elixir-ls](https://github.com/elixir-lsp/elixir-ls) LSP (version 0.17.10)
is included in this flake.
and [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server)
(version 4.1.2) is included in this flake.
## Formatting
Formatting depends on the `mix format` task. A `pre-commit` hook is included in
`.githooks` that can be used to format all `*.exs?` files prior to commit.
Formatting depends on [prettier](https://prettier.io/) (version 3.1.0) and the
`mix format` task. A `pre-commit` hook is included in `.githooks` that can be
used to format all `*.exs?`, `*.jsx?`, and `*.tsx?` files prior to commit.
Install via:
```bash
$ git config --local core.hooksPath .githooks/