@magic/fs 0.0.22 → 0.0.25
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 +13 -1
- package/package.json +12 -12
- package/src/getFiles.mjs +7 -1
package/README.md
CHANGED
|
@@ -235,7 +235,19 @@ update dependencies
|
|
|
235
235
|
* add missing @magic/fs dependency
|
|
236
236
|
* update dependencies
|
|
237
237
|
|
|
238
|
-
##### 0.0.22
|
|
238
|
+
##### 0.0.22
|
|
239
|
+
update dependencies
|
|
240
|
+
|
|
241
|
+
##### 0.0.23
|
|
242
|
+
update dependencies
|
|
243
|
+
|
|
244
|
+
##### 0.0.24
|
|
245
|
+
getFiles: allow files to be filtered by extension, using the .extension key of the second parameter
|
|
246
|
+
|
|
247
|
+
##### 0.0.25
|
|
248
|
+
update dependencies
|
|
249
|
+
|
|
250
|
+
##### 0.0.26 - unreleased
|
|
239
251
|
...
|
|
240
252
|
|
|
241
253
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic/fs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"author": "Wizards & Witches",
|
|
5
5
|
"description": "nodejs fs promises + goodies",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -32,21 +32,21 @@
|
|
|
32
32
|
"url": "https://github.com/magic/fs/issues"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@magic-modules/git-badges": "0.0.
|
|
36
|
-
"@magic-modules/light-switch": "0.0.
|
|
37
|
-
"@magic-modules/no-spy": "0.0.
|
|
35
|
+
"@magic-modules/git-badges": "0.0.12",
|
|
36
|
+
"@magic-modules/light-switch": "0.0.11",
|
|
37
|
+
"@magic-modules/no-spy": "0.0.7",
|
|
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.140",
|
|
41
|
+
"@magic/format": "0.0.39",
|
|
42
|
+
"@magic/test": "0.2.10"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@magic/deep": "0.1.
|
|
46
|
-
"@magic/error": "0.0.
|
|
47
|
-
"@magic/log": "0.1.
|
|
48
|
-
"@magic/mime-types": "0.0.
|
|
49
|
-
"@magic/types": "0.1.
|
|
45
|
+
"@magic/deep": "0.1.13",
|
|
46
|
+
"@magic/error": "0.0.14",
|
|
47
|
+
"@magic/log": "0.1.15",
|
|
48
|
+
"@magic/mime-types": "0.0.15",
|
|
49
|
+
"@magic/types": "0.1.20"
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
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()
|