Skip to content

Commit c89c5ea

Browse files
Migrate to Spago 1 and modernize development tooling (#2)
* Migrate configuration to registry-backed Spago 1 * Modernize CI and pinned development tooling * Remove version qualifier from installation instructions
1 parent 7042bc8 commit c89c5ea

16 files changed

Lines changed: 4500 additions & 246 deletions

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
pull_request:
99
branches: [main]
1010

11-
# Run CI on all 3 latest OSes
1211
jobs:
1312
build:
1413
strategy:
@@ -17,53 +16,35 @@ jobs:
1716
runs-on: ${{ matrix.os }}
1817

1918
steps:
20-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v6
2120

2221
- name: Set up Node toolchain
23-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v6
2423
with:
25-
node-version: "16"
26-
27-
- name: Cache NPM dependencies
28-
uses: actions/cache@v3
29-
env:
30-
cache-name: cache-node-modules
31-
with:
32-
path: ~/.npm
33-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
34-
restore-keys: |
35-
${{ runner.os }}-build-${{ env.cache-name }}-
36-
${{ runner.os }}-build-
37-
${{ runner.os }}-
24+
node-version: "24"
25+
cache: npm
3826

3927
- name: Setup PureScript tooling
40-
run:
41-
npm i -g purescript@latest purs-tidy@latest purescript-psa@latest spago@latest
28+
run: npm ci
4229

4330
- name: Cache PureScript dependencies
44-
uses: actions/cache@v3
31+
uses: actions/cache@v5
4532
with:
46-
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
33+
key: ${{ runner.os }}-spago-${{ hashFiles('spago.yaml', 'spago.lock', 'package-lock.json') }}
4734
path: |
4835
.spago
4936
output
5037
51-
# Compile the library/project
52-
# censor-lib: ignore warnings emitted by dependencies
53-
# strict: convert warnings into errors
54-
# Note: `purs-args` actually forwards these args to `psa`
5538
- name: Build the project
56-
run: |
57-
npx spago build --purs-args "--censor-lib --strict"
39+
run: npm run build
5840

5941
- name: Run tests
60-
run: |
61-
chmod +x test/regen-pem-files.sh
62-
sh test/regen-pem-files.sh
42+
run: npm test
6343

64-
npx spago -x test.dhall test
44+
- name: Lint JavaScript
45+
if: runner.os == 'Linux'
46+
run: npm run lint
6547

6648
- name: Check Formatting
6749
if: runner.os == 'Linux'
68-
run: |
69-
purs-tidy check src test
50+
run: npm run format:check

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
/.psa*
1010
/.spago
1111
/.vscode
12+
/test/localhost-cert.pem
13+
/test/localhost-privkey.pem

‎.oxfmtrc.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"trailingComma": "es5"
3+
}

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PureScript bindings to the `http2` Node.js module
66

77
The bindings for the module have been implemented, excluding the [Compatibility API](https://nodejs.org/dist/latest-v18.x/docs/api/http2.html#compatibility-api).
88

9-
This repo is incompatible with existing `node-streams` and `node-net` bindings in the default package set. Instead, this repo uses custom forks of [`node-streams@update-ffi-build-on-node-event-emitters`](https://github.com/purescript-node/purescript-node-streams/tree/update-ffi-build-on-node-event-emitters) and [`node-net@fully-implement`](https://github.com/purescript-node/purescript-node-net/tree/fully-implement) that implement their event handlers using the bindings exposed via [`node-event-emitter`](https://github.com/purescript-node/purescript-node-event-emitter). See the [packages.dhall](./packages.dhall) file to see how to refer to these forks if you want to use this repo.
9+
Install the package with Spago:
10+
11+
```sh
12+
spago install node-http2
13+
```
1014

1115
The bindings written thus far are mostly safe. There are a few cases where safety cannot be properly handled in PureScript due to some decisions made by Node.js. In other cases, it's not yet clear to me whether to represent something as `foreign import data`, `Object`, and/or an `ADT`.

0 commit comments

Comments
 (0)