@servable/tools 1.6.4 → 1.6.5
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/package.json +1 -1
- package/src/lib/directoryGlob.js +28 -6
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"source": "src/index.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.5",
|
|
7
7
|
"description": "Servable tools is a utility that builds a protocol's manifest and documents it.",
|
|
8
8
|
"author": "Servable Community",
|
|
9
9
|
"license": "ISC",
|
package/src/lib/directoryGlob.js
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
import fg from 'fast-glob'
|
|
2
2
|
|
|
3
|
-
export default async ({ path,
|
|
4
|
-
globOptions = { mark: true },
|
|
5
|
-
}) => {
|
|
3
|
+
export default async ({ path, globOptions = {} }) => {
|
|
6
4
|
try {
|
|
7
|
-
|
|
5
|
+
// Default options to skip test files and common internal dirs
|
|
6
|
+
const defaultOptions = {
|
|
7
|
+
mark: true,
|
|
8
|
+
ignore: [
|
|
9
|
+
'**/lib/**',
|
|
10
|
+
'**/__tests__/**',
|
|
11
|
+
'**/tests/**',
|
|
12
|
+
'**/test/**',
|
|
13
|
+
'**/*.test.js',
|
|
14
|
+
'**/*.spec.js',
|
|
15
|
+
],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Merge caller options with defaults, unioning ignore patterns
|
|
19
|
+
const mergedIgnore = Array.from(new Set([
|
|
20
|
+
...(defaultOptions.ignore || []),
|
|
21
|
+
...((globOptions && globOptions.ignore) || []),
|
|
22
|
+
]))
|
|
23
|
+
|
|
24
|
+
const options = {
|
|
25
|
+
...defaultOptions,
|
|
26
|
+
...globOptions,
|
|
27
|
+
ignore: mergedIgnore,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const entries = await fg([path], options)
|
|
8
31
|
return Promise.all(entries.map(entry => import(entry)))
|
|
9
|
-
}
|
|
10
|
-
catch (e) {
|
|
32
|
+
} catch (e) {
|
|
11
33
|
console.error(e)
|
|
12
34
|
return null
|
|
13
35
|
}
|