Skip to content

Commit b7c6df0

Browse files
Update Spago configuration and modernize CI tooling (#62)
* Update Spago configuration and validate the gzip example * Pin CI and formatting tools
1 parent 27560d7 commit b7c6df0

17 files changed

Lines changed: 3771 additions & 250 deletions

File tree

‎.eslintrc.json‎

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

‎.github/workflows/ci.yml‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,34 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v6
1414

15-
- uses: purescript-contrib/setup-purescript@main
15+
- uses: actions/setup-node@v6
1616
with:
17-
purescript: "latest"
18-
purs-tidy: "latest"
19-
spago: "unstable"
17+
node-version: 24
18+
cache: npm
19+
20+
- run: npm ci
2021

2122
- name: Build source
22-
run: spago build
23+
run: npm run build
2324

2425
- name: Run tests
2526
run: |
2627
set -x
27-
spago test
28-
spago test --main Test.Main1
29-
spago test --main Test.Main2
30-
spago test --main Test.Main3 -- <(head --bytes 1000000 /dev/zero)
31-
spago test --main Test.Main4
28+
npm test
29+
npx --no-install spago test -p node-streams --main Test.Main1
30+
npx --no-install spago test -p node-streams --main Test.Main2
31+
npx --no-install spago test -p node-streams --main Test.Main3 -- <(head --bytes 1000000 /dev/zero)
32+
npx --no-install spago test -p node-streams --main Test.Main4
3233
33-
- name: Check formatting
34+
- name: Run gzip example
3435
run: |
35-
purs-tidy check src test
36+
node --input-type=module -e 'import { main } from "./output/Gzip/index.js"; main()' > "$RUNNER_TEMP/example.gz"
37+
gzip -dc "$RUNNER_TEMP/example.gz" | cmp - example/Gzip.txt
38+
39+
- name: Lint JavaScript
40+
run: npm run lint
41+
42+
- name: Check formatting
43+
run: npm run format:check

‎.gitignore‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/.*
22
!/.gitignore
3-
!/.eslintrc.json
3+
!/.oxfmtrc.json
44
!/.github/
55
/bower_components/
66
/node_modules/
77
/output/
8-
package-lock.json

‎.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+
}

‎example/Gzip.js‎

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

‎example/spago.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package:
2+
name: node-streams-example
3+
dependencies:
4+
- effect: ">=4.0.0 <5.0.0"
5+
- node-streams: ">=9.0.1 <10.0.0"
6+
- prelude: ">=6.0.0 <7.0.0"

‎example/src/Gzip.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createReadStream } from "node:fs";
2+
import process from "node:process";
3+
4+
export { createGzip as gzip } from "node:zlib";
5+
export const fileStream = createReadStream("example/Gzip.txt");
6+
export const stdout = process.stdout;
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ module Gzip where
33
import Prelude
44

55
import Effect (Effect)
6-
import Effect.Console (log)
7-
import Node.Stream (Duplex, Readable, Writable, onEnd, pipe)
6+
import Node.Stream (Duplex, Readable, Writable, pipe)
87

98
foreign import gzip :: Effect Duplex
109
foreign import fileStream :: Readable ()
@@ -13,7 +12,5 @@ foreign import stdout :: Writable ()
1312
main :: Effect Unit
1413
main = do
1514
z <- gzip
16-
_ <- fileStream `pipe` z
17-
_ <- z `pipe` stdout
18-
void $ onEnd fileStream do
19-
log "Done reading file, gzip output below"
15+
fileStream `pipe` z
16+
z `pipe` stdout

0 commit comments

Comments
 (0)