Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .eslintrc.json

This file was deleted.

34 changes: 21 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,34 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: purescript-contrib/setup-purescript@main
- uses: actions/setup-node@v6
with:
purescript: "latest"
purs-tidy: "latest"
spago: "unstable"
node-version: 24
cache: npm

- run: npm ci

- name: Build source
run: spago build
run: npm run build

- name: Run tests
run: |
set -x
spago test
spago test --main Test.Main1
spago test --main Test.Main2
spago test --main Test.Main3 -- <(head --bytes 1000000 /dev/zero)
spago test --main Test.Main4
npm test
npx --no-install spago test -p node-streams --main Test.Main1
npx --no-install spago test -p node-streams --main Test.Main2
npx --no-install spago test -p node-streams --main Test.Main3 -- <(head --bytes 1000000 /dev/zero)
npx --no-install spago test -p node-streams --main Test.Main4

- name: Check formatting
- name: Run gzip example
run: |
purs-tidy check src test
node --input-type=module -e 'import { main } from "./output/Gzip/index.js"; main()' > "$RUNNER_TEMP/example.gz"
gzip -dc "$RUNNER_TEMP/example.gz" | cmp - example/Gzip.txt

- name: Lint JavaScript
run: npm run lint

- name: Check formatting
run: npm run format:check
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/.*
!/.gitignore
!/.eslintrc.json
!/.oxfmtrc.json
!/.github/
/bower_components/
/node_modules/
/output/
package-lock.json
3 changes: 3 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "es5"
}
5 changes: 0 additions & 5 deletions example/Gzip.js

This file was deleted.

6 changes: 6 additions & 0 deletions example/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package:
name: node-streams-example
dependencies:
- effect: ">=4.0.0 <5.0.0"
- node-streams: ">=9.0.1 <10.0.0"
- prelude: ">=6.0.0 <7.0.0"
6 changes: 6 additions & 0 deletions example/src/Gzip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createReadStream } from "node:fs";
import process from "node:process";

export { createGzip as gzip } from "node:zlib";
export const fileStream = createReadStream("example/Gzip.txt");
export const stdout = process.stdout;
9 changes: 3 additions & 6 deletions example/Gzip.purs → example/src/Gzip.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module Gzip where
import Prelude

import Effect (Effect)
import Effect.Console (log)
import Node.Stream (Duplex, Readable, Writable, onEnd, pipe)
import Node.Stream (Duplex, Readable, Writable, pipe)

foreign import gzip :: Effect Duplex
foreign import fileStream :: Readable ()
Expand All @@ -13,7 +12,5 @@ foreign import stdout :: Writable ()
main :: Effect Unit
main = do
z <- gzip
_ <- fileStream `pipe` z
_ <- z `pipe` stdout
void $ onEnd fileStream do
log "Done reading file, gzip output below"
fileStream `pipe` z
z `pipe` stdout
Loading
Loading