sdc-build-wp 4.6.0 → 4.6.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/index.js CHANGED
@@ -43,7 +43,9 @@ project.builds = argv.builds ? (Array.isArray(argv.builds) ? argv.builds : argv.
43
43
 
44
44
  (async() => {
45
45
 
46
- if (argv.watch) {
46
+ if (argv.watch && project.builds.includes('server')) {
47
+ project.builds.splice(project.builds.indexOf('server'), 1);
48
+ project.builds.unshift('server');
47
49
  project.components.server.serve(false);
48
50
  }
49
51
 
@@ -56,7 +58,9 @@ project.builds = argv.builds ? (Array.isArray(argv.builds) ? argv.builds : argv.
56
58
  await Promise.all(promisesBuilds);
57
59
  log('info', `Finished initial build in ${Math.round((performance.now() - initialBuildTimerStart) / 1000)} seconds`);
58
60
 
59
- if (argv.watch) {
61
+ if (argv.watch && project.builds.includes('server')) {
62
+ project.builds.splice(project.builds.indexOf('server'), 1);
63
+ project.builds.push('server');
60
64
  log('info', `Started watching [${project.builds.join(', ')}]`);
61
65
  for (let build of project.builds) {
62
66
  await project.components[build].watch();
@@ -15,6 +15,7 @@ class BaseComponent {
15
15
  this.project = project;
16
16
  this.log = log;
17
17
  this.chokidar = chokidar;
18
+ this.watcher = null;
18
19
  this.glob = glob;
19
20
  this.files = [];
20
21
  this.globs = [];
@@ -86,7 +86,9 @@ export default class BlocksComponent extends BaseComponent {
86
86
  this.chokidar.watch(`${block}/src`, {
87
87
  ...this.project.chokidarOpts
88
88
  }).on('all', (event, path) => {
89
- this.process(block);
89
+ if (!['unlink', 'unlinkDir'].includes(event)) {
90
+ this.process(block);
91
+ }
90
92
  });
91
93
  }
92
94
  }
@@ -42,7 +42,7 @@ export default class FontsComponent extends BaseComponent {
42
42
  }
43
43
 
44
44
  watch() {
45
- this.chokidar.watch(this.globs, {
45
+ this.watcher = this.chokidar.watch(this.globs, {
46
46
  ...this.project.chokidarOpts
47
47
  }).on('all', (event, path) => {
48
48
  this.process();
@@ -32,6 +32,9 @@ export default class ImagesComponent extends BaseComponent {
32
32
  let convertedImagesCount = 0;
33
33
  let copiedFilesCount = 0;
34
34
  for (const file of files) {
35
+ if (file == '.DS_Store') {
36
+ continue;
37
+ }
35
38
  const filePath = this.path.join(entry, file);
36
39
  const destFilePath = `${dest}/${this.path.basename(file)}`;
37
40
  if (!this.compressableFileFormats.includes(this.path.extname(file).toLowerCase())) {
@@ -74,7 +77,7 @@ export default class ImagesComponent extends BaseComponent {
74
77
  }
75
78
 
76
79
  watch() {
77
- this.chokidar.watch(this.project.paths.images, {
80
+ this.watcher = this.chokidar.watch(this.project.paths.images, {
78
81
  ...this.project.chokidarOpts
79
82
  }).on('all', (event, path) => {
80
83
  this.process();
@@ -87,10 +87,12 @@ export default class PHPComponent extends BaseComponent {
87
87
  }
88
88
 
89
89
  watch() {
90
- this.chokidar.watch(this.globs, {
90
+ this.watcher = this.chokidar.watch(this.globs, {
91
91
  ...this.project.chokidarOpts
92
92
  }).on('all', (event, path) => {
93
- this.process(path);
93
+ if (!['unlink', 'unlinkDir'].includes(event)) {
94
+ this.process(path);
95
+ }
94
96
  });
95
97
  }
96
98
 
@@ -70,12 +70,12 @@ export default class ScriptsComponent extends BaseComponent {
70
70
  }
71
71
 
72
72
  async process() {
73
- const promisesScripts = this.files.map((block, index) => this.build(block.file, { entriesToLint: index == 0 ? this.globs : null }));
73
+ const promisesScripts = this.files.map((group, index) => this.build(group.file, { entriesToLint: index == 0 ? this.globs : null }));
74
74
  await Promise.all(promisesScripts);
75
75
  }
76
76
 
77
77
  watch() {
78
- this.chokidar.watch(this.globs, {
78
+ this.watcher = this.chokidar.watch(this.globs, {
79
79
  ...this.project.chokidarOpts
80
80
  }).on('all', (event, path) => {
81
81
  this.process();
@@ -16,7 +16,7 @@ export default class ServerComponent extends BaseComponent {
16
16
  this.watchedFiles.push(`**/*.php`);
17
17
  }
18
18
  this.ignoredFiles = [
19
- `node_modules/**/*`,
19
+ `node_modules/**`,
20
20
  `vendor/**/*`,
21
21
  `**/*.map`
22
22
  ];
@@ -74,7 +74,10 @@ export default class ServerComponent extends BaseComponent {
74
74
  }
75
75
 
76
76
  async watch() {
77
- this.server.watch(this.watchedFiles, (event, file) => {
77
+ this.server.watch(this.watchedFiles, {
78
+ ignored: this.ignoredFiles,
79
+ ignoreInitial: true
80
+ }, (event, file) => {
78
81
  if (['add', 'addDir', 'change'].includes(event)) {
79
82
  this.server.reload(file);
80
83
  if (file.split('.').pop() == 'css') {
@@ -160,13 +160,13 @@ export default class StyleComponent extends BaseComponent {
160
160
  await this.buildTheme();
161
161
  }
162
162
  let i = 0;
163
- for (var block of this.files) {
164
- if (!entry || entry == block.file) {
165
- await this.build(block.file, {
166
- name: block.name,
163
+ for (let group of this.files) {
164
+ if (!entry || entry == group.file) {
165
+ await this.build(group.file, {
166
+ name: group.name,
167
167
  entriesToLint: i == 0 ? this.globs : null
168
168
  });
169
- if (entry == block.file) {
169
+ if (entry == group.file) {
170
170
  break;
171
171
  }
172
172
  i++;
@@ -175,16 +175,16 @@ export default class StyleComponent extends BaseComponent {
175
175
  }
176
176
 
177
177
  watch() {
178
- this.chokidar.watch([
178
+ this.watcher = this.chokidar.watch([
179
179
  ...[this.project.paths.theme.json],
180
180
  this.globs
181
181
  ], {
182
182
  ...this.project.chokidarOpts
183
183
  }).on('all', (event, path) => {
184
184
  let hasRanSingle = false;
185
- for (var block of this.files) {
186
- if (path == block.file || this.utils.getImportedSASSFiles(block.file).includes(path)) {
187
- this.process(block.file, { buildTheme: path == this.project.paths.theme.json });
185
+ for (let group of this.files) {
186
+ if (path == group.file || this.utils.getImportedSASSFiles(group.file).includes(path)) {
187
+ this.process(group.file, { buildTheme: path == this.project.paths.theme.json });
188
188
  hasRanSingle = true;
189
189
  }
190
190
  }
package/lib/project.js CHANGED
@@ -43,12 +43,13 @@ project.paths = {
43
43
  project.chokidarOpts = {
44
44
  ignoreInitial: true,
45
45
  ignored: [
46
+ /(^|[\/\\])\.DS_Store$/,
46
47
  project.paths.nodeModules,
47
48
  `${project.paths.nodeModules}/**/*`,
48
49
  project.paths.composer.vendor,
49
50
  `${project.paths.composer.vendor}/**/*`,
50
51
  project.paths.theme.scss,
51
- `${project.path}/blocks/*/build/*.php`
52
+ `${project.path}/blocks/*/build/*.php`,
52
53
  ]
53
54
  };
54
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -22,24 +22,24 @@
22
22
  "sdc-build-wp": "./index.js"
23
23
  },
24
24
  "dependencies": {
25
- "@stylistic/stylelint-plugin": "^3.1.2",
26
- "@typescript-eslint/eslint-plugin": "^8.35.0",
27
- "@typescript-eslint/parser": "^8.35.0",
28
- "@wordpress/scripts": "^30.19.0",
25
+ "@stylistic/stylelint-plugin": "^4.0.0",
26
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
27
+ "@typescript-eslint/parser": "^8.38.0",
28
+ "@wordpress/scripts": "^30.20.0",
29
29
  "autoprefixer": "^10.4.21",
30
30
  "browser-sync": "^3.0.4",
31
31
  "chalk": "^5.4.1",
32
32
  "chokidar": "^4.0.3",
33
- "esbuild": "^0.25.5",
34
- "eslint": "^9.29.0",
33
+ "esbuild": "^0.25.8",
34
+ "eslint": "^9.31.0",
35
35
  "fs-extra": "^11.3.0",
36
36
  "minimist": "^1.2.8",
37
37
  "postcss": "^8.5.6",
38
38
  "postcss-scss": "^4.0.9",
39
39
  "postcss-sort-media-queries": "^5.2.0",
40
40
  "sass": "^1.89.2",
41
- "sharp": "^0.34.2",
42
- "stylelint": "^16.21.0",
41
+ "sharp": "^0.34.3",
42
+ "stylelint": "^16.22.0",
43
43
  "svgo": "^4.0.0",
44
44
  "tail": "^2.2.6"
45
45
  }