@ideasonpurpose/build-tools-wordpress 1.1.10 → 1.1.12
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 +12 -0
- package/README.md +9 -3
- package/bin/zip.js +20 -16
- package/package.json +1 -1
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
|
+
#### v1.1.11
|
|
8
|
+
|
|
9
|
+
> 4 March 2024
|
|
10
|
+
|
|
11
|
+
- Remove version from plugin builds WIP
|
|
12
|
+
|
|
13
|
+
#### v1.1.10
|
|
14
|
+
|
|
15
|
+
> 4 March 2024
|
|
16
|
+
|
|
17
|
+
- use process.stdout references (of course)
|
|
18
|
+
|
|
7
19
|
#### v1.1.9
|
|
8
20
|
|
|
9
21
|
> 4 March 2024
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# @ideasonpurpose/build-tools-wordpress
|
|
2
2
|
|
|
3
|
-
#### Version 1.1.
|
|
3
|
+
#### Version 1.1.12
|
|
4
4
|
|
|
5
|
-

|
|
6
|
-

|
|
5
|
+
[](https://www.npmjs.com/package/@ideasonpurpose/build-tools-wordpress)
|
|
6
|
+
[](https://github.com/ideasonpurpose/build-tools-wordpress#readme)
|
|
7
7
|
|
|
8
8
|
Build scripts and dependencies for IOP's WordPress development environments.
|
|
9
9
|
|
|
@@ -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,6 @@
|
|
|
1
|
-
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readJsonSync, ensureFileSync } from "fs-extra/esm";
|
|
2
4
|
import { stat } from "node:fs/promises";
|
|
3
5
|
|
|
4
6
|
import { basename, dirname, join } from "node:path/posix";
|
|
@@ -35,31 +37,34 @@ async function getConfig() {
|
|
|
35
37
|
const config = await buildConfig(configFile);
|
|
36
38
|
|
|
37
39
|
// config.configFileUrl2 = configFile.filepath;
|
|
38
|
-
console.log({ config, configFile });
|
|
40
|
+
// console.log({ config, configFile });
|
|
39
41
|
|
|
40
42
|
return { config };
|
|
41
43
|
}
|
|
42
44
|
const { config } = await getConfig();
|
|
43
45
|
|
|
44
|
-
config.configFileUrl = new URL("package.json", config.configFileUrl);
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log({ pgk: await packageJson });
|
|
49
|
-
// console.log({ packageJson, env: process.env });
|
|
46
|
+
// config.configFileUrl = new URL("package.json", config.configFileUrl);
|
|
47
|
+
const pkgJson = readJsonSync(new URL("package.json", config.configFileUrl));
|
|
48
|
+
pkgJson.name = pkgJson.name ?? "archive";
|
|
49
|
+
pkgJson.version = pkgJson.version ?? "";
|
|
50
50
|
|
|
51
|
-
const archiveName =
|
|
51
|
+
const archiveName = pkgJson.name || "archive";
|
|
52
|
+
const archiveVersion = config.type !== "plugin" ? `-${pkgJson.version}` : "";
|
|
52
53
|
|
|
53
|
-
const versionDirName =
|
|
54
|
-
? `${archiveName}-${packageJson.version}`.replace(/[ .]/g, "_")
|
|
55
|
-
: archiveName;
|
|
54
|
+
const versionDirName = `${archiveName}${archiveVersion}`.replace(/[ .]/g, "_");
|
|
56
55
|
|
|
57
56
|
const zipFileName = `${versionDirName}.zip`;
|
|
58
57
|
const zipFile = new URL(`_builds/${zipFileName}`, config.configFileUrl);
|
|
59
|
-
// .pathname;
|
|
60
58
|
|
|
61
|
-
console.log({
|
|
62
|
-
|
|
59
|
+
console.log({
|
|
60
|
+
archiveName,
|
|
61
|
+
archiveVersion,
|
|
62
|
+
versionDirName,
|
|
63
|
+
zipFile,
|
|
64
|
+
zipFileName,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
ensureFileSync(zipFile.pathname);
|
|
63
68
|
const output = createWriteStream(zipFile);
|
|
64
69
|
|
|
65
70
|
output.on("finish", finishReporter);
|
|
@@ -181,7 +186,6 @@ function foundReporter(file) {
|
|
|
181
186
|
// process.stdout.cursorTo(0);
|
|
182
187
|
cursorTo(process.stdout, 0);
|
|
183
188
|
process.stdout.write(outString);
|
|
184
|
-
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
|
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.12",
|
|
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": {
|