@ideasonpurpose/build-tools-wordpress 2.10.3 → 2.10.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/.vscode/settings.json +9 -2
- package/CHANGELOG.md +12 -0
- package/README.md +4 -4
- package/bin/zip.js +27 -38
- package/lib/AfterDoneReporterPlugin.js +1 -1
- package/lib/buildConfig.js +58 -16
- package/package.json +1 -1
package/.vscode/settings.json
CHANGED
|
@@ -11,12 +11,19 @@
|
|
|
11
11
|
"statusBar.background": "#ff8ebf",
|
|
12
12
|
"statusBar.foreground": "#15202b",
|
|
13
13
|
"statusBarItem.hoverBackground": "#ff5ba2",
|
|
14
|
-
"statusBarItem.remoteBackground": "#
|
|
14
|
+
"statusBarItem.remoteBackground": "#edffdf",
|
|
15
15
|
"statusBarItem.remoteForeground": "#15202b",
|
|
16
16
|
"titleBar.activeBackground": "#ff8ebf",
|
|
17
17
|
"titleBar.activeForeground": "#15202b",
|
|
18
18
|
"titleBar.inactiveBackground": "#ff8ebf99",
|
|
19
|
-
"titleBar.inactiveForeground": "#15202b99"
|
|
19
|
+
"titleBar.inactiveForeground": "#15202b99",
|
|
20
|
+
"activityBarTop.activeBackground": "#ffc1dc",
|
|
21
|
+
"activityBarTop.background": "#ffc1dc",
|
|
22
|
+
"activityBarTop.foreground": "#15202b",
|
|
23
|
+
"activityBarTop.inactiveForeground": "#15202b99",
|
|
24
|
+
"commandCenter.foreground": "#15202b",
|
|
25
|
+
"statusBar.debuggingBackground": "#ff8ebf",
|
|
26
|
+
"statusBar.debuggingForeground": "#15202b"
|
|
20
27
|
},
|
|
21
28
|
"peacock.color": "#ff8ebf"
|
|
22
29
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### v2.10.4
|
|
8
|
+
|
|
9
|
+
> 18 July 2026
|
|
10
|
+
|
|
11
|
+
- fix zip reporting and resolve typescript types
|
|
12
|
+
|
|
13
|
+
#### v2.10.3
|
|
14
|
+
|
|
15
|
+
> 17 July 2026
|
|
16
|
+
|
|
17
|
+
- More reporter tweaks
|
|
18
|
+
|
|
7
19
|
#### v2.10.2
|
|
8
20
|
|
|
9
21
|
> 16 July 2026
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ideasonpurpose/build-tools-wordpress
|
|
2
2
|
|
|
3
|
-
#### Version 2.10.
|
|
3
|
+
#### Version 2.10.5
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@ideasonpurpose/build-tools-wordpress)
|
|
6
6
|
[](https://github.com/ideasonpurpose/build-tools-wordpress#readme)
|
|
@@ -95,13 +95,13 @@ Sass can import stylesheet files directly from npm packages. Use the full path f
|
|
|
95
95
|
|
|
96
96
|
A GitHub action will auto-publish version-tagged releases to npm. In order to publish, the repository must have an `NPM_TOKEN` secret set with the token from npm. [Log into npmjs.org](https://www.npmjs.com/login) with a publish-authorized account, then find the token page linked from the Profile page sidebar. Generate a new token and update the repository secret.
|
|
97
97
|
|
|
98
|
-
<!-- START IOP CREDIT BLURB -->
|
|
98
|
+
<!-- START IOP CREDIT BLURB 2026-07-->
|
|
99
99
|
|
|
100
100
|
##
|
|
101
101
|
|
|
102
102
|
#### Brought to you by IOP
|
|
103
103
|
|
|
104
|
-
| <a href="https://www.ideasonpurpose.com"><img src="https://raw.githubusercontent.com/ideasonpurpose/ideasonpurpose/master/iop-logo-white-on-black-88px.png" height="44" align="top" alt="IOP Logo"></a> | This project is actively developed and used in production at <a href="https://www.ideasonpurpose.com">Ideas On Purpose</a>. |
|
|
105
|
-
|
|
|
104
|
+
| <a href="https://www.ideasonpurpose.com"><img src="https://raw.githubusercontent.com/ideasonpurpose/ideasonpurpose/master/iop-logo-white-on-black-88px.png" width="44" height="44" align="top" alt="IOP Logo"></a> <br> | This project is actively developed and used in production at <a href="https://www.ideasonpurpose.com">Ideas On Purpose</a>. <br> |
|
|
105
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
106
106
|
|
|
107
107
|
<!-- END IOP CREDIT BLURB -->
|
package/bin/zip.js
CHANGED
|
@@ -1,49 +1,46 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
+
// @ts-check
|
|
2
3
|
|
|
3
|
-
import { readJsonSync, ensureFileSync } from "fs-extra/esm";
|
|
4
|
-
import { stat } from "node:fs/promises";
|
|
5
|
-
|
|
6
|
-
import { basename, dirname, join } from "node:path/posix";
|
|
7
4
|
import { createReadStream, createWriteStream, statSync } from "node:fs";
|
|
8
|
-
|
|
5
|
+
import { basename, dirname, join } from "node:path/posix";
|
|
9
6
|
import { clearLine, cursorTo } from "node:readline";
|
|
10
7
|
|
|
11
|
-
import url from "url";
|
|
12
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
13
|
-
|
|
14
8
|
import { ZipArchive } from "archiver";
|
|
15
9
|
import chalk from "chalk";
|
|
16
|
-
import
|
|
10
|
+
import cliTruncate from "cli-truncate";
|
|
11
|
+
import { cosmiconfig } from "cosmiconfig";
|
|
17
12
|
import { filesize } from "filesize";
|
|
13
|
+
import { readJsonSync, ensureFileSync } from "fs-extra/esm";
|
|
18
14
|
import { globby } from "globby";
|
|
19
15
|
import isTextPath from "is-text-path";
|
|
20
|
-
import cliTruncate from "cli-truncate";
|
|
21
|
-
import stringLength from "string-length";
|
|
22
16
|
import replaceStream from "replacestream";
|
|
17
|
+
import stringLength from "string-length";
|
|
23
18
|
|
|
24
|
-
// import buildConfig from "../lib/buildConfig.js";
|
|
25
19
|
import { buildConfig } from "../index.js";
|
|
26
|
-
// import {dirname} from "node:path";
|
|
27
20
|
import { prettierHrtime } from "../lib/prettier-hrtime.js";
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {import("../lib/buildConfig.js").BuildConfig} BuildConfig
|
|
24
|
+
*
|
|
25
|
+
* @typedef {Object} ArchiveFile
|
|
26
|
+
* @property {string} path - Path relative to projectDir
|
|
27
|
+
* @property {import("node:fs").Stats} stat
|
|
28
|
+
* @property {import("node:stream").Readable} contents
|
|
29
|
+
*/
|
|
32
30
|
|
|
33
31
|
async function getConfig() {
|
|
34
32
|
const siteDir = process.cwd();
|
|
35
33
|
const explorer = cosmiconfig("ideasonpurpose");
|
|
36
34
|
const configFile = await explorer.search(siteDir);
|
|
37
|
-
const config = await buildConfig(configFile);
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
/** @type {BuildConfig} */
|
|
37
|
+
const config = await buildConfig(configFile);
|
|
41
38
|
|
|
42
39
|
return { config };
|
|
43
40
|
}
|
|
41
|
+
/** @type {{ config: BuildConfig }} */
|
|
44
42
|
const { config } = await getConfig();
|
|
45
43
|
|
|
46
|
-
// config.configFileUrl = new URL("package.json", config.configFileUrl);
|
|
47
44
|
const pkgJson = readJsonSync(new URL("package.json", config.configFileUrl));
|
|
48
45
|
pkgJson.name = pkgJson.name ?? "archive";
|
|
49
46
|
pkgJson.version = pkgJson.version ?? "";
|
|
@@ -56,14 +53,6 @@ const versionDirName = `${archiveName}${archiveVersion}`.replace(/[ .]/g, "_");
|
|
|
56
53
|
const zipFileName = `${versionDirName}.zip`;
|
|
57
54
|
const zipFile = new URL(`_builds/${zipFileName}`, config.configFileUrl);
|
|
58
55
|
|
|
59
|
-
// console.log({
|
|
60
|
-
// archiveName,
|
|
61
|
-
// archiveVersion,
|
|
62
|
-
// versionDirName,
|
|
63
|
-
// zipFile,
|
|
64
|
-
// zipFileName,
|
|
65
|
-
// });
|
|
66
|
-
|
|
67
56
|
ensureFileSync(zipFile.pathname);
|
|
68
57
|
const output = createWriteStream(zipFile);
|
|
69
58
|
|
|
@@ -80,7 +69,6 @@ const start = process.hrtime();
|
|
|
80
69
|
* files will be found relative to this.
|
|
81
70
|
*/
|
|
82
71
|
const projectDir = new URL(`${config.src}/../`, config.configFileUrl);
|
|
83
|
-
// process.exit();
|
|
84
72
|
|
|
85
73
|
/**
|
|
86
74
|
* Counters for total uncompressed size and number of files
|
|
@@ -143,7 +131,10 @@ globby(
|
|
|
143
131
|
inBytes += chunk.length;
|
|
144
132
|
});
|
|
145
133
|
|
|
146
|
-
file.contents.on("end", () =>
|
|
134
|
+
file.contents.on("end", () => {
|
|
135
|
+
fileCount += 1;
|
|
136
|
+
foundReporter(file);
|
|
137
|
+
});
|
|
147
138
|
|
|
148
139
|
/**
|
|
149
140
|
* Adding a data handler changes a stream's mode from paused to flowing
|
|
@@ -164,8 +155,11 @@ globby(
|
|
|
164
155
|
.then(() => archive.finalize())
|
|
165
156
|
.catch(console.error);
|
|
166
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @param {ArchiveFile} file
|
|
160
|
+
*/
|
|
167
161
|
function foundReporter(file) {
|
|
168
|
-
|
|
162
|
+
if (!process.stdout.isTTY) return;
|
|
169
163
|
let outString = [
|
|
170
164
|
"🔍 ",
|
|
171
165
|
chalk.yellow("Found"),
|
|
@@ -181,9 +175,7 @@ function foundReporter(file) {
|
|
|
181
175
|
outString += chalk.blue(cliTruncate(file.path, cols, { position: "middle" }));
|
|
182
176
|
|
|
183
177
|
if (fileCount % 25 == 0) {
|
|
184
|
-
|
|
185
|
-
clearLine(process.stdout);
|
|
186
|
-
// process.stdout.cursorTo(0);
|
|
178
|
+
clearLine(process.stdout, 0);
|
|
187
179
|
cursorTo(process.stdout, 0);
|
|
188
180
|
process.stdout.write(outString);
|
|
189
181
|
}
|
|
@@ -196,10 +188,7 @@ function finishReporter() {
|
|
|
196
188
|
const savedBytes = inBytes - outBytes;
|
|
197
189
|
const savedPercent = ((1 - outBytes / inBytes) * 100).toFixed(2);
|
|
198
190
|
|
|
199
|
-
|
|
200
|
-
clearLine(process.stdout);
|
|
201
|
-
|
|
202
|
-
// process.stdout.cursorTo(0);
|
|
191
|
+
clearLine(process.stdout, 0);
|
|
203
192
|
cursorTo(process.stdout, 0);
|
|
204
193
|
|
|
205
194
|
console.log(
|
|
@@ -53,7 +53,7 @@ export class AfterDoneReporterPlugin {
|
|
|
53
53
|
|
|
54
54
|
const assetMap = new Map();
|
|
55
55
|
for (const asset of json.assets ?? []) {
|
|
56
|
-
if (/hot-update
|
|
56
|
+
if (/hot-update|\.asset\.php$/.test(asset.name)) continue;
|
|
57
57
|
assetMap.set(asset.name, asset);
|
|
58
58
|
}
|
|
59
59
|
|
package/lib/buildConfig.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
1
3
|
import fs from "fs-extra";
|
|
2
4
|
import { posix as path } from "path";
|
|
3
5
|
import chalk from "chalk";
|
|
4
6
|
import url from "url";
|
|
5
7
|
|
|
6
|
-
// import { findLocalPort } from "../index.js";
|
|
7
|
-
|
|
8
|
-
// import defaultConfig from "../default.config.js";
|
|
9
8
|
/**
|
|
10
9
|
* Future node versions should import package.json directly:
|
|
11
10
|
* import packageJson from "./package.json" with { type: "json" };
|
|
@@ -19,11 +18,46 @@ import url from "url";
|
|
|
19
18
|
* create a theme named 'iop-build-tools'.
|
|
20
19
|
*/
|
|
21
20
|
const pkgJsonPath = path.resolve(process.cwd(), "./package.json");
|
|
22
|
-
const packageJson = JSON.parse(fs.readFileSync(pkgJsonPath));
|
|
23
|
-
// import packageJson from "./package.json" with { type: "json" };
|
|
21
|
+
const packageJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
24
22
|
|
|
25
23
|
const { name: themeName } = packageJson;
|
|
26
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Resolved project config returned by {@link buildConfig}.
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Object} BuildConfig
|
|
29
|
+
* @property {string} src - Absolute path to the project source directory
|
|
30
|
+
* @property {string} dist - Absolute path to the project dist directory
|
|
31
|
+
* @property {Record<string, string|string[]>} entry - Webpack entry map keyed by basename
|
|
32
|
+
* @property {string} publicPath - Public URL path for compiled assets
|
|
33
|
+
* @property {string} contentBase
|
|
34
|
+
* @property {string} manifestFile
|
|
35
|
+
* @property {string} esTarget
|
|
36
|
+
* @property {string|false} devtool
|
|
37
|
+
* @property {string[]} transpileDependencies
|
|
38
|
+
* @property {string|boolean} proxy
|
|
39
|
+
* @property {URL} configFileUrl - File URL for the discovered config/package.json
|
|
40
|
+
* @property {"theme"|"plugin"|string} [type] - Project type; plugins omit version from archive names
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* User-facing config values before path resolution and entry normalization.
|
|
45
|
+
*
|
|
46
|
+
* @typedef {Object} BuildConfigInput
|
|
47
|
+
* @property {string} [src]
|
|
48
|
+
* @property {string} [dist]
|
|
49
|
+
* @property {string|string[]|Record<string, string|string[]>} [entry]
|
|
50
|
+
* @property {string} [publicPath]
|
|
51
|
+
* @property {string} [contentBase]
|
|
52
|
+
* @property {string} [manifestFile]
|
|
53
|
+
* @property {string} [esTarget]
|
|
54
|
+
* @property {string|false} [devtool]
|
|
55
|
+
* @property {string|string[]} [transpileDependencies]
|
|
56
|
+
* @property {string|boolean} [proxy]
|
|
57
|
+
* @property {"theme"|"plugin"|string} [type]
|
|
58
|
+
* @property {URL} [configFileUrl]
|
|
59
|
+
*/
|
|
60
|
+
|
|
27
61
|
const defaultConfig = {
|
|
28
62
|
src: `./wp-content/themes/${themeName}/src`,
|
|
29
63
|
dist: `./wp-content/themes/${themeName}/dist`,
|
|
@@ -45,8 +79,10 @@ const defaultConfig = {
|
|
|
45
79
|
*
|
|
46
80
|
* Asynchronous values:
|
|
47
81
|
* -
|
|
82
|
+
*
|
|
83
|
+
* @param {{ filepath?: string, config?: BuildConfigInput } | null} [configFile]
|
|
84
|
+
* @returns {Promise<BuildConfig>}
|
|
48
85
|
*/
|
|
49
|
-
|
|
50
86
|
export async function buildConfig(configFile = { config: {} }) {
|
|
51
87
|
/**
|
|
52
88
|
* This is a temporary workaround for a problem with using `process.env.NAME` in
|
|
@@ -150,17 +186,22 @@ export async function buildConfig(configFile = { config: {} }) {
|
|
|
150
186
|
* Overlapping basenames will be joined into a single entrypoint
|
|
151
187
|
* ["./index.js", "./app.js", "./index.scss"] => { app: ["./app.js"], index: ["./index.js", "./index.scss"]}
|
|
152
188
|
*/
|
|
153
|
-
|
|
154
|
-
|
|
189
|
+
let entry = config.entry;
|
|
190
|
+
if (typeof entry === "string") {
|
|
191
|
+
entry = [entry];
|
|
155
192
|
}
|
|
156
|
-
if (Array.isArray(
|
|
157
|
-
|
|
158
|
-
obj
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
193
|
+
if (Array.isArray(entry)) {
|
|
194
|
+
entry = entry.reduce(
|
|
195
|
+
(obj, src) => {
|
|
196
|
+
obj[path.parse(src).name] = /** @type {string[]} */ ([])
|
|
197
|
+
.concat(obj[path.parse(src).name], src)
|
|
198
|
+
.filter((i) => i);
|
|
199
|
+
return obj;
|
|
200
|
+
},
|
|
201
|
+
/** @type {Record<string, string[]>} */ ({}),
|
|
202
|
+
);
|
|
163
203
|
}
|
|
204
|
+
config.entry = /** @type {Record<string, string | string[]>} */ (entry);
|
|
164
205
|
|
|
165
206
|
/**
|
|
166
207
|
* Remap proxy: true to default value
|
|
@@ -169,12 +210,13 @@ export async function buildConfig(configFile = { config: {} }) {
|
|
|
169
210
|
config.proxy = defaultConfig.proxy;
|
|
170
211
|
}
|
|
171
212
|
|
|
172
|
-
return config;
|
|
213
|
+
return /** @type {BuildConfig} */ (config);
|
|
173
214
|
}
|
|
174
215
|
|
|
175
216
|
/**
|
|
176
217
|
* Warnings are broken out below
|
|
177
218
|
*/
|
|
219
|
+
/** @param {string} src */
|
|
178
220
|
const noSrcExists = (src) => {
|
|
179
221
|
console.log(
|
|
180
222
|
"🛑 ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ideasonpurpose/build-tools-wordpress",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.5",
|
|
4
4
|
"description": "Build scripts and dependencies for IOP's WordPress development environments.",
|
|
5
5
|
"homepage": "https://github.com/ideasonpurpose/build-tools-wordpress#readme",
|
|
6
6
|
"bugs": {
|