sdc-build-wp 5.1.0 → 5.1.1
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 +3 -2
- package/lib/help.js +2 -0
- package/lib/utils.js +15 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,9 +22,10 @@ sdc-build-wp --clear-cache # Clear all cached data
|
|
|
22
22
|
While watch is enabled, use the following keyboard commands to control the build process:
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
[r] Restart
|
|
25
|
+
[r] Restart build process
|
|
26
26
|
[c] Clear cache
|
|
27
|
-
[p] Pause/Resume
|
|
27
|
+
[p] Pause/Resume watching
|
|
28
|
+
[n] New component
|
|
28
29
|
[q] Quit
|
|
29
30
|
````
|
|
30
31
|
|
package/lib/help.js
CHANGED
|
@@ -38,7 +38,9 @@ ${chalk.yellow('Examples:')}
|
|
|
38
38
|
|
|
39
39
|
${chalk.yellow('Watch Mode Controls:')}
|
|
40
40
|
${chalk.green('[r]')} Restart build process
|
|
41
|
+
${chalk.green('[c]')} Clear cache
|
|
41
42
|
${chalk.green('[p]')} Pause/Resume watching
|
|
43
|
+
${chalk.green('[n]')} New component
|
|
42
44
|
${chalk.green('[q]')} Quit and exit
|
|
43
45
|
|
|
44
46
|
${chalk.yellow('Configuration:')}
|
package/lib/utils.js
CHANGED
|
@@ -55,18 +55,22 @@ export function entryBasename(entry) {
|
|
|
55
55
|
|
|
56
56
|
export async function getAllFiles(dir, filetypes = false) {
|
|
57
57
|
let files = [];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
filetypes
|
|
61
|
-
|
|
62
|
-
for (const entry of entries) {
|
|
63
|
-
const fullPath = path.join(dir, entry.name);
|
|
64
|
-
if (
|
|
65
|
-
!entry.isDirectory() &&
|
|
66
|
-
(!filetypes || filetypes.length == 0 || filetypes.includes(path.extname(fullPath)))
|
|
67
|
-
) {
|
|
68
|
-
files.push(fullPath);
|
|
58
|
+
try {
|
|
59
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
60
|
+
if (filetypes && !Array.isArray(filetypes)) {
|
|
61
|
+
filetypes = [filetypes];
|
|
69
62
|
}
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
const fullPath = path.join(dir, entry.name);
|
|
65
|
+
if (
|
|
66
|
+
!entry.isDirectory() &&
|
|
67
|
+
(!filetypes || filetypes.length == 0 || filetypes.includes(path.extname(fullPath)))
|
|
68
|
+
) {
|
|
69
|
+
files.push(fullPath);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
//
|
|
70
74
|
}
|
|
71
75
|
return files;
|
|
72
76
|
}
|