@magic/fs 0.0.35 → 0.0.37

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
@@ -330,7 +330,15 @@ update dependencies
330
330
  - fs.getDirectories maxDepth will be at least 2 if noRoot is set.
331
331
  - update dependencies
332
332
 
333
- ##### 0.0.36 - unreleased
333
+ ##### 0.0.36
334
+
335
+ - getFiles: options.root can be undefined, leading to correct depth calculations
336
+
337
+ ##### 0.0.37
338
+
339
+ - update dependencies
340
+
341
+ ##### 0.0.38 - unreleased
334
342
 
335
343
  ...
336
344
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic/fs",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "author": "Wizards & Witches",
5
5
  "description": "nodejs fs promises + goodies",
6
6
  "license": "AGPL-3.0",
@@ -42,16 +42,16 @@
42
42
  "@magic-themes/docs": "0.0.15",
43
43
  "@magic/core": "0.0.156",
44
44
  "@magic/format": "0.0.68",
45
- "@magic/test": "0.2.24",
46
- "@types/node": "24.9.1",
45
+ "@magic/test": "0.2.25",
46
+ "@types/node": "24.9.2",
47
47
  "typescript": "5.9.3"
48
48
  },
49
49
  "dependencies": {
50
- "@magic/deep": "0.1.18",
51
- "@magic/error": "0.0.20",
52
- "@magic/log": "0.1.20",
53
- "@magic/mime-types": "0.0.21",
54
- "@magic/types": "0.1.29"
50
+ "@magic/deep": "0.1.20",
51
+ "@magic/error": "0.0.21",
52
+ "@magic/log": "0.1.21",
53
+ "@magic/mime-types": "0.0.22",
54
+ "@magic/types": "0.1.30"
55
55
  },
56
56
  "files": [
57
57
  "src",
package/src/getFiles.js CHANGED
@@ -27,7 +27,7 @@ export const getFiles = async (dir, options = {}) => {
27
27
  depth = false,
28
28
  extension = false,
29
29
  ext = false,
30
- root = process.cwd(),
30
+ root,
31
31
  } = options
32
32
 
33
33
  if (ext && !extension) {
@@ -50,15 +50,14 @@ export const getFiles = async (dir, options = {}) => {
50
50
  throw error(`${libName}: dir: first argument must be a string.`, 'E_ARG_TYPE')
51
51
  }
52
52
 
53
- if (is.empty(root)) {
53
+ if (is.undefined(root)) {
54
54
  root = dir
55
55
  }
56
56
 
57
- const currentDepth =
58
- dir
59
- .replace(root, '')
60
- .split(path.sep)
61
- .filter(a => a).length - 1
57
+ const currentDepth = dir
58
+ .replace(root, '')
59
+ .split(path.sep)
60
+ .filter(a => a).length
62
61
 
63
62
  if (currentDepth > maxDepth) {
64
63
  return []