Skip to content

Commit 0c69536

Browse files
Add purs-tidy (#22)
1 parent b53fdfc commit 0c69536

File tree

12 files changed

+104
-85
lines changed

12 files changed

+104
-85
lines changed

.github/workflows/integration.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ jobs:
1919

2020
- uses: ./ # equivalent to purescript-contrib/setup-purescript@<branch>
2121
with:
22+
purs-tidy: "latest"
2223
zephyr: "latest"
2324

2425
- name: Check spago and purs are installed correctly
2526
run: |
2627
purs --version
2728
spago version
2829
29-
# - name: Check zephyr is installed correctly
30-
# run: zephyr -f Main.main
30+
- name: Check purs-tidy is installed
31+
run: |
32+
purs-tidy --help

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A GitHub Action which sets up a PureScript toolchain for CI. Contains the follow
1212

1313
You can also optionally include the following tools:
1414

15+
- The [`purs-tidy` code formatter](https://github.com/natefaubion/purs-tidy)
1516
- The [Zephyr dead code elimination tool](https://github.com/coot/zephyr)
1617

1718
This action is designed to support PureScript tools. Your PureScript project may also depend on tooling and libraries provided by the NPM ecosystem, in which case you will also want to use the [setup-node](https://github.com/actions/setup-node) action.
@@ -45,6 +46,7 @@ steps:
4546
purescript: "0.14.0"
4647
psa: "0.8.2"
4748
spago: "latest"
49+
purs-tidy: "latest"
4850
zephyr: "0.3.2"
4951
- run: spago build
5052
```

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ inputs:
1111
psa:
1212
description: "The psa version to install. Examples: latest, 0.7.2"
1313
default: "latest"
14+
purs-tidy:
15+
description: "The purs-tidy version to install. Examples: latest, 0.1.1"
1416
zephyr:
1517
description: "The Zephyr version to install. Examples: latest, 0.3.2"
1618
runs:

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/update.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"purs": "0.14.3",
33
"spago": "0.20.3",
44
"psa": "0.8.2",
5+
"purs-tidy": "0.1.1",
56
"zephyr": "0.3.2"
6-
}
7+
}

spago.dhall

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
, "integers"
1717
, "math"
1818
, "maybe"
19-
, "newtype"
2019
, "node-buffer"
2120
, "node-fs"
2221
, "node-path"

src/Setup/BuildPlan.purs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Data.Bifunctor (lmap)
1010
import Data.Either (Either(..))
1111
import Data.Foldable (fold)
1212
import Data.Maybe (Maybe(..))
13-
import Data.Newtype (unwrap)
1413
import Data.Traversable (traverse)
1514
import Data.Version (Version)
1615
import Data.Version as Version
@@ -39,14 +38,14 @@ data VersionField = Latest | Exact Version
3938
-- | Attempt to read the value of an input specifying a tool version
4039
getVersionField :: Key -> ExceptT Error Effect (Maybe VersionField)
4140
getVersionField key = do
42-
value <- Core.getInput' (unwrap key)
41+
value <- Core.getInput' (Key.toString key)
4342
case value of
4443
"" ->
4544
pure Nothing
4645
"latest" ->
4746
pure (pure Latest)
4847
val -> case Version.parseVersion val of
49-
Left msg -> do
48+
Left msg -> do
5049
liftEffect $ Core.error $ fold [ "Failed to parse version ", val ]
5150
throwError (error (ParseError.parseErrorMessage msg))
5251
Right version ->

src/Setup/Data/Key.purs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
module Setup.Data.Key
22
( Key
33
, fromTool
4+
, toString
45
) where
56

6-
import Data.Newtype (class Newtype)
77
import Setup.Data.Tool (Tool(..))
88

99
newtype Key = Key String
1010

11-
derive instance newtypeKey :: Newtype Key _
12-
1311
purescriptKey :: Key
1412
purescriptKey = Key "purescript"
1513

@@ -19,12 +17,19 @@ spagoKey = Key "spago"
1917
psaKey :: Key
2018
psaKey = Key "psa"
2119

20+
pursTidyKey :: Key
21+
pursTidyKey = Key "purs-tidy"
22+
2223
zephyrKey :: Key
2324
zephyrKey = Key "zephyr"
2425

26+
toString :: Key -> String
27+
toString (Key key) = key
28+
2529
fromTool :: Tool -> Key
2630
fromTool = case _ of
2731
PureScript -> purescriptKey
2832
Spago -> spagoKey
2933
Psa -> psaKey
34+
PursTidy -> pursTidyKey
3035
Zephyr -> zephyrKey

src/Setup/Data/Platform.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ data Platform = Windows | Mac | Linux
88

99
-- | Parse a platform value from the `process.platform` key
1010
platform :: Platform
11-
platform = case Process.platform of
11+
platform = case Process.platform of
1212
Just Platform.Win32 -> Windows
1313
Just Platform.Darwin -> Mac
1414
_ -> Linux

0 commit comments

Comments
 (0)