Skip to content

Commit 791cefe

Browse files
committed
feat: implement glob, cp, opendir and other methods
1 parent f34c5cd commit 791cefe

18 files changed

+2525
-75
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- uses: purescript-contrib/setup-purescript@main
1616
with:
1717
purescript: "unstable"
1818
purs-tidy: "latest"
1919

20-
- uses: actions/setup-node@v3
20+
- uses: actions/setup-node@v4
2121
with:
2222
node-version: "lts/*"
2323

CHANGELOG.md

+88-9
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,124 @@
22

33
Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5-
65
## [Unreleased]
76

87
Breaking changes:
98

109
New features:
1110

11+
- Add functions to `Node.FS.Async`
12+
13+
- readdir'
14+
- readdirBuffer
15+
- readdirBuffer'
16+
- readdirDirent
17+
- readdirDirent'
18+
- readdirDirentBuffer
19+
- readdirDirentBuffer'
20+
- cp
21+
- cp'
22+
- fchmod
23+
- fchown
24+
- fdatasync
25+
- fstat
26+
- fsync
27+
- ftruncate
28+
- futimes
29+
- glob
30+
- glob'
31+
- globDirent
32+
- globDirent'
33+
- lchmod
34+
- lchown
35+
- lutimes
36+
- opendir
37+
- opendir'
38+
- readv
39+
- statfs
40+
- writev
41+
42+
- Add functions to `Node.FS.Aff`
43+
44+
- cp
45+
- cp'
46+
- fchmod
47+
- fchown
48+
- fdatasync
49+
- fstat
50+
- fsync
51+
- ftruncate
52+
- futimes
53+
- glob
54+
- glob'
55+
- globDirent
56+
- globDirent'
57+
- lchmod
58+
- lchown
59+
- lutimes
60+
- opendir
61+
- opendir'
62+
- readv
63+
- statfs
64+
- writev
65+
66+
- Add modules `Dir`, `Dir.Aff`, `Dirent`
67+
68+
- Fix tests - it was creating lot of `./test/fixturesASDFSDF` directories, now - create in `tmp` like `./tmp/test/fixturesASDFSDF`
69+
1270
Bugfixes:
1371

1472
Other improvements:
1573

1674
## [v9.2.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v9.2.0) - 2024-06-23
1775

1876
New features:
77+
1978
- Add `lstat` to `Node.FS.Aff` (#85 by @artemisSystem)
2079

2180
Bugfixes:
81+
2282
- Fixed internal reference to `rmdir` that should have been `rm` (#83 by @MonoidMusician)
2383

2484
## [v9.1.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v9.1.0) - 2023-07-26
2585

2686
Bugfixes:
87+
2788
- Update `node-streams` to `v9.0.0` to fix FFI issues (#78 by @JordanMartinez)
2889

2990
## [v9.0.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v9.0.0) - 2023-07-19
3091

3192
Breaking changes:
93+
3294
- Remove `StatsObj` and reimplement bindings to `Stats` object (#76 by @JordanMartinez)
3395

3496
Previously, one could write the following to get a value on the `Stats` object:
97+
3598
```purs
3699
getGid :: Stats -> Number
37100
getGid (Stats obj) = obj.gid
38101
```
39102

40103
This record interface was removed as the underlying value is not a record
41104
that can be copied and modified as such. Now, one must call the corresponding function:
105+
42106
```purs
43107
getGid :: Stats -> Number
44108
getGid s = Stats.gid s
45109
```
110+
46111
- Update `[fd]createReadStream`/`[fd]createWriteStream` to allow more options (#77 by @JordanMartinez)
47112

48-
| Removes... | ...in favor of |
49-
| - | - |
50-
| `createReadStreamWith` | `createReadStream'` |
51-
| `fdCreateReadStreamWith` | `fdCreateReadStream'` |
52-
| `createWriteStreamWith` | `createWriteStream'` |
113+
| Removes... | ...in favor of |
114+
| ------------------------- | ---------------------- |
115+
| `createReadStreamWith` | `createReadStream'` |
116+
| `fdCreateReadStreamWith` | `fdCreateReadStream'` |
117+
| `createWriteStreamWith` | `createWriteStream'` |
53118
| `fdCreateWriteStreamWith` | `fdCreateWriteStream'` |
54-
55-
In the new APIs, all options are exposed and may require converting
119+
120+
In the new APIs, all options are exposed and may require converting
56121
PureScript values to JavaScript ones.
122+
57123
```purs
58124
filePath # createWriteStream'
59125
{ flags: fileFlagsToNode R
@@ -63,11 +129,13 @@ Breaking changes:
63129
```
64130

65131
New features:
132+
66133
- Integrate `node-fs-aff` into library (#75 by @JordanMartinez)
67134

68135
Bugfixes:
69136

70137
Other improvements:
138+
71139
- Update `node-buffer` to next breaking release: `v9.0.0` (#74 by @JordanMartinez)
72140
- Update `node-streams` to next breaking release: `TODO` (#74 by @JordanMartinez)
73141
- Update CI actions to v3 (#74 by @JordanMartinez)
@@ -77,28 +145,33 @@ Other improvements:
77145
## [v8.2.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v8.2.0) - 2023-03-23
78146

79147
New features:
80-
- Add FFI for `access`, `copyFile` and `mkdtemp` (#73 by @JordanMartinez)
148+
149+
- Add FFI for `access`, `copyFile` and `mkdtemp` (#73 by @JordanMartinez)
81150

82151
## [v8.1.1](https://github.com/purescript-node/purescript-node-fs/releases/tag/v8.1.1) - 2022-10-24
83152

84153
Other improvements:
154+
85155
- Use `EffectFn` throughout instead of unsafe `mkEffect` utility (#70 by @colinwahl)
86156

87157
## [v8.1.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v8.1.0) - 2022-06-10
88158

89159
New features:
160+
90161
- Add `lstat` (#66 by @artemisSystem)
91162
- Add rmdir', which takes an take options arg (#67 by @wclr)
92163
- Added rm and rm' version with and without options arg (#67 by @wclr)
93164

94165
## [v8.0.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v8.0.0) - 2022-04-29
95166

96167
Breaking changes:
168+
97169
- Remove `Async.exists` (#61 by @sigma-andex)
98170
- Update `mkdir` to take an options record arg, exposing `recursive` option (#53, #55, #58 by @JordanMartinez)
99171
To get back the old behavior of `mkdir'`, you would call `mkdir' { recursive: false, mode: mkPerms all all all }`
100172

101173
New features:
174+
102175
- Update project and deps to PureScript v0.15.0 (#59 by @JordanMartinez, @thomashoneyman, @sigma-andex)
103176
- Remove duplicate `node-buffer` from bower.json (@thomashoneyman)
104177

@@ -115,6 +188,7 @@ Due to an incorrectly-implemented breaking change, use v8.0.0
115188
Breaking changes:
116189

117190
New features:
191+
118192
- Add bindings to `mkdir(path, { recursive: true })` via `mkdirRecursive` (#53, #55 by @JordanMartinez)
119193

120194
Bugfixes:
@@ -124,18 +198,22 @@ Other improvements:
124198
## [v6.1.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v6.1.0) - 2021-05-06
125199

126200
New features:
201+
127202
- Exported `mkPerm` (#42 by @JordanMartinez)
128203

129204
Other improvements:
205+
130206
- Fixed warnings revealed by v0.14.1 PS release (#42 by @JordanMartinez)
131207

132208
## [v6.0.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v6.0.0) - 2021-02-26
133209

134210
Breaking changes:
211+
135212
- Added support for PureScript 0.14 and dropped support for all previous versions (#46)
136213
- Dropped deprecated `globals` dependency (#47)
137214

138215
Other improvements:
216+
139217
- Migrated CI to GitHub Actions, updated installation instructions to use Spago, and migrated from `jshint` to `eslint` (#45)
140218
- Added a changelog and pull request template (#49)
141219

@@ -230,6 +308,7 @@ Fix type of `Async.exists`.
230308
## [v0.4.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v0.4.0) - 2015-02-21
231309

232310
**This release requires PureScript v0.6.8 or later**
311+
233312
- Updated dependencies
234313

235314
## [v0.3.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v0.3.0) - 2015-01-29

bower.json

-44
This file was deleted.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "eslint src && pulp build -- --censor-lib --strict",
6-
"test": "pulp test -- --censor-lib"
5+
"build": "eslint src && spago build --censor-stats --strict --pedantic-packages",
6+
"test": "spago test --censor-stats --strict --pedantic-packages"
77
},
88
"devDependencies": {
9-
"eslint": "^7.15.0",
10-
"pulp": "16.0.0-0",
11-
"purescript-psa": "^0.8.2",
12-
"rimraf": "^3.0.2"
9+
"eslint": "^9.11.1",
10+
"pulp": "16.0.2",
11+
"purescript-psa": "^0.9.0",
12+
"rimraf": "^6.0.1"
1313
}
1414
}

0 commit comments

Comments
 (0)