Skip to content

Commit

Permalink
Make prettier_eex_formatter work on OTP 21 and 22 (#39)
Browse files Browse the repository at this point in the history
Use OTP 21 to build prettier_eex_formatter
  • Loading branch information
adamzapasnik authored Apr 25, 2021
1 parent 113c7b5 commit 039f242
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 4 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ jobs:
with:
submodules: 'true'

- uses: erlef/setup-elixir@v1
# Used to build prettier_eex_formatter
# Versions from prettier_eex_formatter/.tools_versions
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
otp-version: '21.3.8.22'
elixir-version: '1.8.2'

- uses: actions/setup-node@v2
with:
Expand All @@ -49,3 +51,14 @@ jobs:
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn test

- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}

- name: Test Elixir integration
run: |
cd tests_elixir
elixir --version
mix prettier
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to the prettier-plugin-eex will be documented in this file.
- Return non 0 exit status when error formatting is unsuccessful
- Use `print` function instead of `embed` to fix error logging
- Fix formatting of files that consist of only a single expression
- Make `prettier_eex_formatter` work on 21 and 22 OTP

## v0.4.0 - 24 February 2021

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
yarn add -D prettier prettier-plugin-eex
```

## Supported versions

- Elixir 1.8 minimum
- Erlang OTP 21 minimum

## Config options

* printWidth - used by Prettier directly
Expand Down
2 changes: 1 addition & 1 deletion prettier_eex_formatter
20 changes: 20 additions & 0 deletions tests_elixir/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez
6 changes: 6 additions & 0 deletions tests_elixir/formatted_views/multiline.html.eex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<%=
link_to(
a: "b",
c: "e"
)
%>
18 changes: 18 additions & 0 deletions tests_elixir/mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule TestsElixir.MixProject do
use Mix.Project

def project do
[
app: :tests_elixir,
version: "0.1.0",
elixir: "~> 1.8",
aliases: aliases()
]
end

def aliases do
[
prettier: "cmd ../node_modules/.bin/prettier --plugin ../ --check ./formatted_views --color"
]
end
end

0 comments on commit 039f242

Please sign in to comment.