sdc-build-wp 4.5.3 → 4.5.5
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 +3 -3
- package/lib/components/blocks.js +2 -2
- package/lib/components/images.js +2 -2
- package/lib/components/scripts.js +1 -1
- package/lib/components/server.js +18 -11
- package/package.json +11 -11
package/index.js
CHANGED
@@ -43,14 +43,18 @@ project.builds = argv.builds ? (Array.isArray(argv.builds) ? argv.builds : argv.
|
|
43
43
|
|
44
44
|
(async() => {
|
45
45
|
|
46
|
-
|
46
|
+
if (argv.watch) {
|
47
|
+
project.components.server.serve(false);
|
48
|
+
}
|
49
|
+
|
50
|
+
let initialBuildTimerStart = performance.now();
|
47
51
|
log('info', `Started initial build [${project.builds.join(', ')}]`);
|
48
52
|
let promisesBuilds = [];
|
49
53
|
for (let build of project.builds) {
|
50
54
|
promisesBuilds.push(project.components[build].init());
|
51
55
|
}
|
52
56
|
await Promise.all(promisesBuilds);
|
53
|
-
log('info', `Finished initial build in ${Math.round((
|
57
|
+
log('info', `Finished initial build in ${Math.round((performance.now() - initialBuildTimerStart) / 1000)} seconds`);
|
54
58
|
|
55
59
|
if (argv.watch) {
|
56
60
|
log('info', `Started watching [${project.builds.join(', ')}]`);
|
package/lib/components/base.js
CHANGED
@@ -25,7 +25,7 @@ class BaseComponent {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
start() {
|
28
|
-
this.timer =
|
28
|
+
this.timer = performance.now();
|
29
29
|
}
|
30
30
|
|
31
31
|
end(options) {
|
@@ -33,9 +33,9 @@ class BaseComponent {
|
|
33
33
|
verb: 'Built',
|
34
34
|
itemLabel: null,
|
35
35
|
timerStart: this.timer,
|
36
|
-
timerEnd:
|
36
|
+
timerEnd: performance.now()
|
37
37
|
}, options);
|
38
|
-
this.log('success', `${options.verb}${options.itemLabel ? ` ${options.itemLabel}` : ''} in ${options.timerEnd - options.timerStart}ms`);
|
38
|
+
this.log('success', `${options.verb}${options.itemLabel ? ` ${options.itemLabel}` : ''} in ${Math.round(options.timerEnd - options.timerStart)}ms`);
|
39
39
|
}
|
40
40
|
|
41
41
|
async watch() {
|
package/lib/components/blocks.js
CHANGED
@@ -27,7 +27,7 @@ export default class BlocksComponent extends BaseComponent {
|
|
27
27
|
options = Object.assign({}, {}, options);
|
28
28
|
let entryLabel = entry.replace(this.project.path, '');
|
29
29
|
|
30
|
-
let timerStart =
|
30
|
+
let timerStart = performance.now();
|
31
31
|
|
32
32
|
this.start();
|
33
33
|
|
@@ -68,7 +68,7 @@ export default class BlocksComponent extends BaseComponent {
|
|
68
68
|
this.end({
|
69
69
|
itemLabel: entryLabel,
|
70
70
|
timerStart: timerStart,
|
71
|
-
timerEnd:
|
71
|
+
timerEnd: performance.now()
|
72
72
|
});
|
73
73
|
}
|
74
74
|
|
package/lib/components/images.js
CHANGED
@@ -23,7 +23,7 @@ export default class ImagesComponent extends BaseComponent {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
async build(entry, options) {
|
26
|
-
let timerStart =
|
26
|
+
let timerStart = performance.now();
|
27
27
|
let dest = entry.replace(`${this.project.paths.src.src}/${this.project.paths.src.images}`, `${this.project.paths.dist}/${this.project.paths.src.images}`);
|
28
28
|
const files = await fs.readdir(entry);
|
29
29
|
await fs.mkdir(dest, { recursive: true });
|
@@ -62,7 +62,7 @@ export default class ImagesComponent extends BaseComponent {
|
|
62
62
|
this.end({
|
63
63
|
itemLabel: `${dest.replace(this.project.path, '')} (${convertedImagesCount} image${convertedImagesCount == 1 ? '' : 's'}${copiedFilesCount ? `, ${copiedFilesCount} file${copiedFilesCount == 1 ? '' : 's'}` : ''})`,
|
64
64
|
timerStart: timerStart,
|
65
|
-
timerEnd:
|
65
|
+
timerEnd: performance.now()
|
66
66
|
});
|
67
67
|
}
|
68
68
|
|
@@ -56,7 +56,7 @@ export default class ScriptsComponent extends BaseComponent {
|
|
56
56
|
sourcemap: process.env.NODE_ENV == 'production' ? false : true
|
57
57
|
});
|
58
58
|
if (result.warnings.length > 0) {
|
59
|
-
log('warn', result.warnings);
|
59
|
+
this.log('warn', result.warnings);
|
60
60
|
}
|
61
61
|
} catch (error) {
|
62
62
|
console.error(error);
|
package/lib/components/server.js
CHANGED
@@ -7,29 +7,30 @@ export default class ServerComponent extends BaseComponent {
|
|
7
7
|
super();
|
8
8
|
this.description = `Run a dev proxy server for live reloading`;
|
9
9
|
this.server = bsCreate();
|
10
|
-
|
11
|
-
|
12
|
-
async init() {
|
13
|
-
//
|
14
|
-
}
|
15
|
-
|
16
|
-
start() {
|
17
|
-
let watchedFiles = [
|
10
|
+
this.watchedFiles = [
|
18
11
|
`${this.project.path}/${this.project.paths.dist}/**/*`,
|
19
12
|
`!**/*.map`,
|
20
13
|
`${this.project.path}/**/*.html`,
|
21
14
|
`${this.project.path}/**/*.json`,
|
22
15
|
];
|
23
16
|
if (!this.project.shouldPHPLint) {
|
24
|
-
watchedFiles.push(`${this.project.path}/**/*.php`);
|
17
|
+
this.watchedFiles.push(`${this.project.path}/**/*.php`);
|
25
18
|
}
|
19
|
+
}
|
20
|
+
|
21
|
+
async init() {
|
22
|
+
//
|
23
|
+
}
|
24
|
+
|
25
|
+
serve(watch = false) {
|
26
26
|
let bsOptions = {
|
27
27
|
logPrefix: '',
|
28
28
|
port: this.project.package.sdc?.port || 3000,
|
29
29
|
proxy: this.project.package.sdc?.browsersync?.localProxyURL,
|
30
|
-
files: watchedFiles,
|
30
|
+
files: watch ? this.watchedFiles : [],
|
31
31
|
reloadDelay: 250,
|
32
32
|
reloadDebounce: 1000,
|
33
|
+
reloadOnRestart: true,
|
33
34
|
watchEvents: this.project.package.sdc?.browsersync?.watchEvents || ['add', 'change', 'unlink', 'addDir', 'unlinkDir'],
|
34
35
|
open: this.project.package.sdc?.open || false,
|
35
36
|
https: (process.env.SSL_KEY_PATH && process.env.SSL_CRT_PATH ? {
|
@@ -63,7 +64,13 @@ export default class ServerComponent extends BaseComponent {
|
|
63
64
|
}
|
64
65
|
|
65
66
|
async watch() {
|
66
|
-
this.
|
67
|
+
this.server.watch(this.watchedFiles, (event, file) => {
|
68
|
+
if (event === 'change' || event === 'add') {
|
69
|
+
this.server.reload(file);
|
70
|
+
} else if (event === 'unlink') {
|
71
|
+
this.server.reload();
|
72
|
+
}
|
73
|
+
});
|
67
74
|
}
|
68
75
|
|
69
76
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "sdc-build-wp",
|
3
|
-
"version": "4.5.
|
3
|
+
"version": "4.5.5",
|
4
4
|
"description": "Custom WordPress build process.",
|
5
5
|
"engines": {
|
6
6
|
"node": ">=22"
|
@@ -23,24 +23,24 @@
|
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
25
|
"@stylistic/stylelint-plugin": "^3.1.2",
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
27
|
-
"@typescript-eslint/parser": "^8.
|
28
|
-
"@wordpress/scripts": "^30.
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
27
|
+
"@typescript-eslint/parser": "^8.33.0",
|
28
|
+
"@wordpress/scripts": "^30.17.0",
|
29
29
|
"autoprefixer": "^10.4.21",
|
30
|
-
"browser-sync": "^3.0.
|
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.5",
|
34
|
+
"eslint": "^9.28.0",
|
35
35
|
"fs-extra": "^11.3.0",
|
36
36
|
"jiti": "^2.4.2",
|
37
37
|
"minimist": "^1.2.8",
|
38
|
-
"postcss": "^8.5.
|
38
|
+
"postcss": "^8.5.4",
|
39
39
|
"postcss-scss": "^4.0.9",
|
40
40
|
"postcss-sort-media-queries": "^5.2.0",
|
41
|
-
"sass": "^1.
|
42
|
-
"sharp": "^0.
|
43
|
-
"stylelint": "^16.
|
41
|
+
"sass": "^1.89.1",
|
42
|
+
"sharp": "^0.34.2",
|
43
|
+
"stylelint": "^16.20.0",
|
44
44
|
"svgo": "^3.3.2",
|
45
45
|
"tail": "^2.2.6"
|
46
46
|
}
|