@ideasonpurpose/build-tools-wordpress 1.1.9 → 1.1.11
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/CHANGELOG.md +13 -0
- package/README.md +7 -1
- package/bin/zip.js +22 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ 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
|
+
#### v1.1.10
|
|
8
|
+
|
|
9
|
+
> 4 March 2024
|
|
10
|
+
|
|
11
|
+
- use process.stdout references (of course)
|
|
12
|
+
|
|
13
|
+
#### v1.1.9
|
|
14
|
+
|
|
15
|
+
> 4 March 2024
|
|
16
|
+
|
|
17
|
+
- update actions
|
|
18
|
+
- missed a couple readline calls
|
|
19
|
+
|
|
7
20
|
#### v1.1.8
|
|
8
21
|
|
|
9
22
|
> 4 March 2024
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ideasonpurpose/build-tools-wordpress
|
|
2
2
|
|
|
3
|
-
#### Version 1.1.
|
|
3
|
+
#### Version 1.1.11
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|

|
|
@@ -15,6 +15,12 @@ Each project should have an **ideasonpurpose.config.js** file in the same direct
|
|
|
15
15
|
- **`dist`** - The **distribution** directory where processed, production-ready files will be output to. All contents of this directory will be included in builds.
|
|
16
16
|
- **`src`** - An array of file entry points relative to the `src` directory. Each entry point will generate a like-named output file. All files and assets imported by a given entry point will be accessible from that entry's corresponding output file.
|
|
17
17
|
|
|
18
|
+
### Versioned Releases
|
|
19
|
+
|
|
20
|
+
IOP versions our theme releases so every release creates a clear rollback snapshot. To accomplish this, each theme release is generated into a versioned directory. This works well for themes, where only one can be active, but fails for plugins where multiple versions can be simultaneously activated if their directory names are different.
|
|
21
|
+
|
|
22
|
+
To work around this, a `type` property can be added to the config file. When `type` is `plugin`, builds will not add the version to directory names.
|
|
23
|
+
|
|
18
24
|
## About This Project
|
|
19
25
|
|
|
20
26
|
These tools were migrated from our [Docker-based WordPress build tools](https://github.com/ideasonpurpose/docker-build) to speed up development and began the process of moving our build tools away from webpack. Gathering dependencies also simplifies the package.json files in host projects, making those slightly more manageable.
|
package/bin/zip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readJsonSync, ensureFileSync } from "fs-extra/esm";
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
3
|
|
|
4
4
|
import { basename, dirname, join } from "node:path/posix";
|
|
@@ -35,31 +35,34 @@ async function getConfig() {
|
|
|
35
35
|
const config = await buildConfig(configFile);
|
|
36
36
|
|
|
37
37
|
// config.configFileUrl2 = configFile.filepath;
|
|
38
|
-
console.log({ config, configFile });
|
|
38
|
+
// console.log({ config, configFile });
|
|
39
39
|
|
|
40
40
|
return { config };
|
|
41
41
|
}
|
|
42
42
|
const { config } = await getConfig();
|
|
43
43
|
|
|
44
|
-
config.configFileUrl = new URL("package.json", config.configFileUrl);
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
// config.configFileUrl = new URL("package.json", config.configFileUrl);
|
|
45
|
+
const pkgJson = readJsonSync(new URL("package.json", config.configFileUrl));
|
|
46
|
+
pkgJson.name = pkgJson.name ?? "archive";
|
|
47
|
+
pkgJson.version = pkgJson.version ?? "";
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const archiveName = pkgJson.name || "archive";
|
|
50
|
+
const archiveVersion = config.type !== "plugin" ? `-${pkgJson.version}` : "";
|
|
50
51
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const versionDirName = packageJson.version
|
|
54
|
-
? `${archiveName}-${packageJson.version}`.replace(/[ .]/g, "_")
|
|
55
|
-
: archiveName;
|
|
52
|
+
const versionDirName = `${archiveName}${archiveVersion}`.replace(/[ .]/g, "_");
|
|
56
53
|
|
|
57
54
|
const zipFileName = `${versionDirName}.zip`;
|
|
58
55
|
const zipFile = new URL(`_builds/${zipFileName}`, config.configFileUrl);
|
|
59
|
-
// .pathname;
|
|
60
56
|
|
|
61
|
-
console.log({
|
|
62
|
-
|
|
57
|
+
console.log({
|
|
58
|
+
archiveName,
|
|
59
|
+
archiveVersion,
|
|
60
|
+
versionDirName,
|
|
61
|
+
zipFile,
|
|
62
|
+
zipFileName,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
ensureFileSync(zipFile.pathname);
|
|
63
66
|
const output = createWriteStream(zipFile);
|
|
64
67
|
|
|
65
68
|
output.on("finish", finishReporter);
|
|
@@ -177,11 +180,10 @@ function foundReporter(file) {
|
|
|
177
180
|
|
|
178
181
|
if (fileCount % 25 == 0) {
|
|
179
182
|
// process.stdout.clearLine();
|
|
180
|
-
clearLine(stdout);
|
|
183
|
+
clearLine(process.stdout);
|
|
181
184
|
// process.stdout.cursorTo(0);
|
|
182
|
-
cursorTo(stdout, 0);
|
|
185
|
+
cursorTo(process.stdout, 0);
|
|
183
186
|
process.stdout.write(outString);
|
|
184
|
-
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
|
|
@@ -193,10 +195,10 @@ function finishReporter() {
|
|
|
193
195
|
const savedPercent = ((1 - outBytes / inBytes) * 100).toFixed(2);
|
|
194
196
|
|
|
195
197
|
// process.stdout.clearLine();
|
|
196
|
-
clearLine(stdout);
|
|
198
|
+
clearLine(process.stdout);
|
|
197
199
|
|
|
198
200
|
// process.stdout.cursorTo(0);
|
|
199
|
-
cursorTo(stdout, 0);
|
|
201
|
+
cursorTo(process.stdout, 0);
|
|
200
202
|
|
|
201
203
|
console.log(
|
|
202
204
|
"🔍 ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ideasonpurpose/build-tools-wordpress",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
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": {
|