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 #!/usr/bin/env bash
set -e set -e
filesToFormat=$( mixFiles=$(
git --no-pager diff --name-status --no-color --cached | \ git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}' awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
) )
for path in $filesToFormat for path in $mixFiles
do do
mix format "$path" mix format "$path"
git add "$path" git add "$path"
done 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 ## Language Server
The [elixir-ls](https://github.com/elixir-lsp/elixir-ls) LSP (version 0.17.10) 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
Formatting depends on the `mix format` task. A `pre-commit` hook is included in Formatting depends on [prettier](https://prettier.io/) (version 3.1.0) and the
`.githooks` that can be used to format all `*.exs?` files prior to commit. `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: Install via:
```bash ```bash
$ git config --local core.hooksPath .githooks/ $ git config --local core.hooksPath .githooks/