sdc-build-wp 4.5.2 → 4.5.3

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/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import parseArgs from 'minimist';
3
- const argv = parseArgs(process.argv.slice(2));
4
3
  import path from 'path';
5
4
  import { fileURLToPath } from 'url';
6
5
  import { promises as fs } from 'fs';
7
- import { Tail } from 'tail';
8
6
  import project from './lib/project.js';
9
7
  import log from './lib/logging.js';
10
8
  import * as LibComponents from './lib/components/index.js';
11
9
 
12
10
  project.components = Object.fromEntries(Object.entries(LibComponents).map(([name, Class]) => [name, new Class()]));
13
11
 
12
+ const argv = parseArgs(process.argv.slice(2));
13
+
14
14
  if (argv.help || argv.h) {
15
15
  console.log(`
16
16
  Usage: sdc-build-wp [options] [arguments]
@@ -57,14 +57,6 @@ project.builds = argv.builds ? (Array.isArray(argv.builds) ? argv.builds : argv.
57
57
  for (let build of project.builds) {
58
58
  await project.components[build].watch();
59
59
  }
60
- try {
61
- await fs.access(project.paths.errorLog);
62
- new Tail(project.paths.errorLog).on('line', function(data) {
63
- log('php', data);
64
- });
65
- } catch (error) {
66
- log('info', `Cannot find error log @ ${project.paths.errorLog}. Skipping watching php error logs`);
67
- }
68
60
  }
69
61
 
70
62
  })();
@@ -0,0 +1,36 @@
1
+ import BaseComponent from './base.js';
2
+ import fs from 'fs-extra';
3
+ import { Tail } from 'tail';
4
+
5
+ export default class ErrorsComponent extends BaseComponent {
6
+
7
+ constructor() {
8
+ super();
9
+ this.description = `Tail error logs`;
10
+ }
11
+
12
+ async init() {
13
+ //
14
+ }
15
+
16
+ async build() {
17
+ //
18
+ }
19
+
20
+ async process() {
21
+ //
22
+ }
23
+
24
+ async watch() {
25
+ let component = this;
26
+ try {
27
+ await fs.access(this.project.paths.errorLog);
28
+ new Tail(this.project.paths.errorLog).on('line', function(data) {
29
+ component.log('php', data);
30
+ });
31
+ } catch (error) {
32
+ this.log('info', `Cannot find error log @ ${this.project.paths.errorLog}. Skipping watching php error logs`);
33
+ }
34
+ }
35
+
36
+ }
@@ -28,7 +28,7 @@ export default class FontsComponent extends BaseComponent {
28
28
  await fs.copy(entry, `${this.project.path}${entryLabel}`);
29
29
  entryLabel += ` (${fontsDir.filter(file => !file.startsWith('.')).length} files)`;
30
30
  } catch(error) {
31
- this.log('info', `${error} at ${entry.replace(this.project.path, '')}/. Skipping font copy`);
31
+ this.log('error', `${error} at ${entry.replace(this.project.path, '')}/. Skipping font copy`);
32
32
  return false;
33
33
  }
34
34
 
@@ -5,3 +5,4 @@ export { default as images } from './images.js';
5
5
  export { default as fonts } from './fonts.js';
6
6
  export { default as php } from './php.js';
7
7
  export { default as server } from './server.js';
8
+ export { default as errors } from './errors.js';
@@ -7,7 +7,7 @@ export default class PHPComponent extends BaseComponent {
7
7
 
8
8
  constructor() {
9
9
  super();
10
- this.description = `Lint (and fix) php files`;
10
+ this.description = `Lint and fix php files`;
11
11
  }
12
12
 
13
13
  async init() {
@@ -7,7 +7,7 @@ export default class ScriptsComponent extends BaseComponent {
7
7
 
8
8
  constructor() {
9
9
  super();
10
- this.description = `Process script files`;
10
+ this.description = `Lint and process script files`;
11
11
  }
12
12
 
13
13
  async init() {
@@ -11,7 +11,7 @@ export default class StyleComponent extends BaseComponent {
11
11
 
12
12
  constructor() {
13
13
  super();
14
- this.description = `Process style files`;
14
+ this.description = `Lint and process style files`;
15
15
  }
16
16
 
17
17
  async init() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "4.5.2",
3
+ "version": "4.5.3",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"