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 +6 -2
- package/lib/components/base.js +1 -0
- package/lib/components/blocks.js +3 -1
- package/lib/components/fonts.js +1 -1
- package/lib/components/images.js +4 -1
- package/lib/components/php.js +4 -2
- package/lib/components/scripts.js +2 -2
- package/lib/components/server.js +5 -2
- package/lib/components/style.js +9 -9
- package/lib/project.js +2 -1
- package/package.json +9 -9
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();
|
package/lib/components/base.js
CHANGED
package/lib/components/blocks.js
CHANGED
|
@@ -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
|
-
|
|
89
|
+
if (!['unlink', 'unlinkDir'].includes(event)) {
|
|
90
|
+
this.process(block);
|
|
91
|
+
}
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
94
|
}
|
package/lib/components/fonts.js
CHANGED
package/lib/components/images.js
CHANGED
|
@@ -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();
|
package/lib/components/php.js
CHANGED
|
@@ -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
|
-
|
|
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((
|
|
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();
|
package/lib/components/server.js
CHANGED
|
@@ -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,
|
|
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') {
|
package/lib/components/style.js
CHANGED
|
@@ -160,13 +160,13 @@ export default class StyleComponent extends BaseComponent {
|
|
|
160
160
|
await this.buildTheme();
|
|
161
161
|
}
|
|
162
162
|
let i = 0;
|
|
163
|
-
for (
|
|
164
|
-
if (!entry || entry ==
|
|
165
|
-
await this.build(
|
|
166
|
-
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 ==
|
|
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 (
|
|
186
|
-
if (path ==
|
|
187
|
-
this.process(
|
|
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.
|
|
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": "^
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
27
|
-
"@typescript-eslint/parser": "^8.
|
|
28
|
-
"@wordpress/scripts": "^30.
|
|
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.
|
|
34
|
-
"eslint": "^9.
|
|
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.
|
|
42
|
-
"stylelint": "^16.
|
|
41
|
+
"sharp": "^0.34.3",
|
|
42
|
+
"stylelint": "^16.22.0",
|
|
43
43
|
"svgo": "^4.0.0",
|
|
44
44
|
"tail": "^2.2.6"
|
|
45
45
|
}
|