Skip to content

Preps repo for breaking changes work #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 14, 2023
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
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"
purs-tidy: "latest"

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "14"
node-version: "18"

- name: Install dependencies
run: |
Expand All @@ -33,3 +34,7 @@ jobs:
run: |
bower install
npm run-script test --if-present

- name: Check formatting
run: |
purs-tidy check src test
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ Notable changes to this project are documented in this file. The format is based
## [Unreleased]

Breaking changes:
- Bumped `node-buffer` and `node-fs` to v9.0.0 and latest release (#12 by @JordanMartinez)

New features:

Bugfixes:

Other improvements:
- Bump CI node to v18 (#12 by @JordanMartinez)
- Enforce formatting in CI via `purs-tidy` (#12 by @JordanMartinez)

## [v4.0.0](https://github.com/purescript-node/purescript-node-net/releases/tag/v4.0.0) - 2022-04-29

Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"purescript-exceptions": "^6.0.0",
"purescript-foreign": "^7.0.0",
"purescript-maybe": "^6.0.0",
"purescript-node-buffer": "^8.0.0",
"purescript-node-fs": "^8.0.0",
"purescript-node-buffer": "^9.0.0",
"purescript-node-fs": "#be0a346f4b72826947a124486c299b842c5e2601",
"purescript-nullable": "^6.0.0",
"purescript-options": "^7.0.0",
"purescript-prelude": "^6.0.0",
Expand Down
12 changes: 7 additions & 5 deletions src/Node/Net/Server.purs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ import Foreign (F, Foreign, readInt, readString)
import Foreign.Index (readProp)
import Node.Net.Socket (Socket)

type Address
= { address :: String
, family :: String
, port :: Int
}
type Address =
{ address :: String
, family :: String
, port :: Int
}

-- | Options to configure the listening side of a `Server`.
-- | These options decide whether the `Server` is ICP or TCP.
Expand Down Expand Up @@ -76,10 +76,12 @@ address server = do
where
hush :: F ~> Maybe
hush f = either (\_ -> Nothing) Just (runExcept f)

read :: Foreign -> Maybe (Either Address String)
read value =
hush (map Left $ readAddress value)
<|> hush (map Right $ readString value)

readAddress :: Foreign -> F Address
readAddress value = ado
address <- readProp "address" value >>= readString
Expand Down
10 changes: 5 additions & 5 deletions src/Node/Net/Socket.purs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ import Node.FS (FileDescriptor)
-- | Setting `port` will make the `Socket` TCP.
data ConnectOptions

type Lookup
= { address :: String
, family :: Maybe Int
, host :: String
}
type Lookup =
{ address :: String
, family :: Maybe Int
, host :: String
}

-- | An ICP endpoint or TCP socket.
foreign import data Socket :: Type
Expand Down
2 changes: 1 addition & 1 deletion test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ main = do
false -> infoShow { _message: "Socket closed without an error" }
true -> errorShow { _message: "Socket closed with an error" }
Node.Net.Socket.onConnect socket do
infoShow {_message: "Socket connected"}
infoShow { _message: "Socket connected" }
Node.Net.Socket.onData socket case _ of
Left buffer -> do
bufferString <- toString UTF8 buffer
Expand Down