@magic/fs 0.0.23 → 0.0.26

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 CHANGED
@@ -238,7 +238,19 @@ update dependencies
238
238
  ##### 0.0.22
239
239
  update dependencies
240
240
 
241
- ##### 0.0.23 - unreleased
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
251
+ update dependencies
252
+
253
+ ##### 0.0.27 - unreleased
242
254
  ...
243
255
 
244
256
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic/fs",
3
- "version": "0.0.23",
3
+ "version": "0.0.26",
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.11",
36
- "@magic-modules/light-switch": "0.0.10",
37
- "@magic-modules/no-spy": "0.0.6",
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.139",
41
- "@magic/format": "0.0.38",
42
- "@magic/test": "0.2.8"
40
+ "@magic/core": "0.0.141",
41
+ "@magic/format": "0.0.40",
42
+ "@magic/test": "0.2.11"
43
43
  },
44
44
  "dependencies": {
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"
45
+ "@magic/deep": "0.1.14",
46
+ "@magic/error": "0.0.15",
47
+ "@magic/log": "0.1.16",
48
+ "@magic/mime-types": "0.0.16",
49
+ "@magic/types": "0.1.21"
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('fs.getFiles(dir, { depth: true, root: false })')
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()