Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { startPlaygroundWeb } from '@wp-playground/client';
import {
DEFAULT_URL_PREFIX,
DEFAULT_WORKSPACE_DIR,
DEFAULT_WP_REMOTE,
getRemoteUrl,
} from '../constants';
import { useAppDispatch, useAppSelector } from '../hooks';
import {
Expand Down Expand Up @@ -120,7 +120,7 @@ export const PlaygroundManager = () => {
try {
const clientInstance = await startPlaygroundWeb({
iframe: previewIframe,
remoteUrl: DEFAULT_WP_REMOTE,
remoteUrl: getRemoteUrl().toString(),
// blueprint: {
// preferredVersions: {
// wp: wpVersionRef.current,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export const DEFAULT_PHP_VERSION = '8.4';
export const DEFAULT_WP_VERSION = '6.8';
// @TODO: Use URL imported from vite build-time config
export const DEFAULT_WP_REMOTE = 'http://127.0.0.1:5400/remote.html';
// export const DEFAULT_WP_REMOTE = 'https://playground.wordpress.net/remote.html';
// @ts-expect-error
import { buildVersion } from 'virtual:website-config';

// @TODO: Get rid of the hardcoded initial path, always source cwd from the client.
export const DEFAULT_WORKSPACE_DIR = '/wordpress/workspace';
Expand All @@ -21,3 +18,10 @@ $html_processor = WP_HTML_Processor::create_fragment('<p><span>Hey!</span></p>')
$html_processor->next_tag();
var_dump($html_processor->get_tag());
?>`;

export function getRemoteUrl() {
const remoteUrl = new URL(window.location.origin);
remoteUrl.pathname = '/remote.html';
remoteUrl.searchParams.set('v', buildVersion);
return remoteUrl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
import type { PlaygroundClient } from '@wp-playground/client';
import { SupportedPHPVersionsList } from '@wp-playground/client';

import { DEFAULT_CODE, DEFAULT_PHP_VERSION } from './constants';
import { DEFAULT_CODE } from './constants';
import { RecommendedPHPVersion } from '@wp-playground/common';

export type BootStatus = 'idle' | 'booting' | 'ready' | 'error';

Expand All @@ -28,7 +29,7 @@ export interface PlaygroundState {
const initialState: PlaygroundState = {
code: DEFAULT_CODE,
currentPath: null,
phpVersion: DEFAULT_PHP_VERSION,
phpVersion: RecommendedPHPVersion,
wpVersion: 'latest',
phpVersions: SupportedPHPVersionsList,
wpVersions: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/wordpress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ export async function unzipWordPress(php: PHP, wpZip: File) {
'/'
);
logger.warn(
`Skipping ${wpPath} because something exists at the target path.`
`Cannot unzip WordPress files at ${target}: ${wpPath} already exists.`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically unrelated and got coupled with this PR by accident. Still, it's a useful and safe change in a logged string so I'll keep it here (shocked gasps).

);
return;
}
Expand Down