@magic/fs 0.0.21 → 0.0.24
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 +11 -1
- package/package.json +9 -8
- package/src/getFiles.mjs +7 -1
package/README.md
CHANGED
|
@@ -231,7 +231,17 @@ update dependencies
|
|
|
231
231
|
##### 0.0.20
|
|
232
232
|
update dependencies
|
|
233
233
|
|
|
234
|
-
##### 0.0.21
|
|
234
|
+
##### 0.0.21
|
|
235
|
+
* add missing @magic/fs dependency
|
|
236
|
+
* update dependencies
|
|
237
|
+
|
|
238
|
+
##### 0.0.22
|
|
239
|
+
update dependencies
|
|
240
|
+
|
|
241
|
+
##### 0.0.23
|
|
242
|
+
getFiles: allow files to be filtered by extension, using the .extension key of the second parameter
|
|
243
|
+
|
|
244
|
+
##### 0.0.24 - unreleased
|
|
235
245
|
...
|
|
236
246
|
|
|
237
247
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic/fs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"author": "Wizards & Witches",
|
|
5
5
|
"description": "nodejs fs promises + goodies",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -37,15 +37,16 @@
|
|
|
37
37
|
"@magic-modules/no-spy": "0.0.6",
|
|
38
38
|
"@magic-modules/pre": "0.0.11",
|
|
39
39
|
"@magic-themes/docs": "0.0.14",
|
|
40
|
-
"@magic/core": "0.0.
|
|
41
|
-
"@magic/format": "0.0.
|
|
42
|
-
"@magic/test": "0.2.
|
|
40
|
+
"@magic/core": "0.0.139",
|
|
41
|
+
"@magic/format": "0.0.38",
|
|
42
|
+
"@magic/test": "0.2.8"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@magic/deep": "0.1.
|
|
46
|
-
"@magic/error": "0.0.
|
|
47
|
-
"@magic/
|
|
48
|
-
"@magic/types": "0.
|
|
45
|
+
"@magic/deep": "0.1.11",
|
|
46
|
+
"@magic/error": "0.0.13",
|
|
47
|
+
"@magic/log": "0.1.14",
|
|
48
|
+
"@magic/mime-types": "0.0.14",
|
|
49
|
+
"@magic/types": "0.1.19"
|
|
49
50
|
},
|
|
50
51
|
"files": [
|
|
51
52
|
"src"
|
package/src/getFiles.mjs
CHANGED
|
@@ -14,13 +14,18 @@ export const getFiles = async (dir, depth = true, root = 'deprecated') => {
|
|
|
14
14
|
if (root !== 'deprecated') {
|
|
15
15
|
log.warn('E_DEPRECATED', 'you have used fs.getFiles with a third argument.')
|
|
16
16
|
log.info('Please use the new syntax instead:')
|
|
17
|
-
log.info(
|
|
17
|
+
log.info("fs.getFiles(dir, { depth: true, root: false, extension: 'md' })")
|
|
18
18
|
} else {
|
|
19
19
|
root = false
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
let extension
|
|
23
|
+
|
|
22
24
|
if (!is.empty(depth) && is.objectNative(depth)) {
|
|
23
25
|
root = root || depth?.root
|
|
26
|
+
extension = depth?.extension
|
|
27
|
+
|
|
28
|
+
/* make sure this is the last action in this if */
|
|
24
29
|
depth = depth?.depth
|
|
25
30
|
}
|
|
26
31
|
|
|
@@ -57,6 +62,7 @@ export const getFiles = async (dir, depth = true, root = 'deprecated') => {
|
|
|
57
62
|
deep
|
|
58
63
|
.flatten(files)
|
|
59
64
|
.filter(a => a)
|
|
65
|
+
.filter(a => !extension || a.endsWith(extension))
|
|
60
66
|
.filter(async f => {
|
|
61
67
|
const stat = await fs.stat(f)
|
|
62
68
|
return stat.isFile()
|