sdc-build-wp 3.0.2 → 3.0.4

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/blocks.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { promises as fs } from 'fs';
1
2
  import path from 'path';
2
3
  import project from '../lib/project.js';
3
4
  import log from './logging.js';
@@ -10,9 +11,12 @@ function cmd(...command) {
10
11
  shell: true
11
12
  });
12
13
  return new Promise((resolveFunc) => {
13
- // p.stdout.on('data', (x) => {
14
- // process.stdout.write(x.toString());
15
- // });
14
+ p.stdout.on('data', (x) => {
15
+ if (x.toString().includes('Error:')) {
16
+ process.stdout.write(x.toString());
17
+ log('error', `Failed building blocks - See above error.`);
18
+ }
19
+ });
16
20
  p.stderr.on('data', (x) => {
17
21
  process.stderr.write(x.toString());
18
22
  log('error', `Failed building blocks - See above error.`);
@@ -43,7 +47,11 @@ const buildBlock = async (entry) => {
43
47
  return false;
44
48
  }
45
49
  let timerStart = Date.now();
46
- await cmd(`cd ${entry} && ${project.path}/node_modules/@wordpress/scripts/bin/wp-scripts.js`, 'build', 'src/index');
50
+ let cmds = [`build`];
51
+ for (var file of (await fs.readdir(`${entry}/src`)).filter(file => path.extname(file) == '.js')) {
52
+ cmds.push(`src/${file}`);
53
+ }
54
+ await cmd(`cd ${entry} && ${project.path}/node_modules/@wordpress/scripts/bin/wp-scripts.js`, ...cmds);
47
55
  log('success', `Built ${entry.replace(project.path, '')} in ${Date.now() - timerStart}ms`);
48
56
  };
49
57
 
package/lib/style.js CHANGED
@@ -16,17 +16,17 @@ const buildColors = async () => {
16
16
  let themeFileData = `// This file is automatically generated. Do not edit.\n`;
17
17
  if (theme.settings?.typography?.fontFamilies) {
18
18
  for (var fontFamily of theme.settings.typography.fontFamilies) {
19
- themeFileData += `$${fontFamily['slug']}: ${fontFamily['fontFamily']};\n`;
19
+ themeFileData += `$${fontFamily['slug']}: ${fontFamily['fontFamily']}; // --wp--preset--font-family--${fontFamily['slug']}\n`;
20
20
  }
21
21
  }
22
22
  if (theme.settings?.color?.palette) {
23
23
  for (var color of theme.settings.color.palette) {
24
- themeFileData += `$${color['slug']}: ${color['color']};\n`;
24
+ themeFileData += `$${color['slug']}: ${color['color']}; // --wp--preset--font-family--${color['slug']}\n`;
25
25
  }
26
26
  }
27
27
  if (theme.settings?.color?.gradients) {
28
28
  for (var color of theme.settings.color.gradients) {
29
- themeFileData += `$gradient-${color['slug']}: ${color['gradient']};\n`;
29
+ themeFileData += `$gradient-${color['slug']}: ${color['gradient']};\ // --wp--preset--gradient--${color['slug']}\n`;
30
30
  }
31
31
  }
32
32
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Custom WordPress build process.",
5
5
  "author": {
6
6
  "name": "Robert Sefer",