sdc-build-wp 5.4.6 → 5.5.0

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/lib/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { default as project } from './project.js';
2
2
  import * as utils from './utils.js';
3
3
  import log from './logging.js';
4
- import chalk from 'chalk';
4
+ import { styleText } from 'node:util';
5
5
  import tui from './tui.js';
6
6
 
7
7
 
@@ -10,7 +10,7 @@ export async function build(watch = false) {
10
10
  if (watch) {
11
11
  tui.init();
12
12
  tui.setComponents(project.builds, true);
13
- const commands = `Commands: ${chalk.underline.green('r')}estart, ${chalk.underline.green('c')}lear cache, ${chalk.underline.green('p')}ause/resume, ${chalk.underline.green('n')}ew component, ${chalk.underline.green('q')}uit`;
13
+ const commands = `Commands: ${styleText(['underline', 'green'], 'r')}estart, ${styleText(['underline', 'green'], 'c')}lear cache, ${styleText(['underline', 'green'], 'p')}ause/resume, ${styleText(['underline', 'green'], 'n')}ew component, ${styleText(['underline', 'green'], 'q')}uit`;
14
14
  tui.setCommands(commands);
15
15
  }
16
16
 
@@ -1,6 +1,6 @@
1
1
  import BaseComponent from './base.js';
2
2
  import path from 'path';
3
- import fs from 'fs-extra';
3
+ import { promises as fs } from 'fs';
4
4
  import { Tail } from 'tail';
5
5
 
6
6
  export default class ErrorsComponent extends BaseComponent {
@@ -27,7 +27,7 @@ export default class ErrorsComponent extends BaseComponent {
27
27
  try {
28
28
  await fs.access(this.project.paths.errorLog);
29
29
  } catch {
30
- await fs.ensureFile(path.resolve(this.project.paths.errorLog));
30
+ await fs.writeFile(path.resolve(this.project.paths.errorLog), '');
31
31
  }
32
32
  try {
33
33
  await fs.access(this.project.paths.errorLog);
@@ -1,6 +1,6 @@
1
1
  import BaseComponent from './base.js';
2
2
  import { readdir } from 'fs/promises';
3
- import fs from 'fs-extra';
3
+ import { promises as fs } from 'fs';
4
4
 
5
5
  export default class FontsComponent extends BaseComponent {
6
6
 
@@ -25,7 +25,7 @@ export default class FontsComponent extends BaseComponent {
25
25
  try {
26
26
  const fontsDir = await readdir(entry);
27
27
  if (fontsDir.length == 0) { throw new Error('No files present'); }
28
- await fs.copy(entry, `${this.project.path}${entryLabel}`);
28
+ await fs.cp(entry, `${this.project.path}${entryLabel}`, { recursive: true });
29
29
  entryLabel += ` (${fontsDir.filter(file => !file.startsWith('.')).length} files)`;
30
30
  } catch (error) {
31
31
  this.log('error', `${error} at ${entry.replace(this.project.path, '')}/. Skipping font copy`);
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { readFile } from 'fs/promises';
5
5
  import { create } from 'browser-sync';
6
- import chalk from 'chalk';
6
+ import { styleText } from 'node:util';
7
7
  import tui from '../tui.js';
8
8
 
9
9
  export default class ServerComponent extends BaseComponent {
@@ -120,9 +120,9 @@ export default class ServerComponent extends BaseComponent {
120
120
  if (tui.isInitialized) {
121
121
  tui.setURLs(localURL, this.usedOptions.urls.external || '');
122
122
  } else {
123
- this.log('info', `Local server: ${chalk.green(localURL)} (${this.usedOptions.urls.local})`);
123
+ this.log('info', `Local server: ${styleText('green', localURL)} (${this.usedOptions.urls.local})`);
124
124
  if (this.usedOptions.urls.external) {
125
- this.log('info', `External server: ${chalk.green(this.usedOptions.urls.external)}`);
125
+ this.log('info', `External server: ${styleText('green', this.usedOptions.urls.external)}`);
126
126
  }
127
127
  }
128
128
  }
package/lib/help.js CHANGED
@@ -1,51 +1,51 @@
1
1
  import project from './project.js';
2
- import chalk from 'chalk';
2
+ import { styleText } from 'node:util';
3
3
  import log from './logging.js';
4
4
 
5
5
  export default function() {
6
6
  log(null, `
7
- ${chalk.bold.blue('SDC Build WP')} - Custom WordPress build process
7
+ ${styleText(['bold', 'blue'], 'SDC Build WP')} - Custom WordPress build process
8
8
 
9
- ${chalk.yellow('Usage:')} sdc-build-wp [options] [arguments]
9
+ ${styleText('yellow', 'Usage:')} sdc-build-wp [options] [arguments]
10
10
 
11
- ${chalk.yellow('Options:')}
12
- ${chalk.green('-h, --help')} Show this help message and exit
13
- ${chalk.green('-v, --version')} Show version number and exit
14
- ${chalk.green('-w, --watch')} Build and watch for changes
15
- ${chalk.green('-b, --builds BUILDS')} Build with specific components (comma-separated)
16
- ${chalk.green('--no-cache')} Disable build caching for this run
17
- ${chalk.green('--clear-cache')} Clear all cached data and exit
11
+ ${styleText('yellow', 'Options:')}
12
+ ${styleText('green', '-h, --help')} Show this help message and exit
13
+ ${styleText('green', '-v, --version')} Show version number and exit
14
+ ${styleText('green', '-w, --watch')} Build and watch for changes
15
+ ${styleText('green', '-b, --builds BUILDS')} Build with specific components (comma-separated)
16
+ ${styleText('green', '--no-cache')} Disable build caching for this run
17
+ ${styleText('green', '--clear-cache')} Clear all cached data and exit
18
18
 
19
- ${chalk.yellow('Available Components:')}
19
+ ${styleText('yellow', 'Available Components:')}
20
20
  ${Object.entries(project.components).map(([key, component]) => {
21
- return ` ${chalk.cyan(key.padEnd(12))} ${component.description}`;
21
+ return ` ${styleText('cyan', key.padEnd(12))} ${component.description}`;
22
22
  }).join('\n')}
23
23
 
24
- ${chalk.yellow('Examples:')}
25
- ${chalk.dim('# Basic build')}
24
+ ${styleText('yellow', 'Examples:')}
25
+ ${styleText('dim', '# Basic build')}
26
26
  sdc-build-wp
27
27
 
28
- ${chalk.dim('# Build and watch for changes')}
28
+ ${styleText('dim', '# Build and watch for changes')}
29
29
  sdc-build-wp --watch
30
30
 
31
- ${chalk.dim('# Build only specific components')}
31
+ ${styleText('dim', '# Build only specific components')}
32
32
  sdc-build-wp --watch --builds=style,scripts
33
33
 
34
- ${chalk.dim('# Build without cache')}
34
+ ${styleText('dim', '# Build without cache')}
35
35
  sdc-build-wp --no-cache
36
36
 
37
- ${chalk.dim('# Clear cache and exit')}
37
+ ${styleText('dim', '# Clear cache and exit')}
38
38
  sdc-build-wp --clear-cache
39
39
 
40
- ${chalk.yellow('Watch Mode Controls:')}
41
- ${chalk.green('[r]')} Restart build process
42
- ${chalk.green('[c]')} Clear cache
43
- ${chalk.green('[p]')} Pause/Resume watching
44
- ${chalk.green('[n]')} New component
45
- ${chalk.green('[q]')} Quit and exit
40
+ ${styleText('yellow', 'Watch Mode Controls:')}
41
+ ${styleText('green', '[r]')} Restart build process
42
+ ${styleText('green', '[c]')} Clear cache
43
+ ${styleText('green', '[p]')} Pause/Resume watching
44
+ ${styleText('green', '[n]')} New component
45
+ ${styleText('green', '[q]')} Quit and exit
46
46
 
47
- ${chalk.yellow('Configuration:')}
48
- Place your configuration in ${chalk.cyan(`${project.sdcDirName}/${project.configFileName}`)}
47
+ ${styleText('yellow', 'Configuration:')}
48
+ Place your configuration in ${styleText('cyan', `${project.sdcDirName}/${project.configFileName}`)}
49
49
  See documentation for available options.
50
50
  `);
51
51
  }
package/lib/logging.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // based heavily on Nick Salloum's 'node-pretty-log'
2
2
  // https://github.com/callmenick/node-pretty-log
3
- import chalk from 'chalk';
3
+ import { styleText } from 'node:util';
4
4
  import { default as project } from './project.js';
5
5
  import tui from './tui.js';
6
6
 
@@ -14,28 +14,28 @@ function log(type, ...messages) {
14
14
 
15
15
  switch (type) {
16
16
  case 'success':
17
- icon = chalk.green('✔');
18
- time = chalk.gray(getTime());
17
+ icon = styleText('green', '✔');
18
+ time = styleText('gray', getTime());
19
19
  break;
20
20
  case 'error':
21
- icon = chalk.red('✖');
22
- time = chalk.bgRed.gray(getTime());
21
+ icon = styleText('red', '✖');
22
+ time = styleText(['bgRed', 'gray'], getTime());
23
23
  if (project.builds.includes('server') && project.isRunning) {
24
24
  project.components.server.server.notify('ERROR', 2500);
25
25
  }
26
26
  break;
27
27
  case 'warn':
28
- icon = chalk.yellow('⚠');
29
- time = chalk.bgYellow.gray(getTime());
28
+ icon = styleText('yellow', '⚠');
29
+ time = styleText(['bgYellow', 'gray'], getTime());
30
30
  break;
31
31
  case 'php':
32
- icon = chalk.blue('ℹ');
33
- time = chalk.gray(getTime());
34
- prefix = chalk.gray('PHP: ');
32
+ icon = styleText('blue', 'ℹ');
33
+ time = styleText('gray', getTime());
34
+ prefix = styleText('gray', 'PHP: ');
35
35
  break;
36
36
  case 'info':
37
- icon = chalk.blue('ℹ');
38
- time = chalk.bgBlue.gray(getTime());
37
+ icon = styleText('blue', 'ℹ');
38
+ time = styleText(['bgBlue', 'gray'], getTime());
39
39
  break;
40
40
  }
41
41
 
package/lib/tui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import blessed from 'blessed';
2
- import chalk from 'chalk';
2
+ import { styleText } from 'node:util';
3
3
  import log from './logging.js';
4
4
 
5
5
  class TUI {
@@ -155,26 +155,26 @@ class TUI {
155
155
 
156
156
  const lines = [];
157
157
 
158
- let titleLine = ' ' + chalk.bold.blue('SDC Build WP');
158
+ let titleLine = ' ' + styleText(['bold', 'blue'], 'SDC Build WP');
159
159
  if (this.isPaused) {
160
- titleLine += chalk.bold.yellow(' [PAUSED]');
160
+ titleLine += styleText(['bold', 'yellow'], ' [PAUSED]');
161
161
  }
162
162
  if (!this.isMouseEnabled) {
163
- titleLine += chalk.bold.yellow(' [TEXT SELECT - Press Enter to Exit]');
163
+ titleLine += styleText(['bold', 'yellow'], ' [TEXT SELECT - Press Enter to Exit]');
164
164
  }
165
165
  if (this.components.length > 0) {
166
- titleLine += chalk.gray(' [') + chalk.cyan(this.components.join(', ')) + chalk.gray(']');
166
+ titleLine += styleText('gray', ' [') + styleText('cyan', this.components.join(', ')) + styleText('gray', ']');
167
167
  }
168
168
  lines.push(titleLine);
169
169
 
170
170
  if (this.urls.local || this.urls.external) {
171
171
  let urlLine = ' ';
172
172
  if (this.urls.local) {
173
- urlLine += `Local: ${chalk.green(this.urls.local)}`;
173
+ urlLine += `Local: ${styleText('green', this.urls.local)}`;
174
174
  }
175
175
  if (this.urls.external) {
176
176
  if (urlLine.length > 1) urlLine += ' ';
177
- urlLine += `External: ${chalk.green(this.urls.external)}`;
177
+ urlLine += `External: ${styleText('green', this.urls.external)}`;
178
178
  }
179
179
  lines.push(urlLine);
180
180
  } else {
@@ -188,7 +188,7 @@ class TUI {
188
188
  }
189
189
 
190
190
  if (!this.isMouseEnabled) {
191
- lines.push(' ' + chalk.yellow('Text select on. Press Enter to enable mouse.'));
191
+ lines.push(' ' + styleText('yellow', 'Text select on. Press Enter to enable mouse.'));
192
192
  } else {
193
193
  lines.push(' ');
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "5.4.6",
3
+ "version": "5.5.0",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -26,20 +26,18 @@
26
26
  "@stylistic/stylelint-plugin": "^4.0.0",
27
27
  "@typescript-eslint/eslint-plugin": "^8.48.1",
28
28
  "@typescript-eslint/parser": "^8.48.1",
29
- "@wordpress/scripts": "^31.1.0",
30
- "autoprefixer": "^10.4.22",
29
+ "@wordpress/scripts": "^31.4.0",
30
+ "autoprefixer": "^10.4.24",
31
31
  "blessed": "^0.1.81",
32
32
  "browser-sync": "^3.0.4",
33
- "chalk": "^5.6.2",
34
33
  "chokidar": "^5.0.0",
35
- "esbuild": "^0.27.1",
34
+ "esbuild": "^0.27.3",
36
35
  "eslint": "^9.39.1",
37
- "fs-extra": "^11.3.2",
38
36
  "postcss": "^8.5.6",
39
37
  "postcss-scss": "^4.0.9",
40
38
  "postcss-sort-media-queries": "^5.2.0",
41
- "prettier": "^3.7.4",
42
- "sass": "^1.94.2",
39
+ "prettier": "^3.8.1",
40
+ "sass": "^1.97.3",
43
41
  "sharp": "^0.34.5",
44
42
  "stylelint": "^16.26.1",
45
43
  "svgo": "^4.0.0",