@reliverse/relifso 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -13
- package/bin/impl/copy.d.ts +2 -2
- package/bin/impl/copy.js +2 -2
- package/bin/impl/move.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,13 +17,7 @@
|
|
|
17
17
|
- 🎯 Supports all Node.js v16+ features — optimized for Node.js v22+
|
|
18
18
|
- 🧪 Soon: Ready for upcoming Node.js v22+ experimental features
|
|
19
19
|
- ✌️ Bun v1.2+ ready — ships with Bun-aware enhancements out of the box
|
|
20
|
-
- 🐦🔥 Finally! Your `fs.*` usage is now can correctly read/write JSON/JSONC!
|
|
21
|
-
|
|
22
|
-
## Heads Up
|
|
23
|
-
|
|
24
|
-
- **Most of the things** mentioned in this doc **aren't implemented yet** — they're part of the vision for ~`v1.5.0`.
|
|
25
|
-
- Got thoughts? Ideas? Send your feedback in [Discord](https://discord.gg/Pb8uKbwpsJ) or use [GitHub Issues](https://github.com/reliverse/relifso/issues).
|
|
26
|
-
- Your feedback means the world and helps shape where this project goes next. Thank you!
|
|
20
|
+
- 🐦🔥 Finally! Your `fs.*` usage is now can correctly read/write JSON/JSONC!
|
|
27
21
|
|
|
28
22
|
## Install
|
|
29
23
|
|
|
@@ -39,10 +33,11 @@ bun rm fs-extra
|
|
|
39
33
|
bun rm @types/fs-extra
|
|
40
34
|
# soon:
|
|
41
35
|
# bun add -D @reliverse/dler
|
|
42
|
-
# bun dler
|
|
43
|
-
# bun dler relifso fs-extra to relifso
|
|
36
|
+
# bun dler migrate fs-relifso
|
|
44
37
|
```
|
|
45
38
|
|
|
39
|
+
**Pro Tip**: _Use Ctrl+Shift+H to replace `fs-extra` with `@reliverse/relifso` in your project._
|
|
40
|
+
|
|
46
41
|
### Core Features
|
|
47
42
|
|
|
48
43
|
- **File Operations**
|
|
@@ -129,6 +124,71 @@ console.log(config); // { hello: 'world' }
|
|
|
129
124
|
await remove(".reliverse");
|
|
130
125
|
```
|
|
131
126
|
|
|
127
|
+
## Run Example
|
|
128
|
+
|
|
129
|
+
Install this repository locally and run the example by using `bun dev`:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
$ bun e-mod.ts
|
|
133
|
+
✓ Running examples with Bun...
|
|
134
|
+
Created directory ./tests-runtime
|
|
135
|
+
[env] writeJson was successfully executed in Bun (for JSON)
|
|
136
|
+
Wrote JSON tests-runtime\config.json
|
|
137
|
+
[env] readJson was successfully executed in Bun
|
|
138
|
+
Read JSON {"hello":"world","ts":"2025-06-02T19:01:53.291Z"}
|
|
139
|
+
[env] copy was successfully executed in Bun
|
|
140
|
+
Moved → Copied (with overwrite) tests-runtime\config.old.json → tests-runtime\config.copy.json
|
|
141
|
+
[env] readFile was successfully executed in Bun
|
|
142
|
+
Wrote & read text file Hello Relifso!
|
|
143
|
+
[env] writeFile was successfully executed in Bun
|
|
144
|
+
[env] writeFile was successfully executed in Bun
|
|
145
|
+
Ensured nested & output files
|
|
146
|
+
[env] writeJson was successfully executed in Bun (for JSON)
|
|
147
|
+
[env] readJson was successfully executed in Bun
|
|
148
|
+
writeJson / readJson round-trip {"foo":"bar"}
|
|
149
|
+
[env] writeJson was successfully executed in Bun (for JSONC)
|
|
150
|
+
Wrote JSONC tests-runtime\config.jsonc
|
|
151
|
+
[env] readJson was successfully executed in Bun
|
|
152
|
+
Read JSONC {
|
|
153
|
+
"name": "relifso",
|
|
154
|
+
"version": "1.0.0",
|
|
155
|
+
"features": [
|
|
156
|
+
"file operations",
|
|
157
|
+
"directory operations",
|
|
158
|
+
"JSONC support"
|
|
159
|
+
],
|
|
160
|
+
"settings": {
|
|
161
|
+
"debug": true,
|
|
162
|
+
"verbose": false
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
Emptied directory tests-runtime\empty-me
|
|
166
|
+
[env] writeFileSync was successfully executed in Bun
|
|
167
|
+
[env] writeJsonSync was successfully executed in Bun (for JSON)
|
|
168
|
+
Sync JSON round-trip {"sync":true}
|
|
169
|
+
[env] copySync was successfully executed in Bun
|
|
170
|
+
copySync → moveSync → removeSync chain complete
|
|
171
|
+
Directory structure via dive
|
|
172
|
+
• tests-runtime\config-sync.json
|
|
173
|
+
• tests-runtime\config.copy.json
|
|
174
|
+
• tests-runtime\config.jsonc
|
|
175
|
+
• tests-runtime\config.old.json
|
|
176
|
+
• tests-runtime\config2.json
|
|
177
|
+
• tests-runtime\hello.txt
|
|
178
|
+
• tests-runtime\nested\deep\file.txt
|
|
179
|
+
• tests-runtime\output-file.txt
|
|
180
|
+
Directory structure via diveSync
|
|
181
|
+
• tests-runtime\config-sync.json
|
|
182
|
+
• tests-runtime\config.copy.json
|
|
183
|
+
• tests-runtime\config.jsonc
|
|
184
|
+
• tests-runtime\config.old.json
|
|
185
|
+
• tests-runtime\config2.json
|
|
186
|
+
• tests-runtime\hello.txt
|
|
187
|
+
• tests-runtime\nested\deep\file.txt
|
|
188
|
+
• tests-runtime\output-file.txt
|
|
189
|
+
Removed directory ./tests-runtime
|
|
190
|
+
```
|
|
191
|
+
|
|
132
192
|
## Sync vs Async vs Legacy
|
|
133
193
|
|
|
134
194
|
You choose your flavor:
|
|
@@ -361,12 +421,10 @@ const stats = await getStats("file.txt");
|
|
|
361
421
|
|
|
362
422
|
## TODO
|
|
363
423
|
|
|
364
|
-
- [x] Create usage example in [./e-relifso.ts](./e-relifso.ts) and [./e-pathkit.ts](./e-pathkit.ts)
|
|
365
|
-
- [
|
|
424
|
+
- [x] Create usage example in [./example/e-relifso.ts](./e-relifso.ts) and [./example/e-pathkit.ts](./e-pathkit.ts)
|
|
425
|
+
- [x] Ensure [./example/e-relifso.ts](./example/e-relifso.ts) and [./example/e-pathkit.ts](./example/e-pathkit.ts) works 100% correctly
|
|
366
426
|
- [ ] Consider using [@reliverse/repath](https://github.com/reliverse/repath) instead of just `node:path`.
|
|
367
427
|
- [ ] Pass all `fs-extra` tests with Bun (+ fix & improve them).
|
|
368
|
-
- [ ] Convert all jsdoc comments to TypeScript types.
|
|
369
|
-
- [ ] Fully improve all `fs-extra` codebase files.
|
|
370
428
|
- [ ] In [docs.reliverse.org](https://docs.reliverse.org) implement feature and performance comparison table with `fs-extra`.
|
|
371
429
|
|
|
372
430
|
## Shoutouts
|
package/bin/impl/copy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface CopyOptions {
|
|
2
|
-
/**
|
|
2
|
+
/** @deprecated Use `overwrite` instead. This option will be removed in a future. */
|
|
3
3
|
force?: boolean;
|
|
4
|
-
/** Whether to overwrite existing files.
|
|
4
|
+
/** Whether to overwrite existing files. Default: true */
|
|
5
5
|
overwrite?: boolean;
|
|
6
6
|
/** @deprecated Use `overwrite`. */
|
|
7
7
|
clobber?: boolean;
|
package/bin/impl/copy.js
CHANGED
|
@@ -29,7 +29,7 @@ export function copySync(src, dest, options = {}) {
|
|
|
29
29
|
const {
|
|
30
30
|
overwrite = options.clobber ?? true,
|
|
31
31
|
force = true,
|
|
32
|
-
recursive =
|
|
32
|
+
recursive = true,
|
|
33
33
|
dereference = false,
|
|
34
34
|
errorOnExist = false,
|
|
35
35
|
ensureSource = true,
|
|
@@ -124,7 +124,7 @@ export async function copy(src, dest, options = {}) {
|
|
|
124
124
|
const {
|
|
125
125
|
overwrite = options.clobber ?? true,
|
|
126
126
|
force = true,
|
|
127
|
-
recursive =
|
|
127
|
+
recursive = true,
|
|
128
128
|
dereference = false,
|
|
129
129
|
errorOnExist = false,
|
|
130
130
|
ensureSource = true,
|
package/bin/impl/move.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export interface MoveOptions {
|
|
2
|
+
/** @deprecated Use `overwrite` instead. This option will be removed in a future. */
|
|
3
|
+
force?: boolean;
|
|
4
|
+
/** Whether to overwrite existing files. Default: false */
|
|
2
5
|
overwrite?: boolean;
|
|
3
6
|
/** @deprecated Use `overwrite`. */
|
|
4
7
|
clobber?: boolean;
|