sdc-build-wp 3.2.3 → 3.2.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/eslint.config.js +23 -0
- package/lib/scripts.js +4 -3
- package/lib/style.js +14 -13
- package/package.json +44 -41
- package/.eslintrc +0 -19
package/eslint.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
languageOptions: {
|
|
4
|
+
parserOptions: {
|
|
5
|
+
ecmaVersion: 6,
|
|
6
|
+
sourceType: "module",
|
|
7
|
+
ecmaFeatures: {
|
|
8
|
+
jsx: true,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
semi: 1,
|
|
14
|
+
indent: [1, "tab"],
|
|
15
|
+
"no-multiple-empty-lines": [
|
|
16
|
+
1,
|
|
17
|
+
{
|
|
18
|
+
max: 1,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
];
|
package/lib/scripts.js
CHANGED
|
@@ -3,15 +3,16 @@ import project from '../lib/project.js';
|
|
|
3
3
|
import log from './logging.js';
|
|
4
4
|
import * as esbuild from 'esbuild';
|
|
5
5
|
import { ESLint } from 'eslint';
|
|
6
|
-
import
|
|
6
|
+
import * as eslintConfig from '../eslint.config.js';
|
|
7
7
|
|
|
8
8
|
const buildJS = async (entry, name, entriesToLint) => {
|
|
9
9
|
let entryLabel = `/dist/scripts/${path.parse(entry).base.replace('.js', '.min.js')}`;
|
|
10
10
|
let timerStart = Date.now();
|
|
11
11
|
try {
|
|
12
12
|
const eslint = new ESLint({
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
fix: true,
|
|
14
|
+
overrideConfigFile: true,
|
|
15
|
+
overrideConfig: eslintConfig.default[0]
|
|
15
16
|
});
|
|
16
17
|
const lintresults = await eslint.lintFiles(entriesToLint || [entry]);
|
|
17
18
|
await ESLint.outputFixes(lintresults);
|
package/lib/style.js
CHANGED
|
@@ -79,6 +79,12 @@ export const buildSassTheme = async () => {
|
|
|
79
79
|
|
|
80
80
|
export const buildSass = async (entry, name, entriesToLint) => {
|
|
81
81
|
let timerStart = Date.now();
|
|
82
|
+
if (!fs.existsSync(project.path + '/dist')) {
|
|
83
|
+
fs.mkdirSync(project.path + '/dist');
|
|
84
|
+
}
|
|
85
|
+
if (!fs.existsSync(project.path + '/dist/style')) {
|
|
86
|
+
fs.mkdirSync(project.path + '/dist/style');
|
|
87
|
+
}
|
|
82
88
|
let outFile = project.path + '/dist/' + name + '.min.css';
|
|
83
89
|
if (name.startsWith('blocks/')) {
|
|
84
90
|
outFile = project.path + '/' + name + '.min.css';
|
|
@@ -92,8 +98,8 @@ export const buildSass = async (entry, name, entriesToLint) => {
|
|
|
92
98
|
fix: true
|
|
93
99
|
}).then((data) => {
|
|
94
100
|
if (data.errored) {
|
|
95
|
-
console.error(data.
|
|
96
|
-
log('error', `Failed linting ${entry.replace(project.path + '/_src/style/', '')} - See above error.`);
|
|
101
|
+
console.error(data.report);
|
|
102
|
+
log('error', `Failed linting ${entry.replace(project.path + '/_src/style/', '')} - See above linting error.`);
|
|
97
103
|
return false;
|
|
98
104
|
}
|
|
99
105
|
try {
|
|
@@ -102,16 +108,11 @@ export const buildSass = async (entry, name, entriesToLint) => {
|
|
|
102
108
|
});
|
|
103
109
|
fs.writeFile(outFile, result.css, function(err) {
|
|
104
110
|
if (err) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
console.error(err);
|
|
112
|
+
log('error', `Failed compiling ${entryLabel} - See above file writing error.`);
|
|
113
|
+
return false;
|
|
108
114
|
} else {
|
|
109
|
-
|
|
110
|
-
fs.mkdirSync(project.path + '/dist');
|
|
111
|
-
}
|
|
112
|
-
if (!fs.existsSync(project.path + '/dist/style')) {
|
|
113
|
-
fs.mkdirSync(project.path + '/dist/style');
|
|
114
|
-
}
|
|
115
|
+
|
|
115
116
|
postcss([
|
|
116
117
|
autoprefixer(),
|
|
117
118
|
sortMQ()
|
|
@@ -119,7 +120,7 @@ export const buildSass = async (entry, name, entriesToLint) => {
|
|
|
119
120
|
fs.writeFile(outFile, resultPost.css, function(err) {
|
|
120
121
|
if (err) {
|
|
121
122
|
console.log(err);
|
|
122
|
-
log('error', `Failed saving ${entryLabel} - See above error.`);
|
|
123
|
+
log('error', `Failed saving ${entryLabel} - See above postcss error.`);
|
|
123
124
|
return false;
|
|
124
125
|
} else {
|
|
125
126
|
log('success', `Built ${entryLabel} in ${Date.now() - timerStart}ms`);
|
|
@@ -130,7 +131,7 @@ export const buildSass = async (entry, name, entriesToLint) => {
|
|
|
130
131
|
});
|
|
131
132
|
} catch(error) {
|
|
132
133
|
console.error(error);
|
|
133
|
-
log('error', `Failed building ${entryLabel} - See above error.`);
|
|
134
|
+
log('error', `Failed building ${entryLabel} - See above sass error.`);
|
|
134
135
|
return false;
|
|
135
136
|
}
|
|
136
137
|
});
|
package/package.json
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
2
|
+
"name": "sdc-build-wp",
|
|
3
|
+
"version": "3.2.4",
|
|
4
|
+
"description": "Custom WordPress build process.",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": "^20"
|
|
7
|
+
},
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Robert Sefer",
|
|
10
|
+
"email": "rob@seferdesign.com",
|
|
11
|
+
"url": "https://seferdesign.com"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git://github.com/SeferDesign/sdc-build-wp.git"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "echo \"Skipping tests.\""
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"sdc-build-wp": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@stylistic/stylelint-plugin": "^2.1.1",
|
|
26
|
+
"@wordpress/scripts": "^27.7.0",
|
|
27
|
+
"autoprefixer": "^10.4.19",
|
|
28
|
+
"browser-sync": "^3.0.2",
|
|
29
|
+
"chalk": "^5.3.0",
|
|
30
|
+
"chokidar": "^3.6.0",
|
|
31
|
+
"esbuild": "^0.20.2",
|
|
32
|
+
"eslint": "^9.1.1",
|
|
33
|
+
"fs-extra": "^11.2.0",
|
|
34
|
+
"glob": "^10.3.12",
|
|
35
|
+
"imagemin": "^8.0.1",
|
|
36
|
+
"imagemin-jpegtran": "^7.0.0",
|
|
37
|
+
"imagemin-pngquant": "^9.0.2",
|
|
38
|
+
"imagemin-svgo": "^10.0.1",
|
|
39
|
+
"minimist": "^1.2.8",
|
|
40
|
+
"postcss": "^8.4.38",
|
|
41
|
+
"postcss-scss": "^4.0.9",
|
|
42
|
+
"postcss-sort-media-queries": "^5.2.0",
|
|
43
|
+
"sass": "^1.75.0",
|
|
44
|
+
"stylelint": "^16.4.0"
|
|
45
|
+
}
|
|
43
46
|
}
|
package/.eslintrc
DELETED