Skip to content

Commit f9c5b57

Browse files
authored
Merge pull request #146 from OxfordAbstracts/upgrade-spago
Upgrade Spago and use spago.yaml instead of spago.dhall, extend CI
2 parents a1ffeb0 + 0868254 commit f9c5b57

97 files changed

Lines changed: 43724 additions & 5601 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616

1717
- name: Cache PureScript dependencies
1818
uses: actions/cache@v4
19-
# This cache uses the .dhall files to know when it should reinstall
19+
# This cache uses the .lock files to know when it should reinstall
2020
# and rebuild packages. It caches both the installed packages from
2121
# the `.spago` directory and compilation artifacts from the `output`
2222
# directory. When restored the compiler will rebuild any files that
2323
# have changed. If you do not want to cache compiled output, remove
2424
# the `output` path.
2525
with:
26-
key: k1-${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
26+
key: k1-${{ runner.os }}-spago-${{ hashFiles('**/*.lock') }}
2727
path: |
2828
.spago
2929
output
@@ -33,8 +33,36 @@ jobs:
3333
examples/1-simple/output
3434
examples/2-codegen/.spago
3535
examples/2-codegen/output
36+
examples/3-enums/.spago
37+
examples/3-enums/output
38+
examples/4-mutation/.spago
39+
examples/4-mutation/output
40+
examples/5-subscription/.spago
41+
examples/5-subscription/output
42+
examples/6-watch-query/.spago
43+
examples/6-watch-query/output
44+
examples/7-field-type-overrides/.spago
45+
examples/7-field-type-overrides/output
46+
examples/8-custom-gql-types/.spago
47+
examples/8-custom-gql-types/output
48+
examples/9-variables/.spago
49+
examples/9-variables/output
50+
examples/10-aliases/.spago
51+
examples/10-aliases/output
52+
examples/11-unions/.spago
53+
examples/11-unions/output
54+
examples/12-directives/.spago
55+
examples/12-directives/output
56+
examples/13-error-boundaries/.spago
57+
examples/13-error-boundaries/output
3658
3759
- run: spago build
3860
- run: npm i
3961
- run: npm run bundle
4062
- run: npm t
63+
64+
- name: Run Example Tests
65+
run: node run-example-tests.js
66+
67+
- name: Run Should Fail Tests
68+
run: node run-should-fail-tests.js

README.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ A typesafe graphql client for purescript.
1010

1111
This library will allow you to make graphql queries and type checks the query, arguments and response.
1212

13-
It includes functions for making graphql queries and codegen tools for making sure your GraphQL schema and Purescript schema are in sync.
13+
It includes functions for making graphql queries and codegen tools for making sure your GraphQL schema and PureScript schema are in sync.
1414

1515
## Example
1616

17-
Here is a complete application using purescript-graphql-client, that makes a graphQL query and logs the result, without using schema codegen.
17+
Here is a complete application using purescript-graphql-client, that makes a GraphQL query and logs the result, without using schema codegen.
1818

19-
```purescript
19+
```purs
2020
module Main where
2121
2222
import Prelude
@@ -94,18 +94,12 @@ name = Proxy
9494

9595
### Installation
9696

97-
Either use spago (recommended)
97+
Use [Spago](https://github.com/purescript/spago):
9898

99-
```
99+
```sh
100100
spago install graphql-client
101101
```
102102

103-
or install with bower
104-
105-
```
106-
bower install purescript-graphql-client
107-
```
108-
109103
### Schema
110104

111105
In order to use this library you will need a Purescript representation of your GraphQL schema.
@@ -118,8 +112,8 @@ It is possible to write the schema yourself but it is easier and safer to use th
118112

119113
There is an npm library that is a thin wrapper around this library's schema codegen. First, install this package:
120114

121-
```
122-
npm i -D purescript-graphql-client
115+
```sh
116+
npm install --save-dev purescript-graphql-client
123117
```
124118

125119
Then add a script to generate your schema on build. Run this script before compiling your purescript project.
@@ -171,13 +165,14 @@ You can also create your own base client by making your own data type an instanc
171165
To use Affjax you can create a base client using the `AffjaxNodeClient` data constructor and
172166
pass it the url of your GraphQL endpoint and any request headers.
173167

174-
To use Apollo you will have to install the Apollo npm module.
175-
```
176-
npm i -S @apollo/client
168+
To use Apollo you will have to install the Apollo npm module:
169+
170+
```sh
171+
npm install --save @apollo/client
177172
```
178173

179174
you can then create a client using `createClient`. eg.
180-
```purescript
175+
```purs
181176
import MySchema (Query, Mutation)
182177
import GraphQL.Client.BaseClients.Apollo (createClient)
183178
import GraphQL.Client.Query (query)
@@ -205,7 +200,7 @@ Look in `examples/4-mutation` for a complete example.
205200

206201
Use `createSubscriptionClient` if you want to make subscriptions. eg.
207202

208-
```purescript
203+
```purs
209204
import Halogen.Subscription as HS
210205
import MySchema (Query, Subscription, Mutation)
211206
import GraphQL.Client.BaseClients.Apollo (createSubscriptionClient)
@@ -238,10 +233,10 @@ import Type.Data.List (Nil')
238233

239234
### On the server
240235

241-
To use this library server-side, you should use the Affjax base client and install xhr2
236+
To use this library server-side, you should use the Affjax base client and install xhr2:
242237

243-
```
244-
npm i -S xhr2
238+
```sh
239+
npm install --save xhr2
245240
```
246241

247242
You can see an examples of this in `examples/1-simple` and `e2e/1-affjax` .

bower.json

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)