Skip to content

feat: implement glob, cp, opendir and other methods #86

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
791cefe
feat: implement glob, cp, opendir and other methods
srghma Oct 4, 2024
86c67eb
feat: use FilePath instead of String where needed, AutodetectLink
srghma Oct 4, 2024
efebe33
feat: node-buffer-blob
srghma Oct 4, 2024
2e5f45c
feat: spago build --offline --censor-stats --strict --pedantic-packages
srghma Oct 4, 2024
ddd6a47
fix: tests
srghma Oct 5, 2024
e98b91c
rm -rdf .spago spago.lock output && spago upgrade --migrate && spago …
srghma Oct 5, 2024
2cc9b29
feat: opendirOptionsDefault
srghma Oct 5, 2024
13cf95d
refactor: tests -> move, use Test dir like specified in spago documen…
srghma Oct 6, 2024
e48eea5
feat: move Options to separate file
srghma Oct 6, 2024
4216697
feat: sync -> implement
srghma Oct 6, 2024
b226943
feat: aff -> forgot some functions
srghma Oct 6, 2024
1319b6b
fix: suggestions
srghma Oct 6, 2024
6f00cdf
feat: remove Node.FS.Sync.fdFlush
srghma Oct 6, 2024
602a6a8
fix: write
srghma Oct 6, 2024
9b146de
fix(#81): add copyFile_NO_FLAGS, make it default
srghma Oct 6, 2024
6575fd1
fix: --strict
srghma Oct 6, 2024
b0a8cca
fix: futimes, feat: add readlinkBuffer
srghma Oct 6, 2024
20f566a
feat: show for Dir, fix: show for Dirent
srghma Oct 8, 2024
43d512b
feat: reproduce TypeError [ERR_INVALID_ARG_TYPE]: The "options.filter…
srghma Oct 11, 2024
1df3ebd
fix: TypeError [ERR_INVALID_ARG_TYPE]: The "options.filter" property …
srghma Oct 11, 2024
84bba38
fix: cp options -> should be CopyMode
srghma Oct 11, 2024
50972ba
fix: cp -> split on cpFile and cpDir bc recursive is required for dirs
srghma Oct 11, 2024
3e2e675
feat: DirentType and getType -> add
srghma Oct 13, 2024
fcfddf9
feat: rename using sd -F 'DirentNameType' 'DirentName' $(fd --type file)
srghma Oct 13, 2024
bc7c327
feat: Dirent -> dont export isXXX
srghma Oct 13, 2024
4710e21
feat: move Callbacks
srghma Oct 13, 2024
111d26e
feat: Dir -> split
srghma Oct 13, 2024
3a1dc6f
refactor: tests -> wrong names
srghma Oct 13, 2024
4732d1b
refactor: Dir.Sync -> wrong names
srghma Oct 13, 2024
b9195f5
refactor: Dir -> explicit export
srghma Oct 13, 2024
622d56b
refactor: rename module
srghma Oct 13, 2024
0a1796a
feat: DirentType -> add derive
srghma Oct 13, 2024
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
24 changes: 8 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -10,31 +10,23 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production

- name: Build source
run: npm run-script build
run: spago build --censor-stats --strict --pedantic-packages

- name: Run tests
run: |
bower install
npm run-script test --if-present
run: spago test --censor-stats --strict --pedantic-packages

- name: Check formatting
run: |
purs-tidy check src test
- name: Verify formatting
run: purs-tidy check src test
75 changes: 66 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,58 +2,102 @@

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).


## [Unreleased]

Breaking changes:

New features:

- Add functions to `Node.FS.Async`, `Node.FS.Aff`, `Node.FS.Sync`

- readdir'
- readdirBuffer
- readdirBuffer'
- readdirDirent
- readdirDirent'
- readdirDirentBuffer
- readdirDirentBuffer'
- cp
- cp'
- fchmod
- fchown
- fdatasync
- fstat
- fsync
- ftruncate
- futimes
- glob
- glob'
- globDirent
- globDirent'
- lchmod
- lchown
- lutimes
- opendir
- opendir'
- readv
- statfs
- writev

- Deprecate `Node.FS.Sync.fdFlush`, `Node.FS.Sync.fsync` should be used instead

- Add modules `Dir`, `Dir.Aff`, `Dirent`

- Fix tests - it was creating lot of `./test/fixturesASDFSDF` directories, now - create in `tmp` like `./tmp/test/fixturesASDFSDF`

Bugfixes:

Other improvements:

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

New features:

- Add `lstat` to `Node.FS.Aff` (#85 by @artemisSystem)

Bugfixes:

- Fixed internal reference to `rmdir` that should have been `rm` (#83 by @MonoidMusician)

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

Bugfixes:

- Update `node-streams` to `v9.0.0` to fix FFI issues (#78 by @JordanMartinez)

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

Breaking changes:

- Remove `StatsObj` and reimplement bindings to `Stats` object (#76 by @JordanMartinez)

Previously, one could write the following to get a value on the `Stats` object:

```purs
getGid :: Stats -> Number
getGid (Stats obj) = obj.gid
```

This record interface was removed as the underlying value is not a record
that can be copied and modified as such. Now, one must call the corresponding function:

```purs
getGid :: Stats -> Number
getGid s = Stats.gid s
```

- Update `[fd]createReadStream`/`[fd]createWriteStream` to allow more options (#77 by @JordanMartinez)

| Removes... | ...in favor of |
| - | - |
| `createReadStreamWith` | `createReadStream'` |
| `fdCreateReadStreamWith` | `fdCreateReadStream'` |
| `createWriteStreamWith` | `createWriteStream'` |
| Removes... | ...in favor of |
| ------------------------- | ---------------------- |
| `createReadStreamWith` | `createReadStream'` |
| `fdCreateReadStreamWith` | `fdCreateReadStream'` |
| `createWriteStreamWith` | `createWriteStream'` |
| `fdCreateWriteStreamWith` | `fdCreateWriteStream'` |
In the new APIs, all options are exposed and may require converting

In the new APIs, all options are exposed and may require converting
PureScript values to JavaScript ones.

```purs
filePath # createWriteStream'
{ flags: fileFlagsToNode R
@@ -63,11 +107,13 @@ Breaking changes:
```

New features:

- Integrate `node-fs-aff` into library (#75 by @JordanMartinez)

Bugfixes:

Other improvements:

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

New features:
- Add FFI for `access`, `copyFile` and `mkdtemp` (#73 by @JordanMartinez)

- Add FFI for `access`, `copyFile` and `mkdtemp` (#73 by @JordanMartinez)

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

Other improvements:

- Use `EffectFn` throughout instead of unsafe `mkEffect` utility (#70 by @colinwahl)

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

New features:

- Add `lstat` (#66 by @artemisSystem)
- Add rmdir', which takes an take options arg (#67 by @wclr)
- Added rm and rm' version with and without options arg (#67 by @wclr)

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

Breaking changes:

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

New features:

- Update project and deps to PureScript v0.15.0 (#59 by @JordanMartinez, @thomashoneyman, @sigma-andex)
- Remove duplicate `node-buffer` from bower.json (@thomashoneyman)

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

New features:

- Add bindings to `mkdir(path, { recursive: true })` via `mkdirRecursive` (#53, #55 by @JordanMartinez)

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

New features:

- Exported `mkPerm` (#42 by @JordanMartinez)

Other improvements:

- Fixed warnings revealed by v0.14.1 PS release (#42 by @JordanMartinez)

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

Breaking changes:

- Added support for PureScript 0.14 and dropped support for all previous versions (#46)
- Dropped deprecated `globals` dependency (#47)

Other improvements:

- Migrated CI to GitHub Actions, updated installation instructions to use Spago, and migrated from `jshint` to `eslint` (#45)
- Added a changelog and pull request template (#49)

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

**This release requires PureScript v0.6.8 or later**

- Updated dependencies

## [v0.3.0](https://github.com/purescript-node/purescript-node-fs/releases/tag/v0.3.0) - 2015-01-29
44 changes: 0 additions & 44 deletions bower.json

This file was deleted.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "eslint src && pulp build -- --censor-lib --strict",
"test": "pulp test -- --censor-lib"
"build": "eslint src && spago build --censor-stats --strict --pedantic-packages",
"test": "spago test --censor-stats --strict --pedantic-packages"
},
"devDependencies": {
"eslint": "^7.15.0",
"pulp": "16.0.0-0",
"purescript-psa": "^0.8.2",
"rimraf": "^3.0.2"
"eslint": "^9.11.1",
"pulp": "16.0.2",
"purescript-psa": "^0.9.0",
"rimraf": "^6.0.1"
}
}
Loading