sdc-build-wp 5.1.0 → 5.1.2

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
@@ -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
 
@@ -27,7 +27,14 @@ export default class ErrorsComponent extends BaseComponent {
27
27
  await fs.access(this.project.paths.errorLog);
28
28
  new Tail(this.project.paths.errorLog).on('line', function(data) {
29
29
  if (!component.project.isRunning) { return; }
30
- component.log('php', data);
30
+ let dataWithoutTimestamp = data.substring(27);
31
+ let logVerb = 'php';
32
+ if (dataWithoutTimestamp.startsWith('PHP Warning:')) {
33
+ logVerb = 'warn';
34
+ } else if (dataWithoutTimestamp.startsWith('PHP Fatal error:')) {
35
+ logVerb = 'error';
36
+ }
37
+ component.log(logVerb, dataWithoutTimestamp);
31
38
  });
32
39
  } catch (error) {
33
40
  this.log('info', `Cannot find error log @ ${this.project.paths.errorLog}. Skipping watching php error logs`);
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/logging.js CHANGED
@@ -40,6 +40,8 @@ function log(type, ...messages) {
40
40
  console.log.call(
41
41
  console,
42
42
  chalk.blue('ℹ'),
43
+ chalk.gray(getTime()),
44
+ chalk.gray('PHP: '),
43
45
  ...messages
44
46
  );
45
47
  break;
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
- const entries = await readdir(dir, { withFileTypes: true });
59
- if (filetypes && !Array.isArray(filetypes)) {
60
- filetypes = [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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"