sdc-build-wp 4.0.0 → 4.0.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/.phpcs.xml +0 -3
- package/index.js +1 -2
- package/lib/browsersync.js +12 -7
- package/lib/php.js +8 -1
- package/package.json +11 -11
package/.phpcs.xml
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
</rule>
|
|
10
10
|
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
|
|
11
11
|
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
|
|
12
|
-
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
|
|
13
12
|
<rule ref="Generic.Formatting.SpaceAfterCast"/>
|
|
14
13
|
<rule ref="Generic.Formatting.SpaceAfterNot">
|
|
15
14
|
<properties>
|
|
@@ -39,8 +38,6 @@
|
|
|
39
38
|
<rule ref="PEAR.NamingConventions.ValidClassName"/>
|
|
40
39
|
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
|
|
41
40
|
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
|
|
42
|
-
<rule ref="Squiz.ControlStructures.SwitchDeclaration"/>
|
|
43
|
-
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
|
|
44
41
|
<rule ref="Squiz.Strings.ConcatenationSpacing">
|
|
45
42
|
<properties>
|
|
46
43
|
<property name="spacing" value="1" />
|
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import log from './lib/logging.js';
|
|
|
12
12
|
import bustCache from './lib/bustCache.js';
|
|
13
13
|
import { buildSass, buildSassTheme } from './lib/style.js';
|
|
14
14
|
import buildJS from './lib/scripts.js';
|
|
15
|
-
import buildPHP from './lib/php.js';
|
|
15
|
+
import { default as buildPHP, shouldPHPLint } from './lib/php.js';
|
|
16
16
|
import buildBlock from './lib/blocks.js';
|
|
17
17
|
import buildImages from './lib/images.js';
|
|
18
18
|
import buildFonts from './lib/fonts.js';
|
|
@@ -27,7 +27,6 @@ let chokidarOpts = {
|
|
|
27
27
|
]
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
let shouldPHPLint = typeof project.package.sdc?.php === 'undefined' || typeof project.package.sdc?.php.enabled === 'undefined' || project.package.sdc?.php.enabled == true;
|
|
31
30
|
let phpGlobPath = project.package?.sdc?.phpGlobPath || project.path + '/**/*.php';
|
|
32
31
|
let phpGlob = globSync(phpGlobPath, {
|
|
33
32
|
ignore: [
|
package/lib/browsersync.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import project from '../lib/project.js';
|
|
2
2
|
import { create as bsCreate } from 'browser-sync';
|
|
3
|
-
|
|
3
|
+
import { shouldPHPLint } from './php.js';
|
|
4
|
+
|
|
5
|
+
export const browserSync = bsCreate();
|
|
4
6
|
|
|
5
7
|
const buildBrowserSync = () => {
|
|
8
|
+
let watchedFiles = [
|
|
9
|
+
project.path + '/dist/**/*',
|
|
10
|
+
project.path + '/**/*.html',
|
|
11
|
+
project.path + '/**/*.json',
|
|
12
|
+
];
|
|
13
|
+
if (!shouldPHPLint) {
|
|
14
|
+
watchedFiles.push(project.path + '/**/*.php');
|
|
15
|
+
}
|
|
6
16
|
let bsOptions = {
|
|
7
17
|
logPrefix: '',
|
|
8
18
|
port: project.package.sdc?.port || 3000,
|
|
9
19
|
proxy: project.package.sdc?.browsersync?.localProxyURL,
|
|
10
|
-
files:
|
|
11
|
-
project.path + '/dist/**/*',
|
|
12
|
-
project.path + '/**/*.php',
|
|
13
|
-
project.path + '/**/*.html',
|
|
14
|
-
project.path + '/**/*.json',
|
|
15
|
-
],
|
|
20
|
+
files: watchedFiles,
|
|
16
21
|
reloadDelay: 500,
|
|
17
22
|
reloadDebounce: 500,
|
|
18
23
|
watchEvents: project.package.sdc?.browsersync?.watchEvents || ['add', 'change', 'unlink', 'addDir', 'unlinkDir'],
|
package/lib/php.js
CHANGED
|
@@ -4,9 +4,12 @@ import project from '../lib/project.js';
|
|
|
4
4
|
import log from './logging.js';
|
|
5
5
|
import { exec } from 'child_process';
|
|
6
6
|
import { promisify } from 'util';
|
|
7
|
+
import { browserSync } from './browsersync.js';
|
|
7
8
|
|
|
8
9
|
const execPromise = promisify(exec);
|
|
9
10
|
|
|
11
|
+
export const shouldPHPLint = typeof project.package.sdc?.php === 'undefined' || typeof project.package.sdc?.php.enabled === 'undefined' || project.package.sdc?.php.enabled == true
|
|
12
|
+
|
|
10
13
|
let workingLintMethod = typeof project.package.sdc?.php?.fix !== 'undefined' && project.package.sdc?.php?.fix === false ? 'warn' : 'fix';
|
|
11
14
|
|
|
12
15
|
const buildPHP = async (entry, method) => {
|
|
@@ -47,7 +50,10 @@ const buildPHP = async (entry, method) => {
|
|
|
47
50
|
error.stderr?.length ||
|
|
48
51
|
(
|
|
49
52
|
error.stdout?.length &&
|
|
50
|
-
|
|
53
|
+
(
|
|
54
|
+
error.stdout.startsWith('ERROR:') ||
|
|
55
|
+
error.stdout.includes('FAILED TO FIX')
|
|
56
|
+
)
|
|
51
57
|
)
|
|
52
58
|
) {
|
|
53
59
|
console.error(error.stderr?.length ? error.stderr : error.stdout);
|
|
@@ -59,6 +65,7 @@ const buildPHP = async (entry, method) => {
|
|
|
59
65
|
log('success', `Linted (${workingLintMethod}) ${entryLabel.replace(project.path, '')} in ${Date.now() - timerStart}ms`);
|
|
60
66
|
}
|
|
61
67
|
}
|
|
68
|
+
browserSync.reload();
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
export default buildPHP;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdc-build-wp",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Custom WordPress build process.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -22,26 +22,26 @@
|
|
|
22
22
|
"sdc-build-wp": "./index.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@stylistic/stylelint-plugin": "^3.1.
|
|
26
|
-
"@wordpress/scripts": "^30.
|
|
25
|
+
"@stylistic/stylelint-plugin": "^3.1.2",
|
|
26
|
+
"@wordpress/scripts": "^30.11.0",
|
|
27
27
|
"autoprefixer": "^10.4.20",
|
|
28
28
|
"browser-sync": "^3.0.3",
|
|
29
|
-
"chalk": "^5.
|
|
29
|
+
"chalk": "^5.4.1",
|
|
30
30
|
"chokidar": "^3.6.0",
|
|
31
|
-
"esbuild": "^0.
|
|
32
|
-
"eslint": "^9.
|
|
33
|
-
"fs-extra": "^11.
|
|
34
|
-
"glob": "^11.0.
|
|
31
|
+
"esbuild": "^0.25.0",
|
|
32
|
+
"eslint": "^9.21.0",
|
|
33
|
+
"fs-extra": "^11.3.0",
|
|
34
|
+
"glob": "^11.0.1",
|
|
35
35
|
"imagemin": "^9.0.0",
|
|
36
36
|
"imagemin-jpegtran": "^8.0.0",
|
|
37
37
|
"imagemin-pngquant": "^10.0.0",
|
|
38
38
|
"imagemin-svgo": "^11.0.1",
|
|
39
39
|
"minimist": "^1.2.8",
|
|
40
|
-
"postcss": "^8.
|
|
40
|
+
"postcss": "^8.5.3",
|
|
41
41
|
"postcss-scss": "^4.0.9",
|
|
42
42
|
"postcss-sort-media-queries": "^5.2.0",
|
|
43
|
-
"sass": "^1.
|
|
44
|
-
"stylelint": "^16.
|
|
43
|
+
"sass": "^1.85.0",
|
|
44
|
+
"stylelint": "^16.14.1",
|
|
45
45
|
"tail": "^2.2.6"
|
|
46
46
|
}
|
|
47
47
|
}
|