diff --git a/CHANGELOG.md b/CHANGELOG.md index adb2ff1889..f454749ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,54 +4,53 @@ All notable changes to this project are documented in this file by a CI job that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. -## [v3.0.22] (2025-11-17) +## [v3.0.22] (2025-11-17) ### Enhancements - #### Boot Flow -- [Boot] Verify permalink structure is actually set. ([#2902](https://github.com/WordPress/wordpress-playground/pull/2902)) +- [Boot] Verify permalink structure is actually set. ([#2902](https://github.com/WordPress/wordpress-playground/pull/2902)) ### Blueprints -- V1] Rewrite github.com/owner/repo/raw URLs. ([#2892](https://github.com/WordPress/wordpress-playground/pull/2892)) +- V1] Rewrite github.com/owner/repo/raw URLs. ([#2892](https://github.com/WordPress/wordpress-playground/pull/2892)) ### Documentation -- Document the new GitHub Preview button action. ([#2893](https://github.com/WordPress/wordpress-playground/pull/2893)) -- [Docs] Adding link at the documentation sidebar for PR preview link page. ([#2895](https://github.com/WordPress/wordpress-playground/pull/2895)) -- [Docs] Documentation Expansion for php-wasm/node. ([#2780](https://github.com/WordPress/wordpress-playground/pull/2780)) -- [Docs] Updating sidebar to add Xdebug pages. ([#2881](https://github.com/WordPress/wordpress-playground/pull/2881)) +- Document the new GitHub Preview button action. ([#2893](https://github.com/WordPress/wordpress-playground/pull/2893)) +- [Docs] Adding link at the documentation sidebar for PR preview link page. ([#2895](https://github.com/WordPress/wordpress-playground/pull/2895)) +- [Docs] Documentation Expansion for php-wasm/node. ([#2780](https://github.com/WordPress/wordpress-playground/pull/2780)) +- [Docs] Updating sidebar to add Xdebug pages. ([#2881](https://github.com/WordPress/wordpress-playground/pull/2881)) ### PHP WebAssembly -- Try avoiding URL.canParse for older version of Safari. ([#2887](https://github.com/WordPress/wordpress-playground/pull/2887)) +- Try avoiding URL.canParse for older version of Safari. ([#2887](https://github.com/WordPress/wordpress-playground/pull/2887)) ### Website -- Remove "preview WordPress core branch" feature. ([#2894](https://github.com/WordPress/wordpress-playground/pull/2894)) -- Support previewing WordPress and Gutenberg branches, not just PRs. ([#2868](https://github.com/WordPress/wordpress-playground/pull/2868)) +- Remove "preview WordPress core branch" feature. ([#2894](https://github.com/WordPress/wordpress-playground/pull/2894)) +- Support previewing WordPress and Gutenberg branches, not just PRs. ([#2868](https://github.com/WordPress/wordpress-playground/pull/2868)) ### Bug Fixes -- [CLI] Fix null and "latest" WP version resolution and improve unzip error message. ([#2889](https://github.com/WordPress/wordpress-playground/pull/2889)) -- [CLI] Fix run-cli leak which was revealed by repeated runCLI() calls during test. ([#2888](https://github.com/WordPress/wordpress-playground/pull/2888)) +- [CLI] Fix null and "latest" WP version resolution and improve unzip error message. ([#2889](https://github.com/WordPress/wordpress-playground/pull/2889)) +- [CLI] Fix run-cli leak which was revealed by repeated runCLI() calls during test. ([#2888](https://github.com/WordPress/wordpress-playground/pull/2888)) -### +### -- CLI] Allow API consumers to rely upon option validation and default values. ([#2883](https://github.com/WordPress/wordpress-playground/pull/2883)) +- CLI] Allow API consumers to rely upon option validation and default values. ([#2883](https://github.com/WordPress/wordpress-playground/pull/2883)) ### Various -- Minor stylistic and punctuation improvements. ([#2884](https://github.com/WordPress/wordpress-playground/pull/2884)) -- Revise error messages and coding guidelines. ([#2879](https://github.com/WordPress/wordpress-playground/pull/2879)) -- Update footer labels in localization file. ([#2878](https://github.com/WordPress/wordpress-playground/pull/2878)) -- [i18n] Add Japanese translations to Blueprints JSON and the API Client and Mount data. ([#2882](https://github.com/WordPress/wordpress-playground/pull/2882)) -- [i18n] Adding Italian translations. ([#2865](https://github.com/WordPress/wordpress-playground/pull/2865)) -- [i18n] Create contributor-day-table-lead.md for Gujarati. ([#2866](https://github.com/WordPress/wordpress-playground/pull/2866)) -- i18n: Full Translation of "Build" to Spanish. ([#2906](https://github.com/WordPress/wordpress-playground/pull/2906)) -- i18n: Minor fixes on web-instance.md Spanish translation. ([#2899](https://github.com/WordPress/wordpress-playground/pull/2899)) +- Minor stylistic and punctuation improvements. ([#2884](https://github.com/WordPress/wordpress-playground/pull/2884)) +- Revise error messages and coding guidelines. ([#2879](https://github.com/WordPress/wordpress-playground/pull/2879)) +- Update footer labels in localization file. ([#2878](https://github.com/WordPress/wordpress-playground/pull/2878)) +- [i18n] Add Japanese translations to Blueprints JSON and the API Client and Mount data. ([#2882](https://github.com/WordPress/wordpress-playground/pull/2882)) +- [i18n] Adding Italian translations. ([#2865](https://github.com/WordPress/wordpress-playground/pull/2865)) +- [i18n] Create contributor-day-table-lead.md for Gujarati. ([#2866](https://github.com/WordPress/wordpress-playground/pull/2866)) +- i18n: Full Translation of "Build" to Spanish. ([#2906](https://github.com/WordPress/wordpress-playground/pull/2906)) +- i18n: Minor fixes on web-instance.md Spanish translation. ([#2899](https://github.com/WordPress/wordpress-playground/pull/2899)) ### Contributors @@ -59,19 +58,18 @@ The following contributors merged PRs in this release: @adamziel @brandonpayton @fellyph @mehrazmorshed @praful2111 @shimotmk @SirLouen @Successfulsebunya - -## [v3.0.21] (2025-11-10) +## [v3.0.21] (2025-11-10) ### Bug Fixes -- Docs: Fix grammar, typos, and formatting issues across documentation. ([#2877](https://github.com/WordPress/wordpress-playground/pull/2877)) -- Docs: Fix typo in resources.md. ([#2876](https://github.com/WordPress/wordpress-playground/pull/2876)) -- docs: Fix MDN link for Access-Control-Allow-Origin header. ([#2875](https://github.com/WordPress/wordpress-playground/pull/2875)) +- Docs: Fix grammar, typos, and formatting issues across documentation. ([#2877](https://github.com/WordPress/wordpress-playground/pull/2877)) +- Docs: Fix typo in resources.md. ([#2876](https://github.com/WordPress/wordpress-playground/pull/2876)) +- docs: Fix MDN link for Access-Control-Allow-Origin header. ([#2875](https://github.com/WordPress/wordpress-playground/pull/2875)) ### Various -- [Docs] Adding ask AI Button. ([#2858](https://github.com/WordPress/wordpress-playground/pull/2858)) -- [i18n] Add Japanese translations to Blueprints JSON and the API Client. ([#2873](https://github.com/WordPress/wordpress-playground/pull/2873)) +- [Docs] Adding ask AI Button. ([#2858](https://github.com/WordPress/wordpress-playground/pull/2858)) +- [i18n] Add Japanese translations to Blueprints JSON and the API Client. ([#2873](https://github.com/WordPress/wordpress-playground/pull/2873)) ### Contributors @@ -79,31 +77,29 @@ The following contributors merged PRs in this release: @fellyph @hmbashar @huzaifaalmesbah @shimotmk - -## [v3.0.20] (2025-11-06) +## [v3.0.20] (2025-11-06) ### Enhancements -- [CLI] Add --wordpress-install-mode flag. ([#2803](https://github.com/WordPress/wordpress-playground/pull/2803)) +- [CLI] Add --wordpress-install-mode flag. ([#2803](https://github.com/WordPress/wordpress-playground/pull/2803)) ### Tools - #### PHP WebAssembly -- [PHP.wasm] Major overhaul of URL rewriting and setting $_SERVER variables. ([#2864](https://github.com/WordPress/wordpress-playground/pull/2864)) +- [PHP.wasm] Major overhaul of URL rewriting and setting $\_SERVER variables. ([#2864](https://github.com/WordPress/wordpress-playground/pull/2864)) ### PHP WebAssembly -- [PHP.wasm] ImageMagick extension. ([#2834](https://github.com/WordPress/wordpress-playground/pull/2834)) +- [PHP.wasm] ImageMagick extension. ([#2834](https://github.com/WordPress/wordpress-playground/pull/2834)) ### Bug Fixes -- [CLI] Make messaging clearer for errors and Xdebug IDE integration. ([#2869](https://github.com/WordPress/wordpress-playground/pull/2869)) +- [CLI] Make messaging clearer for errors and Xdebug IDE integration. ([#2869](https://github.com/WordPress/wordpress-playground/pull/2869)) ### Various -- [Docs] Add xdebug testing page. ([#2840](https://github.com/WordPress/wordpress-playground/pull/2840)) +- [Docs] Add xdebug testing page. ([#2840](https://github.com/WordPress/wordpress-playground/pull/2840)) ### Contributors @@ -111,7 +107,6 @@ The following contributors merged PRs in this release: @adamziel @brandonpayton @fellyph - ## [v3.0.19] (2025-11-04) ### Enhancements diff --git a/packages/playground/blueprints/src/lib/steps/activate-plugin.spec.ts b/packages/playground/blueprints/src/lib/steps/activate-plugin.spec.ts index c95c293c77..087892ef8d 100644 --- a/packages/playground/blueprints/src/lib/steps/activate-plugin.spec.ts +++ b/packages/playground/blueprints/src/lib/steps/activate-plugin.spec.ts @@ -23,7 +23,7 @@ describe('Blueprint step activatePlugin()', () => { sqliteIntegrationPluginZip: await getSqliteDriverModule(), }); php = await handler.getPrimaryPhp(); - }); + }, 30_000); afterEach(async () => { php.exit(); diff --git a/packages/playground/cli/README.md b/packages/playground/cli/README.md index 747faacfc8..56e5553415 100644 --- a/packages/playground/cli/README.md +++ b/packages/playground/cli/README.md @@ -4,11 +4,11 @@ # Table of contents -- [Requirements](#requirements) -- [Quickstart](#quickstart) -- [Usage](#usage) -- [Working with Blueprints](#working-with-blueprints) -- [Contributing](#contributing) +- [Requirements](#requirements) +- [Quickstart](#quickstart) +- [Usage](#usage) +- [Working with Blueprints](#working-with-blueprints) +- [Contributing](#contributing) ## Requirements @@ -64,41 +64,41 @@ npx @wp-playground/cli@latest server --mount-before-install=./my-local-site:/wor The `--auto-mount` flag is the easiest way to get started. It inspects the current directory and automatically mounts it to the correct location in the virtual WordPress site. These are the supported directory types and how they are detected: -- **Plugin Mode**: Presence of a PHP file with `Plugin Name:` in its header. -- **Theme Mode**: Presence of a style.css file with `Theme Name:` in its header. -- **wp-content Mode**: Presence of plugins and themes subdirectories. -- **WordPress Mode**: Presence of a complete WordPress installation. The directory will be mounted to the root `/wordpress` folder. +- **Plugin Mode**: Presence of a PHP file with `Plugin Name:` in its header. +- **Theme Mode**: Presence of a style.css file with `Theme Name:` in its header. +- **wp-content Mode**: Presence of plugins and themes subdirectories. +- **WordPress Mode**: Presence of a complete WordPress installation. The directory will be mounted to the root `/wordpress` folder. ## Command and Arguments Playground CLI is simple, configurable, and unopinionated. You can set it up according to your unique WordPress setup. With the Playground CLI, you can use the following top-level commands: -- **`server`**: (Default) Starts a local WordPress server. -- **`run-blueprint`**: Executes a Blueprint file without starting a web server. -- **`build-snapshot`**: Builds a ZIP snapshot of a WordPress site based on a Blueprint. +- **`server`**: (Default) Starts a local WordPress server. +- **`run-blueprint`**: Executes a Blueprint file without starting a web server. +- **`build-snapshot`**: Builds a ZIP snapshot of a WordPress site based on a Blueprint. The `server` command supports the following optional arguments: -- `--port=`: The port number for the server to listen on. Defaults to 9400. -- `--outfile`: When building, write to this output file. -- `--wp=`: The version of WordPress to use. Defaults to the latest. -- `--auto-mount`: Automatically mount the current directory (plugin, theme, wp-content, etc.). -- `--mount=`: Manually mount a directory (can be used multiple times). Format: /host/path:/vfs/path -- `--mount-before-install`: Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: `"/host/path:/vfs/path"`. -- `--mount-dir`: Mount a directory to the PHP runtime (can be used multiple times). Format: `"/host/path"` `"/vfs/path"`. -- `--mount-dir-before-install`: Mount a directory before WordPress installation (can be used multiple times). Format: `"/host/path"` `"/vfs/path"` -- `--blueprint=`: The path to a JSON Blueprint file to execute. -- `--blueprint-may-read-adjacent-files`: Consent flag: Allow "bundled" resources in a local blueprint to read files in the same directory as the blueprint file. -- `--login`: Automatically log the user in as an administrator. -- `--wordpress-install-mode `: Control how Playground prepares WordPress before booting. Defaults to `download-and-install`. Other options: `install-from-existing-files` (install using files you've mounted), `install-from-existing-files-if-needed` (same, but skip setup when an existing site is detected), and `do-not-attempt-installing` (never download or install WordPress). -- `--skip-sqlite-setup`: Do not set up the SQLite database integration. -- `--verbosity`: Output logs and progress messages (choices: "quiet", "normal", "debug"). Defaults to "normal". - -- `--debug`: Print the PHP error log if an error occurs during boot. -- `--follow-symlinks`: Allow Playground to follow symlinks by automatically mounting symlinked directories and files encountered in mounted directories. ⚠️ Warning: Following symlinks will expose files outside mounted directories to Playground and could be a security risk. -- `--experimental-multi-worker`: Enables experimental multi-worker support. It needs JSPI and a /wordpress directory on a real filesystem. You can pass a positive number to use a specific number of workers, otherwise, it defaults to the number of CPUs minus one. -- `--internal-cookie-store`: Enables Playground's internal cookie handling. When active, Playground uses an HttpCookieStore to manage and persist cookies across requests. If disabled, cookies are handled externally, like by a browser in Node.js. +- `--port=`: The port number for the server to listen on. Defaults to 9400. +- `--outfile`: When building, write to this output file. +- `--wp=`: The version of WordPress to use. Defaults to the latest. +- `--auto-mount`: Automatically mount the current directory (plugin, theme, wp-content, etc.). +- `--mount=`: Manually mount a directory (can be used multiple times). Format: /host/path:/vfs/path +- `--mount-before-install`: Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: `"/host/path:/vfs/path"`. +- `--mount-dir`: Mount a directory to the PHP runtime (can be used multiple times). Format: `"/host/path"` `"/vfs/path"`. +- `--mount-dir-before-install`: Mount a directory before WordPress installation (can be used multiple times). Format: `"/host/path"` `"/vfs/path"` +- `--blueprint=`: The path to a JSON Blueprint file to execute. +- `--blueprint-may-read-adjacent-files`: Consent flag: Allow "bundled" resources in a local blueprint to read files in the same directory as the blueprint file. +- `--login`: Automatically log the user in as an administrator. +- `--wordpress-install-mode `: Control how Playground prepares WordPress before booting. Defaults to `download-and-install`. Other options: `install-from-existing-files` (install using files you've mounted), `install-from-existing-files-if-needed` (same, but skip setup when an existing site is detected), and `do-not-attempt-installing` (never download or install WordPress). +- `--skip-sqlite-setup`: Do not set up the SQLite database integration. +- `--verbosity`: Output logs and progress messages (choices: "quiet", "normal", "debug"). Defaults to "normal". + +- `--debug`: Print the PHP error log if an error occurs during boot. +- `--follow-symlinks`: Allow Playground to follow symlinks by automatically mounting symlinked directories and files encountered in mounted directories. ⚠️ Warning: Following symlinks will expose files outside mounted directories to Playground and could be a security risk. +- `--experimental-multi-worker`: Enables experimental multi-worker support. It needs JSPI and a /wordpress directory on a real filesystem. You can pass a positive number to use a specific number of workers, otherwise, it defaults to the number of CPUs minus one. +- `--internal-cookie-store`: Enables Playground's internal cookie handling. When active, Playground uses an HttpCookieStore to manage and persist cookies across requests. If disabled, cookies are handled externally, like by a browser in Node.js. ## Need some help with the CLI? @@ -165,15 +165,15 @@ cliServer = await runCLI({ ### Things the Playground does compared to Laravel Valet -- Handles the entire WordPress installation for you. -- Works across all desktop platforms (Mac, Linux, Windows). -- Does not set up custom host domains for you. +- Handles the entire WordPress installation for you. +- Works across all desktop platforms (Mac, Linux, Windows). +- Does not set up custom host domains for you. ### Things the Playground does compared to `wp-env` -- Does not require Docker. -- Is faster to start up for quick tests and development. -- The Playground doesn't come with a MySQL Server, but you can provide your own MySQL credentials. +- Does not require Docker. +- Is faster to start up for quick tests and development. +- The Playground doesn't come with a MySQL Server, but you can provide your own MySQL credentials. ## Contributing @@ -216,10 +216,10 @@ WordPress Playground CLI is an open-source project and welcomes all contributors Here are a few quick-start guides to get you started: -- Code contributions – see the [developer section](https://wordpress.github.io/wordpress-playground/docs/contributing/code). -- Documentation – see the [documentation section](https://wordpress.github.io/wordpress-playground/docs/contributing/documentation). -- Triage – see the [triage section](https://wordpress.github.io/wordpress-playground/contributing/#triaging-issues). -- Contributions to translations – see the [translations section](https://wordpress.github.io/wordpress-playground/contributing/translations). -- Reporting bugs – open an [issue](https://github.com/WordPress/wordpress-playground/issues/new) in the repository. -- Ideas, designs, or anything else – open a [GitHub discussion](https://github.com/WordPress/wordpress-playground/discussions) and let's talk! -- Join our Slack channel [#playground](https://wordpress.slack.com/archives/C04EWKGDJ0K) at Make WordPress +- Code contributions – see the [developer section](https://wordpress.github.io/wordpress-playground/docs/contributing/code). +- Documentation – see the [documentation section](https://wordpress.github.io/wordpress-playground/docs/contributing/documentation). +- Triage – see the [triage section](https://wordpress.github.io/wordpress-playground/contributing/#triaging-issues). +- Contributions to translations – see the [translations section](https://wordpress.github.io/wordpress-playground/contributing/translations). +- Reporting bugs – open an [issue](https://github.com/WordPress/wordpress-playground/issues/new) in the repository. +- Ideas, designs, or anything else – open a [GitHub discussion](https://github.com/WordPress/wordpress-playground/discussions) and let's talk! +- Join our Slack channel [#playground](https://wordpress.slack.com/archives/C04EWKGDJ0K) at Make WordPress diff --git a/packages/playground/cli/src/is-valid-wordpress-slug.ts b/packages/playground/cli/src/is-valid-wordpress-slug.ts index 4fdd957961..808c465027 100644 --- a/packages/playground/cli/src/is-valid-wordpress-slug.ts +++ b/packages/playground/cli/src/is-valid-wordpress-slug.ts @@ -5,7 +5,7 @@ * The version string can be one of the following formats: * - "latest" * - "trunk" - * - "nightly" + * - "trunk" (legacy alias: "nightly") * - "x.y" (x and y are integers) e.g. "6.2" * - "x.y.z" (x, y and z are integers) e.g. "6.2.1" * - "x.y.z-betaN" (N is an integer) e.g. "6.2.1-beta1" diff --git a/packages/playground/remote/src/lib/playground-worker-endpoint-blueprints-v1.ts b/packages/playground/remote/src/lib/playground-worker-endpoint-blueprints-v1.ts index 365fa9d7d0..be3bd59edd 100644 --- a/packages/playground/remote/src/lib/playground-worker-endpoint-blueprints-v1.ts +++ b/packages/playground/remote/src/lib/playground-worker-endpoint-blueprints-v1.ts @@ -67,11 +67,15 @@ class PlaygroundWorkerEndpointBlueprintsV1 extends PlaygroundWorkerEndpoint { phpVersion: phpVersion!, }); - this.requestedWordPressVersion = wpVersion; - wpVersion = MinifiedWordPressVersionsList.includes(wpVersion) - ? wpVersion + this.requestedWordPressVersion = + wpVersion === 'nightly' ? 'trunk' : wpVersion; + wpVersion = MinifiedWordPressVersionsList.includes( + this.requestedWordPressVersion + ) + ? this.requestedWordPressVersion : LatestMinifiedWordPressVersion; + const wpDetails = getWordPressModuleDetails(wpVersion); let wordPressRequest: Promise | null = null; if (shouldInstallWordPress) { if (this.requestedWordPressVersion!.startsWith('http')) { @@ -105,12 +109,15 @@ class PlaygroundWorkerEndpointBlueprintsV1 extends PlaygroundWorkerEndpoint { ); }); } else { - const wpDetails = getWordPressModuleDetails(wpVersion); + const downloadUrl = maybeProxyUrl( + wpDetails.url, + corsProxyUrl as string | undefined + ); this.downloadMonitor.expectAssets({ - [wpDetails.url]: wpDetails.size, + [downloadUrl]: wpDetails.size, }); wordPressRequest = this.downloadMonitor.monitorFetch( - fetch(wpDetails.url) + fetch(downloadUrl) ); } } @@ -192,3 +199,13 @@ class PlaygroundWorkerEndpointBlueprintsV1 extends PlaygroundWorkerEndpoint { const [setApiReady, setAPIError] = exposeAPI( new PlaygroundWorkerEndpointBlueprintsV1(downloadMonitor) ); + +function maybeProxyUrl(url: string, corsProxyUrl?: string) { + if ( + !corsProxyUrl || + !url.startsWith('https://github.com/WordPress/WordPress/archive/') + ) { + return url; + } + return `${corsProxyUrl}${url}`; +} diff --git a/packages/playground/website/bin/run-ci-preview-with-cors-proxy.cjs b/packages/playground/website/bin/run-ci-preview-with-cors-proxy.cjs new file mode 100644 index 0000000000..e4733627d8 --- /dev/null +++ b/packages/playground/website/bin/run-ci-preview-with-cors-proxy.cjs @@ -0,0 +1,152 @@ +#!/usr/bin/env node + +/** + * Starts the PHP CORS proxy and the preview server for CI e2e runs. + * Ensures the proxy binds to its port before starting the preview server + * and exits immediately if either child process crashes. + */ +const { spawn } = require('child_process'); +const net = require('net'); +const path = require('path'); + +const workspaceRoot = + process.env.NX_WORKSPACE_ROOT_PATH ?? + path.resolve(__dirname, '../../../..'); +const corsProxyHost = process.env.CORS_PROXY_HOST ?? '127.0.0.1'; +const corsProxyPort = Number(process.env.CORS_PROXY_PORT ?? '5263'); +const waitTimeoutMs = Number( + process.env.CORS_PROXY_READY_TIMEOUT_MS ?? '15000' +); +const waitIntervalMs = 250; + +const nxBin = require.resolve('nx/bin/nx.js'); +const nodeBinary = process.execPath; + +/** @type {import('child_process').ChildProcess | null} */ +let proxyProcess = null; +/** @type {import('child_process').ChildProcess | null} */ +let previewProcess = null; +let shuttingDown = false; + +function spawnNxTarget(target) { + return spawn(nodeBinary, [nxBin, 'run', target], { + cwd: workspaceRoot, + stdio: 'inherit', + env: process.env, + }); +} + +function wait(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function checkPort() { + return new Promise((resolve, reject) => { + const socket = net.createConnection({ + port: corsProxyPort, + host: corsProxyHost, + }); + socket.once('connect', () => { + socket.end(); + resolve(); + }); + socket.once('error', (error) => { + socket.destroy(); + reject(error); + }); + }); +} + +async function waitForProxy() { + const start = Date.now(); + for (;;) { + try { + await checkPort(); + return; + } catch { + if (Date.now() - start > waitTimeoutMs) { + throw new Error( + `Timed out waiting for playground-php-cors-proxy to bind on ${corsProxyHost}:${corsProxyPort}` + ); + } + await wait(waitIntervalMs); + } + } +} + +function handleUnexpectedExit(name, code) { + if (shuttingDown) { + return; + } + console.error( + `${name} exited unexpectedly with code ${code ?? 'null'}. Failing CI run.` + ); + cleanupAndExit(code ?? 1); +} + +function registerProcessHooks(child, name) { + child.once('exit', (code) => handleUnexpectedExit(name, code)); + child.once('error', (error) => { + console.error(`${name} failed to start:`, error); + cleanupAndExit(1); + }); +} + +function cleanupChild(child) { + if (!child || child.killed) { + return; + } + try { + child.kill(); + } catch (error) { + console.warn( + `Failed to kill ${child.spawnargs?.join(' ') ?? 'child'}:`, + error + ); + } +} + +function cleanupAndExit(code) { + shuttingDown = true; + cleanupChild(previewProcess); + cleanupChild(proxyProcess); + process.exit(code); +} + +process.once('SIGINT', () => cleanupAndExit(130)); +process.once('SIGTERM', () => cleanupAndExit(143)); +process.once('exit', () => { + cleanupChild(previewProcess); + cleanupChild(proxyProcess); +}); + +async function main() { + proxyProcess = spawnNxTarget('playground-php-cors-proxy:start'); + registerProcessHooks(proxyProcess, 'playground-php-cors-proxy'); + + await waitForProxy().catch((error) => { + console.error(error.message); + cleanupAndExit(1); + }); + + previewProcess = spawnNxTarget('playground-website:preview:ci'); + previewProcess.once('error', (error) => { + console.error( + 'playground-website preview server failed to start:', + error + ); + cleanupAndExit(1); + }); + + const exitCode = await new Promise((resolve) => { + previewProcess.once('exit', (code) => resolve(code)); + }); + + cleanupAndExit(exitCode ?? 0); +} + +main().catch((error) => { + const message = error && error.stack ? error.stack : String(error); + console.error(message); + cleanupAndExit(1); +}); diff --git a/packages/playground/website/cypress/e2e/query-api.cy.ts b/packages/playground/website/cypress/e2e/query-api.cy.ts index ace7ef4ce7..81484e54f6 100644 --- a/packages/playground/website/cypress/e2e/query-api.cy.ts +++ b/packages/playground/website/cypress/e2e/query-api.cy.ts @@ -6,7 +6,7 @@ import * as MinifiedWordPressVersions from '../../../wordpress-builds/src/wordpr const LatestSupportedWordPressVersion = Object.keys( MinifiedWordPressVersions -).filter((x) => !['nightly', 'beta'].includes(x))[0]; +).filter((x) => !['trunk', 'beta'].includes(x))[0]; describe('Query API', () => { describe('option `php`', () => { diff --git a/packages/playground/website/playwright/e2e/blueprints.spec.ts b/packages/playground/website/playwright/e2e/blueprints.spec.ts index 57ab6c0985..3a1c6ea83b 100644 --- a/packages/playground/website/playwright/e2e/blueprints.spec.ts +++ b/packages/playground/website/playwright/e2e/blueprints.spec.ts @@ -665,7 +665,7 @@ test('should correctly redirect to a multisite wp-admin url', async ({ await expect(wordpress.locator('body')).toContainText('General Settings'); }); -['latest', 'nightly', 'beta'].forEach((wpVersion) => { +['latest', 'trunk', 'beta'].forEach((wpVersion) => { test(`should translate WP-admin to Spanish for the ${wpVersion} WordPress build`, async ({ website, wordpress, diff --git a/packages/playground/website/playwright/e2e/query-api.spec.ts b/packages/playground/website/playwright/e2e/query-api.spec.ts index 32e3e6392e..8c7e33277b 100644 --- a/packages/playground/website/playwright/e2e/query-api.spec.ts +++ b/packages/playground/website/playwright/e2e/query-api.spec.ts @@ -9,7 +9,7 @@ import * as MinifiedWordPressVersions from '../../../wordpress-builds/src/wordpr const LatestSupportedWordPressVersion = Object.keys( MinifiedWordPressVersions -).filter((x) => !['nightly', 'beta'].includes(x))[0]; +).filter((x) => !['trunk', 'beta'].includes(x))[0]; test('should load PHP 8.3 by default', async ({ website, wordpress }) => { // Navigate to the website diff --git a/packages/playground/website/playwright/playwright.ci.config.ts b/packages/playground/website/playwright/playwright.ci.config.ts index 176fcbdd37..303ab457c8 100644 --- a/packages/playground/website/playwright/playwright.ci.config.ts +++ b/packages/playground/website/playwright/playwright.ci.config.ts @@ -11,8 +11,7 @@ export default defineConfig({ baseURL: 'http://127.0.0.1/', }, webServer: { - command: - 'nx run playground-php-cors-proxy:start& npx nx run playground-website:preview:ci', + command: 'npx nx run playground-website:preview:ci-with-proxy', url: 'http://127.0.0.1/', reuseExistingServer: false, env: { diff --git a/packages/playground/website/project.json b/packages/playground/website/project.json index 4a11cb0f83..5cac96c5d0 100644 --- a/packages/playground/website/project.json +++ b/packages/playground/website/project.json @@ -89,6 +89,13 @@ } } }, + "preview:ci-with-proxy": { + "executor": "nx:run-commands", + "options": { + "command": "node packages/playground/website/bin/run-ci-preview-with-cors-proxy.cjs", + "parallel": false + } + }, "test": { "executor": "@nx/vite:test", "outputs": ["{workspaceRoot}/coverage/packages/playground/website"], diff --git a/packages/playground/website/src/components/site-manager/site-settings-form/unconnected-site-settings-form.tsx b/packages/playground/website/src/components/site-manager/site-settings-form/unconnected-site-settings-form.tsx index 20f576cc6d..5848a72e04 100644 --- a/packages/playground/website/src/components/site-manager/site-settings-form/unconnected-site-settings-form.tsx +++ b/packages/playground/website/src/components/site-manager/site-settings-form/unconnected-site-settings-form.tsx @@ -104,7 +104,7 @@ export function UnconnectedSiteSettingsForm({ options={ /* * Without an empty option, React sometimes says - * the current selected version is "nightly" when + * the current selected version is "trunk" when * `wp` is actually "6.4". */ [ diff --git a/packages/playground/wordpress-builds/build/build.js b/packages/playground/wordpress-builds/build/build.js index a5b17a28c9..7d42f38d36 100644 --- a/packages/playground/wordpress-builds/build/build.js +++ b/packages/playground/wordpress-builds/build/build.js @@ -4,13 +4,22 @@ import yargs from 'yargs'; import { promises as fs, statSync } from 'fs'; import semver from 'semver'; +const remoteWordPressModules = { + trunk: { + url: + process.env.PLAYGROUND_TRUNK_ZIP_URL ?? + 'https://github.com/WordPress/WordPress/archive/refs/heads/master.zip', + size: 0, + }, +}; + const parser = yargs(process.argv.slice(2)) .usage('Usage: $0 [options]') .options({ wpVersion: { type: 'string', description: - 'The WordPress version to download. Can be a major version like 6.4 or "beta" or "nightly".', + 'The WordPress version to download. Can be a major version like 6.4 or "beta" or "trunk" (alias "nightly").', required: true, }, ['output-js']: { @@ -32,6 +41,8 @@ const parser = yargs(process.argv.slice(2)) }); const args = parser.argv; +const requestedWpVersion = + args.wpVersion === 'nightly' ? 'trunk' : args.wpVersion; let wpVersions = await fetch( 'https://api.wordpress.org/core/version-check/1.7/?channel=beta' @@ -87,36 +98,37 @@ function toVersionInfo(apiVersion, slug = null) { } let versionInfo = {}; -if (args.wpVersion === 'nightly') { - versionInfo.url = - 'https://wordpress.org/nightly-builds/wordpress-latest.zip'; - versionInfo.version = 'nightly'; - versionInfo.majorVersion = 'nightly'; - versionInfo.slug = 'nightly'; -} else if (args.wpVersion === 'beta') { + +if (requestedWpVersion === 'trunk') { + versionInfo.url = remoteWordPressModules.trunk.url; + versionInfo.version = 'trunk'; + versionInfo.majorVersion = 'trunk'; + versionInfo.slug = 'trunk'; + versionInfo.isRemote = true; +} else if (requestedWpVersion === 'beta') { versionInfo = toVersionInfo(beta, 'beta'); -} else if (args.wpVersion.startsWith('latest')) { +} else if (requestedWpVersion.startsWith('latest')) { const relevantApiVersion = { latest: latestVersions[0], 'latest-minus-1': latestVersions[1], 'latest-minus-2': latestVersions[2], 'latest-minus-3': latestVersions[3], - }[args.wpVersion]; + }[requestedWpVersion]; versionInfo = toVersionInfo(relevantApiVersion); -} else if (args.wpVersion.match(/\d\.\d/)) { +} else if (requestedWpVersion.match(/\d\.\d/)) { const relevantApiVersion = latestVersions.find((v) => - v.version.startsWith(args.wpVersion) + v.version.startsWith(requestedWpVersion) ); versionInfo = toVersionInfo(relevantApiVersion); } if (!versionInfo.url) { - if (args.wpVersion === 'beta') { + if (requestedWpVersion === 'beta') { process.stdout.write('Skipping. We did not find a WP beta version.\n'); process.exit(0); } - process.stdout.write(`WP version ${args.wpVersion} is not supported\n`); + process.stdout.write(`WP version ${requestedWpVersion} is not supported\n`); process.stdout.write(await parser.getHelp()); process.exit(1); } @@ -124,6 +136,8 @@ if (!versionInfo.url) { const sourceDir = path.dirname(new URL(import.meta.url).pathname); const outputAssetsDir = path.resolve(process.cwd(), args.outputAssets); const outputJsDir = path.resolve(process.cwd(), args.outputJs); +const isRemoteModule = + versionInfo.slug && versionInfo.slug in remoteWordPressModules; // Short-circuit if the version is already downloaded and not forced const versionsPath = `${outputJsDir}/wp-versions.json`; @@ -139,92 +153,98 @@ try { if ( !args.force && - versionInfo.slug !== 'nightly' && + versionInfo.slug !== 'trunk' && versions[versionInfo.slug] === versionInfo.version ) { process.stdout.write( - `The requested version was ${args.wpVersion}, but its latest release (${versionInfo.version}) is already downloaded\n` + `The requested version was ${requestedWpVersion}, but its latest release (${versionInfo.version}) is already downloaded\n` ); process.exit(0); } // Build WordPress -const wordpressDir = join(sourceDir, 'wordpress'); -try { +if (!isRemoteModule) { + const wordpressDir = join(sourceDir, 'wordpress'); try { + try { + await fs.rm(wordpressDir, { recursive: true }); + } catch (e) { + // Ignore + } + await fs.mkdir(wordpressDir); + // Install WordPress in a local directory + await asyncSpawn( + 'npx', + [ + 'nx', + 'unbuilt-jspi', + 'playground-cli', + '--', + 'run-blueprint', + `--wp=${versionInfo.url}`, + `--mount-before-install=${wordpressDir}:/wordpress`, + ], + { cwd: sourceDir, stdio: 'inherit' } + ); + + // Minify that WordPress + await asyncSpawn( + 'docker', + [ + 'build', + '.', + '--progress=plain', + '--tag=wordpress-playground', + '--build-arg', + `OUT_FILENAME=wp-${versionInfo.slug}`, + ], + { cwd: sourceDir, stdio: 'inherit' } + ); + } finally { await fs.rm(wordpressDir, { recursive: true }); - } catch (e) { - // Ignore } - await fs.mkdir(wordpressDir); - // Install WordPress in a local directory + + // Extract the WordPress static root with wp-includes/ etc await asyncSpawn( - 'npx', + 'docker', [ - 'nx', - 'unbuilt-jspi', - 'playground-cli', - '--', - 'run-blueprint', - `--wp=${versionInfo.url}`, - `--mount-before-install=${wordpressDir}:/wordpress`, + 'run', + '--name', + 'wordpress-playground-tmp', + '--rm', + '-v', + `${outputAssetsDir}:/output`, + 'wordpress-playground', + 'sh', + '-c', + `cp -r /root/output/wp-${versionInfo.slug} /output/`, ], { cwd: sourceDir, stdio: 'inherit' } ); - // Minify that WordPress + // Extract wp.zip from the docker image await asyncSpawn( 'docker', [ - 'build', - '.', - '--progress=plain', - '--tag=wordpress-playground', - '--build-arg', - `OUT_FILENAME=wp-${versionInfo.slug}`, + 'run', + '--name', + 'wordpress-playground-tmp', + '--rm', + '-v', + `${outputJsDir}:/output`, + 'wordpress-playground', + 'sh', + '-c', + `cp /root/output/*.zip /output/`, ], { cwd: sourceDir, stdio: 'inherit' } ); -} finally { - await fs.rm(wordpressDir, { recursive: true }); +} else { + process.stdout.write( + `Skipping build for remote WordPress version "${versionInfo.slug}".\n` + ); } -// Extract the WordPress static root with wp-includes/ etc -await asyncSpawn( - 'docker', - [ - 'run', - '--name', - 'wordpress-playground-tmp', - '--rm', - '-v', - `${outputAssetsDir}:/output`, - 'wordpress-playground', - 'sh', - '-c', - `cp -r /root/output/wp-${versionInfo.slug} /output/`, - ], - { cwd: sourceDir, stdio: 'inherit' } -); - -// Extract wp.zip from the docker image -await asyncSpawn( - 'docker', - [ - 'run', - '--name', - 'wordpress-playground-tmp', - '--rm', - '-v', - `${outputJsDir}:/output`, - 'wordpress-playground', - 'sh', - '-c', - `cp /root/output/*.zip /output/`, - ], - { cwd: sourceDir, stdio: 'inherit' } -); - // Update the WordPress versions JSON // Set WordPress version versions[versionInfo.slug] = versionInfo.version; @@ -239,6 +259,10 @@ versions = Object.keys(versions) }, {}); const slugify = (v) => v.replace(/[^a-zA-Z0-9_]/g, '_'); +const remoteModuleSlugs = Object.keys(remoteWordPressModules); +const localVersionSlugs = Object.keys(versions).filter( + (version) => !remoteModuleSlugs.includes(version) +); // Write the updated JSON back to the file await fs.writeFile(versionsPath, JSON.stringify(versions, null, 2)); @@ -260,7 +284,7 @@ for (const version of Object.keys(versions)) { // Refresh get-wordpress-module.ts const getWordPressModulePath = `${outputJsDir}/get-wordpress-module-details.ts`; const getWordPressModuleContent = ` -${Object.keys(versions) +${localVersionSlugs .map( (version) => `// @ts-ignore @@ -280,7 +304,18 @@ export function getWordPressModuleDetails(wpVersion: string = ${JSON.stringify( switch (wpVersion) { ${Object.keys(versions) .map( - (version) => ` + (version) => + remoteModuleSlugs.includes(version) + ? ` + case '${version}': + return { + size: ${JSON.stringify( + remoteWordPressModules[version].size ?? 0 + )}, + url: ${JSON.stringify(remoteWordPressModules[version].url)}, + }; + ` + : ` case '${version}': /** @ts-ignore */ return { @@ -290,6 +325,17 @@ export function getWordPressModuleDetails(wpVersion: string = ${JSON.stringify( ` ) .join('')} + ${ + remoteWordPressModules.trunk + ? ` + case 'nightly': + return { + size: ${JSON.stringify(remoteWordPressModules.trunk.size ?? 0)}, + url: ${JSON.stringify(remoteWordPressModules.trunk.url)}, + }; + ` + : '' + } } throw new Error('Unsupported WordPress module: ' + wpVersion); diff --git a/packages/playground/wordpress-builds/src/get-wordpress-module-details.spec.ts b/packages/playground/wordpress-builds/src/get-wordpress-module-details.spec.ts index 7e79f1bd4d..1bc4c2979b 100644 --- a/packages/playground/wordpress-builds/src/get-wordpress-module-details.spec.ts +++ b/packages/playground/wordpress-builds/src/get-wordpress-module-details.spec.ts @@ -12,6 +12,6 @@ import { getWordPressModuleDetails } from './wordpress/get-wordpress-module-deta describe('getWordPressModuleDetails()', () => { it('should return a data loader module', async () => { const module = getWordPressModuleDetails(); - expect(module.url).toMatch(/\/wp-\d.\d.zip$/); + expect(module.url).toMatch(/\/wp-\d\.\d\.zip$/); }); }); diff --git a/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module-details.ts b/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module-details.ts index 0c2977d993..074030a954 100644 --- a/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module-details.ts +++ b/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module-details.ts @@ -1,6 +1,3 @@ - -// @ts-ignore -import url_nightly from './wp-nightly.zip?url'; // @ts-ignore import url_beta from './wp-beta.zip?url'; // @ts-ignore @@ -22,66 +19,66 @@ import url_6_3 from './wp-6.3.zip?url'; * This file must statically exists in the project because of the way * vite resolves imports. */ -export function getWordPressModuleDetails(wpVersion: string = "6.8"): { size: number, url: string } { +export function getWordPressModuleDetails(wpVersion = '6.8'): { + size: number; + url: string; +} { switch (wpVersion) { - + case 'trunk': case 'nightly': - /** @ts-ignore */ return { - size: 24949500, - url: url_nightly, + size: 0, + url: 'https://github.com/WordPress/WordPress/archive/refs/heads/master.zip', }; - + case 'beta': /** @ts-ignore */ return { size: 24776337, url: url_beta, }; - + case '6.8': /** @ts-ignore */ return { size: 24743772, url: url_6_8, }; - + case '6.7': /** @ts-ignore */ return { size: 24594721, url: url_6_7, }; - + case '6.6': /** @ts-ignore */ return { size: 18386194, url: url_6_6, }; - + case '6.5': /** @ts-ignore */ return { size: 18457511, url: url_6_5, }; - + case '6.4': /** @ts-ignore */ return { size: 18265208, url: url_6_4, }; - + case '6.3': /** @ts-ignore */ return { size: 3595053, url: url_6_3, }; - - } throw new Error('Unsupported WordPress module: ' + wpVersion); } diff --git a/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module.ts b/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module.ts index dd99b60f93..ab7aa903a1 100644 --- a/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module.ts +++ b/packages/playground/wordpress-builds/src/wordpress/get-wordpress-module.ts @@ -1,6 +1,6 @@ import { getWordPressModuleDetails } from './get-wordpress-module-details'; -export async function getWordPressModule(wpVersion?: string): Promise { +export async function getWordPressModule(wpVersion = '6.8'): Promise { const url = getWordPressModuleDetails(wpVersion).url; let data = null; if (url.startsWith('/')) { @@ -15,7 +15,7 @@ export async function getWordPressModule(wpVersion?: string): Promise { const response = await fetch(url); data = await response.blob(); } - return new File([data], `${wpVersion || 'wp'}.zip`, { + return new File([data as any], `${wpVersion || 'wp'}.zip`, { type: 'application/zip', }); } diff --git a/packages/playground/wordpress-builds/src/wordpress/wp-nightly.zip b/packages/playground/wordpress-builds/src/wordpress/wp-nightly.zip deleted file mode 100644 index 24bf72fe90..0000000000 Binary files a/packages/playground/wordpress-builds/src/wordpress/wp-nightly.zip and /dev/null differ diff --git a/packages/playground/wordpress-builds/src/wordpress/wp-versions.json b/packages/playground/wordpress-builds/src/wordpress/wp-versions.json index 94f422cb91..ccbeb4b2c5 100644 --- a/packages/playground/wordpress-builds/src/wordpress/wp-versions.json +++ b/packages/playground/wordpress-builds/src/wordpress/wp-versions.json @@ -1,5 +1,5 @@ { - "nightly": "nightly", + "trunk": "trunk", "beta": "6.9-RC2", "6.8": "6.8.3", "6.7": "6.7.4", @@ -7,4 +7,4 @@ "6.5": "6.5.7", "6.4": "6.4.5", "6.3": "6.3.5" -} \ No newline at end of file +} diff --git a/packages/playground/wordpress/src/index.ts b/packages/playground/wordpress/src/index.ts index caf119ba05..8b68c01a56 100644 --- a/packages/playground/wordpress/src/index.ts +++ b/packages/playground/wordpress/src/index.ts @@ -648,6 +648,9 @@ const memoizedFetch = createMemoizedFetch(fetch); * @param versionQuery - The WordPress version query string to resolve. * @returns The resolved WordPress release URL and version string. */ +const WORDPRESS_TRUNK_ZIP_URL = + 'https://github.com/WordPress/WordPress/archive/refs/heads/master.zip'; + export async function resolveWordPressRelease(versionQuery = 'latest') { if (versionQuery === null) { versionQuery = 'latest'; @@ -668,10 +671,10 @@ export async function resolveWordPressRelease(versionQuery = 'latest') { source: 'inferred', }; } else if (versionQuery === 'trunk' || versionQuery === 'nightly') { + const cacheBust = new Date().toISOString().split('T')[0]; return { - releaseUrl: - 'https://wordpress.org/nightly-builds/wordpress-latest.zip', - version: 'nightly-' + new Date().toISOString().split('T')[0], + releaseUrl: `${WORDPRESS_TRUNK_ZIP_URL}?ts=${cacheBust}`, + version: 'trunk', source: 'inferred', }; } diff --git a/packages/playground/wordpress/src/test/database.spec.ts b/packages/playground/wordpress/src/test/database.spec.ts index b5b647c39d..9d26bab8df 100644 --- a/packages/playground/wordpress/src/test/database.spec.ts +++ b/packages/playground/wordpress/src/test/database.spec.ts @@ -61,9 +61,8 @@ describe('Test database', () => { dataSqlPath: '/wordpress/wp-content/database/.ht.sqlite', }); - const loadedWordPressVersion = await getLoadedWordPressVersion( - handler - ); + const loadedWordPressVersion = + await getLoadedWordPressVersion(handler); expect(loadedWordPressVersion).toBeTruthy(); expect(Object.keys(MinifiedWordPressVersions)).toContain( loadedWordPressVersion diff --git a/packages/playground/wordpress/src/test/resolve-wordpress-release.spec.ts b/packages/playground/wordpress/src/test/resolve-wordpress-release.spec.ts index 5a8c1f89c4..1941b81419 100644 --- a/packages/playground/wordpress/src/test/resolve-wordpress-release.spec.ts +++ b/packages/playground/wordpress/src/test/resolve-wordpress-release.spec.ts @@ -160,20 +160,20 @@ describe('resolveWordPressRelease', () => { expect(result.source).toBe('inferred'); }); - it('resolves trunk to nightly build', async () => { + it('resolves trunk to trunk build', async () => { const result = await resolveWordPressRelease('trunk'); - expect(result.version).toContain('nightly-'); - expect(result.releaseUrl).toBe( - 'https://wordpress.org/nightly-builds/wordpress-latest.zip' + expect(result.version).toBe('trunk'); + expect(result.releaseUrl).toMatch( + /^https:\/\/github.com\/WordPress\/WordPress\/archive\/refs\/heads\/master\.zip\?ts=\d{4}-\d{2}-\d{2}$/ ); expect(result.source).toBe('inferred'); }); - it('resolves nightly to nightly build', async () => { + it('resolves nightly to trunk build', async () => { const result = await resolveWordPressRelease('nightly'); - expect(result.version).toContain('nightly-'); - expect(result.releaseUrl).toBe( - 'https://wordpress.org/nightly-builds/wordpress-latest.zip' + expect(result.version).toBe('trunk'); + expect(result.releaseUrl).toMatch( + /^https:\/\/github.com\/WordPress\/WordPress\/archive\/refs\/heads\/master\.zip\?ts=\d{4}-\d{2}-\d{2}$/ ); expect(result.source).toBe('inferred'); }); diff --git a/packages/playground/wordpress/src/test/version-detect.spec.ts b/packages/playground/wordpress/src/test/version-detect.spec.ts index 68bf8341fe..293d0f6fd8 100644 --- a/packages/playground/wordpress/src/test/version-detect.spec.ts +++ b/packages/playground/wordpress/src/test/version-detect.spec.ts @@ -84,10 +84,10 @@ describe('Test WP version detection', async () => { '6.4.2': '6.4', '6.5': '6.5', '6.5.4': '6.5', - '6.6-alpha-57783': 'nightly', - '6.6-beta-57783': 'nightly', - '6.6-RC-54321': 'nightly', - '6.6-RC2-12345': 'nightly', + '6.6-alpha-57783': 'trunk', + '6.6-beta-57783': 'trunk', + '6.6-RC-54321': 'trunk', + '6.6-RC2-12345': 'trunk', '6.6-beta': 'beta', '6.6-beta2': 'beta', '6.6-RC': 'beta', diff --git a/packages/playground/wordpress/src/version-detect.ts b/packages/playground/wordpress/src/version-detect.ts index e66c1913a4..03752bc035 100644 --- a/packages/playground/wordpress/src/version-detect.ts +++ b/packages/playground/wordpress/src/version-detect.ts @@ -46,7 +46,7 @@ export function versionStringToLoadedWordPressVersion( ): string { const nightlyPattern = /-(alpha|beta|RC)\d*-\d+$/; if (nightlyPattern.test(wpVersionString)) { - return 'nightly'; + return 'trunk'; } // TODO: Tighten this to detect specific old beta version, like 6.2-beta.