@42wp/dev-env 1.0.4 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@42wp/dev-env",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "42WP — a CLI to spin up disposable WordPress dev environments with Docker (Traefik + MySQL + per-project containers).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -217,12 +217,24 @@ export async function start(rawName, opts = {}) {
217
217
  step(t('start.upping'));
218
218
  await compose(['up', '-d', '--build'], { cwd: envDir });
219
219
 
220
- // 6. Wait for WP-CLI to answer inside the container (replaces `sleep 5`).
220
+ // 6. Wait for the WordPress core to be fully copied into the container before
221
+ // installing. The wordpress image's entrypoint extracts core alphabetically,
222
+ // so wp-includes/version.php lands BEFORE wp-settings.php — polling `wp core
223
+ // version` alone can proceed mid-copy on slow disks (e.g. a VM), and then
224
+ // `wp core install` fatals on a missing wp-settings.php. Waiting for
225
+ // wp-settings.php (which `install` requires, and which comes after all of
226
+ // wp-includes/) closes that window.
221
227
  step(t('start.waitingWp'));
222
228
  await pollUntil(
223
229
  async () => {
224
- const { code } = await dockerExecCapture(container, ['wp', 'core', 'version', '--allow-root']);
225
- return code === 0;
230
+ const settings = await dockerExecCapture(container, [
231
+ 'test',
232
+ '-f',
233
+ '/var/www/html/wp-settings.php',
234
+ ]);
235
+ if (settings.code !== 0) return false;
236
+ const version = await dockerExecCapture(container, ['wp', 'core', 'version', '--allow-root']);
237
+ return version.code === 0;
226
238
  },
227
239
  { label: 'WordPress', timeout: 90000 },
228
240
  );