@ideasonpurpose/build-tools-wordpress 2.10.8 → 2.10.10

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ideasonpurpose/build-tools-wordpress
2
2
 
3
- #### Version 2.10.8
3
+ #### Version 2.10.10
4
4
 
5
5
  [![NPM Version](https://img.shields.io/npm/v/%40ideasonpurpose%2Fbuild-tools-wordpress?logo=npm)](https://www.npmjs.com/package/@ideasonpurpose/build-tools-wordpress)
6
6
  [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ideasonpurpose/build-tools-wordpress/npm-publish.yml?logo=github&logoColor=white)](https://github.com/ideasonpurpose/build-tools-wordpress/actions/workflows/npm-publish.yml)
@@ -8,7 +8,9 @@
8
8
 
9
9
  Build scripts and shared dependencies for WordPress development. Used in production at [Ideas On Purpose](https://www.ideasonpurpose.com).
10
10
 
11
- This package centralizes Webpack configuration, asset pipelines, and helper CLIs so host projects stay thin: a small `package.json`, a one-line `webpack.config.js`, and an optional config file.
11
+ This package centralizes Webpack configuration, asset pipelines, and helper CLIs so host projects stay fast and thin: a small `package.json`, a one-line `webpack.config.js`, and an optional config file.
12
+
13
+ Use with IOP's lightning-fast [Docker-based WordPress development image](https://github.com/ideasonpurpose/docker-wordpress-dev).
12
14
 
13
15
  ## Requirements
14
16
 
@@ -46,14 +48,16 @@ Prettier and Stylelint configs are re-exported from this package’s dependencie
46
48
 
47
49
  ## Quick start
48
50
 
49
- **1. Point Webpack at this package**
51
+ ### 1. Point Webpack at this package
50
52
 
51
53
  ```js
52
54
  // webpack.config.js
53
55
  export { webpackConfig as default } from "@ideasonpurpose/build-tools-wordpress";
54
56
  ```
55
57
 
56
- **2. Lay out sources** under the default theme paths (package `name` → theme folder):
58
+ ### 2. Source files
59
+
60
+ The project should have these files:
57
61
 
58
62
  ```text
59
63
  wp-content/themes/<package-name>/
@@ -61,18 +65,17 @@ wp-content/themes/<package-name>/
61
65
  js/main.js
62
66
  js/admin.js
63
67
  js/editor.js
64
- sass/ # or styles/
65
- dist/ # build output
68
+ styles/ # formerly 'sass'
66
69
  ```
67
70
 
68
- **3. Run**
71
+ ### 3. Run
69
72
 
70
73
  ```sh
71
- npm start # webpack-dev-server (proxies local WordPress when available)
72
- NODE_ENV=production npm run build # production build + zip (if postbuild is set)
74
+ npm run dev
75
+
73
76
  ```
74
77
 
75
- Full IOP projects also use Docker Compose tooling from this package (`tooling/docker-compose.yml`) and scripts like `bootstrap`, `db:dump`, and `project:refresh`. Those are optional if you only need the asset pipeline.
78
+ ### 4. Build
76
79
 
77
80
  ## Configuration
78
81
 
@@ -204,6 +207,21 @@ Notes:
204
207
  - Custom: remove top-level `fill="none"`
205
208
  - `removeUselessStrokeAndFill` with `removeNone: true`
206
209
 
210
+ ## WP-CLI
211
+
212
+ The WordPress base image includes [wp-cli](https://wordpress.org/cli/) and all commands can be run on the image using the `wp-cli` npm script. Commands with flags need to include a double-hyphen, but we just include them for everything. These all work as expected:
213
+
214
+ ```sh
215
+ # list users
216
+ npm run wp-cli -- wp user list
217
+
218
+ # Update to pre-release
219
+ npm run wp-cli -- wp core update --version=7.1-RC4
220
+
221
+ # Add a user for e2e testing
222
+ wp user create test test@example.com --role=administrator --user_pass=test123
223
+ ```
224
+
207
225
  ## CLI tools
208
226
 
209
227
  | Command | Purpose |
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+
4
+ import { readFile, writeFile } from "node:fs/promises";
5
+ import { dirname, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import chalk from "chalk";
8
+
9
+ const WP_VERSION_URL =
10
+ "https://raw.githubusercontent.com/ideasonpurpose/docker-wordpress-dev/refs/heads/master/wp-version.json";
11
+
12
+ const IMAGE_RE = /^([ \t]*image:[ \t]*&wp_img[ \t]+)\S+/m;
13
+
14
+ const composePath = resolve(
15
+ dirname(fileURLToPath(import.meta.url)),
16
+ "../tooling/docker-compose.yml",
17
+ );
18
+
19
+ const res = await fetch(WP_VERSION_URL);
20
+ if (!res.ok) {
21
+ console.error(chalk.red(`Failed to fetch ${WP_VERSION_URL}: ${res.status}`));
22
+ process.exit(1);
23
+ }
24
+
25
+ const { wordpress } = await res.json();
26
+ if (!wordpress) {
27
+ console.error(chalk.red("wp-version.json is missing a wordpress version"));
28
+ process.exit(1);
29
+ }
30
+
31
+ const yaml = await readFile(composePath, "utf8");
32
+ if (!IMAGE_RE.test(yaml)) {
33
+ console.error(
34
+ chalk.red("Could not find image: &wp_img in tooling/docker-compose.yml"),
35
+ );
36
+ process.exit(1);
37
+ }
38
+
39
+ const image = `ideasonpurpose/wordpress:${wordpress}`;
40
+ await writeFile(composePath, yaml.replace(IMAGE_RE, `$1${image}`));
41
+ console.log(chalk.green(`Updated WordPress image to ${image}`));
@@ -55,7 +55,7 @@
55
55
  "version": "version-everything && git add -u",
56
56
  "postversion": "npm run build",
57
57
  "webgrind": "docker compose run --rm --service-ports webgrind",
58
- "wp-cli": "docker compose exec -u wp wordpress",
58
+ "wp-cli": "docker compose exec wordpress",
59
59
  "zip": "iop-build-zip-archive"
60
60
  },
61
61
  "prettier": "@ideasonpurpose/prettier-config",
@@ -63,7 +63,7 @@
63
63
  "extends": "@ideasonpurpose/stylelint-config"
64
64
  },
65
65
  "devDependencies": {
66
- "@ideasonpurpose/build-tools-wordpress": "^2.5.1"
66
+ "@ideasonpurpose/build-tools-wordpress": "^2.10.8"
67
67
  },
68
68
  "version-everything": {
69
69
  "files": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ideasonpurpose/build-tools-wordpress",
3
- "version": "2.10.8",
3
+ "version": "2.10.10",
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": {
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "scripts": {
34
34
  "test": "vitest",
35
+ "preversion": "node ./bin/update-wp-image.js",
35
36
  "version": "version-everything && git add -u"
36
37
  },
37
38
  "prettier": "@ideasonpurpose/prettier-config",
@@ -43,43 +44,43 @@
43
44
  "@rollup/plugin-json": "^6.1.0",
44
45
  "@rollup/plugin-node-resolve": "^16.0.3",
45
46
  "@svgr/webpack": "^8.1.0",
46
- "@wordpress/dependency-extraction-webpack-plugin": "^6.51.0",
47
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.53.0",
47
48
  "ansi-html": "^0.0.9",
48
49
  "archiver": "^8.0.0",
49
- "autoprefixer": "^10.5.3",
50
+ "autoprefixer": "^10.5.4",
50
51
  "babel-loader": "^10.1.1",
51
- "caniuse-lite": "^1.0.30001805",
52
- "chalk": "^5.6.2",
52
+ "caniuse-lite": "^1.0.30001809",
53
+ "chalk": "^6.0.0",
53
54
  "chalk-cli": "^6.0.0",
54
55
  "classnames": "^2.5.1",
55
56
  "cli-truncate": "^6.1.1",
56
57
  "copy-webpack-plugin": "^14.0.0",
57
- "cosmiconfig": "^9.0.2",
58
+ "cosmiconfig": "^10.0.0",
58
59
  "css-loader": "^7.1.4",
59
- "cssnano": "^8.0.2",
60
+ "cssnano": "^8.0.6",
60
61
  "dotenv": "^17.4.2",
61
62
  "esbuild-loader": "^4.5.0",
62
- "eslint": "^10.7.0",
63
+ "eslint": "^10.8.1",
63
64
  "filesize": "^11.0.22",
64
- "fs-extra": "^11.3.6",
65
- "globby": "^16.2.1",
66
- "html-webpack-plugin": "^5.6.7",
65
+ "fs-extra": "^11.4.0",
66
+ "globby": "^16.2.3",
67
+ "html-webpack-plugin": "^5.6.8",
67
68
  "humanize-duration": "^3.34.0",
68
69
  "image-minimizer-webpack-plugin": "^5.0.0",
69
70
  "is-text-path": "^3.0.0",
70
71
  "lodash": "^4.18.1",
71
72
  "mini-css-extract-plugin": "^2.10.2",
72
- "open": "^11.0.0",
73
+ "open": "^11.0.1",
73
74
  "ora": "^9.4.1",
74
- "postcss": "^8.5.19",
75
+ "postcss": "^8.5.26",
75
76
  "postcss-loader": "^8.2.1",
76
77
  "postcss-scss": "^4.0.9",
77
- "prettier": "^3.9.5",
78
+ "prettier": "^3.9.6",
78
79
  "pretty-hrtime": "^1.0.3",
79
80
  "read-package-up": "^12.0.0",
80
81
  "replacestream": "^4.0.3",
81
82
  "rimraf": "^6.1.3",
82
- "sass-embedded": "^1.100.0",
83
+ "sass-embedded": "^1.102.0",
83
84
  "sass-loader": "^17.0.0",
84
85
  "semver": "^7.8.5",
85
86
  "sharp": "^0.35.3",
@@ -89,9 +90,9 @@
89
90
  "svgo": "^4.0.2",
90
91
  "svgo-loader": "^5.0.0",
91
92
  "version-everything": "^0.12.2",
92
- "webpack": "^5.108.4",
93
+ "webpack": "^5.109.2",
93
94
  "webpack-bundle-analyzer": "^5.3.1",
94
- "webpack-cli": "^6.0.1",
95
+ "webpack-cli": "^7.2.2",
95
96
  "webpack-dev-server": "^6.0.0",
96
97
  "webpack-manifest-plugin": "^6.0.1"
97
98
  },
@@ -99,8 +100,8 @@
99
100
  "node": ">=22.15.0"
100
101
  },
101
102
  "devDependencies": {
102
- "@vitest/coverage-v8": "^4.1.10",
103
- "vitest": "^4.1.10"
103
+ "@vitest/coverage-v8": "^4.1.11",
104
+ "vitest": "^4.1.11"
104
105
  },
105
106
  "version-everything": {
106
107
  "files": [
@@ -31,13 +31,13 @@ services:
31
31
  max-file: "3"
32
32
 
33
33
  # Ideas On Purpose's local WordPress development environment.
34
- # Update image version with `docker run ideasonpurpose/wordpress init`
34
+ # Update image version with `docker run ideasonpurpose/wordpress init`
35
35
  # Project info: https://github.com/ideasonpurpose/docker-wordpress-dev
36
36
  wordpress:
37
37
  depends_on:
38
38
  - db
39
39
  # image: &wp_img ideasonpurpose/wordpress:dev
40
- image: &wp_img ideasonpurpose/wordpress:7.0
40
+ image: &wp_img ideasonpurpose/wordpress:7.0.4
41
41
  restart: always
42
42
  volumes:
43
43
  - wp_data:/var/www/html
@@ -73,7 +73,7 @@ services:
73
73
  IOP_DEV_PLUGIN_6:
74
74
  IOP_DEV_PLUGIN_7:
75
75
  IOP_DEV_PLUGIN_8:
76
- WP_ENVIRONMENT_TYPE:
76
+ WP_ENVIRONMENT_TYPE:
77
77
 
78
78
  # Required for iptables port-mapping to work inside the Docker image
79
79
  # This is used to fix a PHP/WordPress issue where internal requests