Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 8 additions & 6 deletions packages/docs/site/docs/blueprints/02-using-blueprints.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ For example, to create a Playground with specific versions of WordPress and PHP
And then you would go to
`https://playground.wordpress.net/#{"preferredVersions":{"php":"8.3","wp":"6.5"}}`.

:::tip
In Javascript, you can get a compact version of any blueprint JSON with [`JSON.stringify`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) and [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
<div class="callout callout-tip">

In Javascript, you can get a compact version of any blueprint JSON with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify"><code>JSON.stringify</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse"><code>JSON.parse</code></a>
Example:

```js
Expand All @@ -49,7 +50,7 @@ const encodedBlueprint = encodeURIComponent(minifiedBlueprintJson);
const playgroundUrl = `https://playground.wordpress.net/#${encodedBlueprint}`;
```

:::
</div>

You won't have to paste links to follow along. We'll use code examples with a "Try it out" button that will automatically run the examples for you:

Expand Down Expand Up @@ -81,8 +82,9 @@ Playground also supports Base64-encoded Blueprints. Base64 is useful when a plat

To run it, go to https://playground.wordpress.net/#eyIkc2NoZW1hIjogImh0dHBzOi8vcGxheWdyb3VuZC53b3JkcHJlc3MubmV0L2JsdWVwcmludC1zY2hlbWEuanNvbiIsInByZWZlcnJlZFZlcnNpb25zIjogeyJwaHAiOiAiNy40Iiwid3AiOiAiNi41In19

:::tip
In JavaScript, You can get any blueprint JSON in [Base64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64#javascript_support) with global function `btoa()`.
<div class="callout callout-tip">

In JavaScript, You can get any blueprint JSON in <a href="https://developer.mozilla.org/en-US/docs/Glossary/Base64#javascript_support">Base64 format</a> with global function `btoa()`.

Example:

Expand All @@ -97,7 +99,7 @@ const blueprintJson = `{
const minifiedBlueprintJson = btoa(blueprintJson); // eyIkc2NoZW1hIjogImh0dHBzOi8vcGxheWdyb3VuZC53b3JkcHJlc3MubmV0L2JsdWVwcmludC1zY2hlbWEuanNvbiIsInByZWZlcnJlZFZlcnNpb25zIjogeyJwaHAiOiAiNy40Iiwid3AiOiAiNi41In19
```

:::
</div>

### Load Blueprint from a URL

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/site/docs/blueprints/04-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ description: A technical reference for "Resource References." Learn how to use e

<div class="callout callout-info">

Blueprints steps such as [`installPlugin`](/blueprints/steps#InstallPluginStep) or [`installTheme`](/blueprints/steps#InstallThemeStep) require a location of the plugin or theme to be installed.
Blueprints steps such as <a href="/blueprints/steps#InstallPluginStep"><code>installPlugin</code></a> or <a href="/blueprints/steps#InstallThemeStep"><code>installTheme</code></a> require a location of the plugin or theme to be installed.

That location can be defined as [a `URL` resource](#urlreference) of the `.zip` file containing the theme or plugin. It can also be defined as a [`wordpress.org/plugins`](#corepluginreference) or [`wordpress.org/themes`](#corethemereference) resource for those plugins/themes published in the official WordPress directories.
That location can be defined as <a href="#urlreference">a <code>URL</code> resource</a> of the `.zip` file containing the theme or plugin. It can also be defined as a <a href="#corepluginreference"><code>wordpress.org/plugins</code></a> or <a href="#corethemereference"><code>wordpress.org/themes</code></a> resource for those plugins/themes published in the official WordPress directories.

</div>

Expand Down
14 changes: 8 additions & 6 deletions packages/docs/site/docs/blueprints/05-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ Each step is an object that contains a `step` property that specifies the type o

The following step-related topics are addressed on dedicated pages included in this section:

- [Resources References](/blueprints/steps/resources) allow you use external files in Blueprints.
- [Resources References](/blueprints/steps/resources) allow you use external files in Blueprints.

- Some steps have a shorthand version. Check the [Shorthands](/blueprints/steps/shorthands) section for more information about them.
- Some steps have a shorthand version. Check the [Shorthands](/blueprints/steps/shorthands) section for more information about them.

- For each step listed below, you'll find both a "Blueprint API" and a "Function API". Refer to the [API Consistency](/blueprints/steps/api-consistency) page for further details.
- For each step listed below, you'll find both a "Blueprint API" and a "Function API". Refer to the [API Consistency](/blueprints/steps/api-consistency) page for further details.

:::tip
The [WordPress Playground Step Library](https://akirk.github.io/playground-step-library/#) tool provides a visual interface to drag or click the steps to create a blueprint for WordPress Playground. You can also [create your own steps](https://github.com/akirk/playground-step-library/#contributing)!
:::
<div class="callout callout-tip">

The <a href="https://akirk.github.io/playground-step-library/#">WordPress Playground Step Library</a> tool provides a visual interface to drag or click the steps to create a blueprint for WordPress Playground. You can also <a href="https://github.com/akirk/playground-step-library/#contributing">create your own steps</a>!

</div>

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can use Blueprints both with the web and the node.js versions of WordPress P

The team is exploring ways to transition Blueprints from a TypeScript library to a PHP library. This would allow people to run Blueprints in any WordPress environments: Playground, a hosted site, or a local setup.

The proposed [new specification](https://github.com/WordPress/blueprints-library/issues/6) is discussed on a separate [GitHub repository](https://github.com/WordPress/blueprints-library/), and you’re more than welcome to join (there or on the [#playground](https://wordpress.slack.com/archives/C04EWKGDJ0K) Slack channel) and help shape the next generation of Playground.
The proposed <a href="https://github.com/WordPress/blueprints-library/issues/6">new specification</a> is discussed on a separate <a href="https://github.com/WordPress/blueprints-library/">GitHub repository</a>, and you’re more than welcome to join (there or on the <a href="https://wordpress.slack.com/archives/C04EWKGDJ0K">#playground</a> Slack channel) and help shape the next generation of Playground.

</div>

Expand All @@ -29,6 +29,8 @@ There are two main differences between the JSON and Function APIs:
1. Blueprints handle the progress bar and error reporting for you. The function API requires you to handle these yourself.
2. The function API requires importing the API client library while Blueprints may be just pasted into the URL fragment.

:::note
Check the [Use the same structure for Blueprint JSON definitions and step handlers](https://github.com/WordPress/wordpress-playground/pull/215) issue at [wordpress-playground](https://github.com/WordPress/wordpress-playground) repo for more detailed info about this topic
:::
<div class="callout callout-info">

Check the <a href="https://github.com/WordPress/wordpress-playground/pull/215">Use the same structure for Blueprint JSON definitions and step handlers</a> issue at <a href="https://github.com/WordPress/wordpress-playground">wordpress-playground</a> repo for more detailed info about this topic

</div>
14 changes: 9 additions & 5 deletions packages/docs/site/docs/blueprints/08-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import BlueprintExample from '@site/src/components/Blueprints/BlueprintExample.m

# Blueprints Examples

:::tip
Check the [Blueprints Gallery](https://github.com/WordPress/blueprints/blob/trunk/GALLERY.md) to explore real-world code examples of using WordPress Playground to launch a WordPress site with a variety of setups.
:::
<div class="callout callout-tip">

Check the <a href="https://github.com/WordPress/blueprints/blob/trunk/GALLERY.md">Blueprints Gallery</a> to explore real-world code examples of using WordPress Playground to launch a WordPress site with a variety of setups.

</div>

Let's see some cool things you can do with Blueprints.

Expand Down Expand Up @@ -122,9 +124,11 @@ You can run WP-CLI commands on a Playground instance either from your terminal o

To use your terminal, you must first mount the `/wordpress/` directory and ensure the SQLite database integration is configured. This is because Playground's internal database doesn't persist on a mounted site, so you must explicitly install the database plugin via a Blueprint. This allows WP-CLI to recognize the WordPress installation and connect to its database.

:::note
<div class="callout callout-info">

If you run WP-CLI commands as steps within your Blueprint file, this manual setup is not needed.
:::

</div>

The following Blueprint snippet handles this setup:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,23 @@ This will ensure the SQLite plugin is installed correctly and configured within

You can use an in-browser [Blueprints editor](https://playground.wordpress.net/builder/builder.html) to build, validate, and preview your Blueprints in the browser.

:::danger Caution
<div class="callout callout-warning">

**Caution**

The editor is under development and the embedded Playground sometimes fails to load. To get around it, refresh the page. We're aware of that, and are working to improve the experience.

:::
</div>

## Check for the Filesystem and Database

Some blueprint steps (such as [`writeFile`](/blueprints/steps#WriteFileStep)) alter the internal Filesystem structure of the Playground instance and some others (such as [`runSql`](/blueprints/steps#runSql)) alter the internal WordPress database.

To check the final internal filesystem structure and database (after the blueprint steps have been applied) we can leverage some WordPress plugins that provide a SQL manager and a file explorer such as [`SQL Buddy`](https://wordpress.org/plugins/sql-buddy/) and [`WPide`](https://wordpress.org/plugins/wpide/) (you can see them in action from https://playground.wordpress.net/?plugin=sql-buddy&plugin=wpide)

:::tip
<div class="callout callout-tip">

There are a bunch of methods we can launch from the console of any WordPress Playground instance to inspect the internals of that instance. They're exposed as part of `window.playground` object (see [Developers > JavaScript API > Debugging and testing](/developers/apis/javascript-api/#debugging-and-testing)). Some examples:
There are a bunch of methods we can launch from the console of any WordPress Playground instance to inspect the internals of that instance. They're exposed as part of `window.playground` object (see <a href="/developers/apis/javascript-api/#debugging-and-testing">Developers &gt; JavaScript API &gt; Debugging and testing</a>). Some examples:

```
> await playground.isDir("/wordpress/wp-content/plugins")
Expand All @@ -75,21 +77,21 @@ true
(3) ['hello.php', 'index.php', 'WordPress-Importer-master']
```

Full list of methods we can use is available [here](/api/client/interface/PlaygroundClient)
Full list of methods we can use is available <a href="/api/client/interface/PlaygroundClient">here</a>

:::
</div>

## Check for errors in the browser console

If your Blueprint isn’t running as expected, open the browser developer tools to check for any errors.

To open the developer tools in Chrome, Firefox, Safari\*, and Edge: press `Ctrl + Shift + I` on Windows/Linux or `Cmd + Option + I` on macOS.

:::caution
<div class="callout callout-warning">

If you haven't yet, enable the Develop menu: go to **Safari > Settings... > Advanced** and check **Show features for web developers**.

:::
</div>

The developer tools window allows you to inspect network requests, view console logs, debug JavaScript, and examine the DOM and CSS styles applied to your webpage. This is crucial for diagnosing and fixing issues with Blueprints.

Expand All @@ -99,9 +101,11 @@ You can `error_log` your own error messages through [`runPHP` step](/blueprints/

![Log errors snapshot](https://raw.githubusercontent.com/WordPress/wordpress-playground/refs/heads/trunk/packages/docs/site/static/img/blueprints/log-errors.webp)

:::info
When you download your Playground instance as a `zip` through the ["Download as zip" option](/web-instance#playground-options-menu) you'll also download the `debug.log` file containing all the logs from your Playground instance.
:::
<div class="callout callout-info">

When you download your Playground instance as a `zip` through the <a href="/web-instance#playground-options-menu">"Download as zip" option</a> you'll also download the `debug.log` file containing all the logs from your Playground instance.

</div>

## Ask for help

Expand Down
32 changes: 17 additions & 15 deletions packages/docs/site/docs/blueprints/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,39 @@ import BlueprintExample from '@site/src/components/Blueprints/BlueprintExample.m

# Blueprints Docs

:::tip
Check the [Blueprints Gallery](https://github.com/WordPress/blueprints/blob/trunk/GALLERY.md) to explore real-world code examples of using WordPress Playground to launch a WordPress site with a variety of setups.
:::
<div class="callout callout-tip">

Check the <a href="https://github.com/WordPress/blueprints/blob/trunk/GALLERY.md">Blueprints Gallery</a> to explore real-world code examples of using WordPress Playground to launch a WordPress site with a variety of setups.

</div>

Hi! Welcome to WordPress Playground Blueprints documentation.

Blueprints are JSON files for setting up your very own WordPress Playground instance. This subsite (Blueprints Docs) is where you will find all the information you need to use Blueprints.

<p class="docs-hubs">The WordPress Playground documentation is distributed across four separate hubs (subsites):</p>

- [**Documentation**](/) – Introduction to WP Playground, starter guides and your entry point to WP Playground Docs.
- 👉 [**Blueprints**](/blueprints) (you're here) – Blueprints are JSON files for setting up your WordPress Playground instance. Learn about their possibilities from this Blueprints docs hub.
- [**Developers**](/developers) – WordPress Playground was created as a programmable tool. Discover all the things you can do with it from your code in the Developers docs hub.
- [**API Reference**](/api) – All the APIs exposed by WordPress Playground
- [**Documentation**](/) – Introduction to WP Playground, starter guides and your entry point to WP Playground Docs.
- 👉 [**Blueprints**](/blueprints) (you're here) – Blueprints are JSON files for setting up your WordPress Playground instance. Learn about their possibilities from this Blueprints docs hub.
- [**Developers**](/developers) – WordPress Playground was created as a programmable tool. Discover all the things you can do with it from your code in the Developers docs hub.
- [**API Reference**](/api) – All the APIs exposed by WordPress Playground

## Navigating the Blueprints documentation hub

This docs hub is focused on Blueprints info and is divided into the following major sections:

- [Getting started with Blueprints](/blueprints/getting-started): Quick Start Guide to setting up a WordPress Playground instance using Blueprint JSON files.
- [Getting started with Blueprints](/blueprints/getting-started): Quick Start Guide to setting up a WordPress Playground instance using Blueprint JSON files.

- [Tutorial - Blueprints 101](/blueprints/tutorial) - Blueprints API crash course. The tutorial will guide you through the complete process of creating a blueprint that loads a theme and plugin (among other things).
- [Tutorial - Blueprints 101](/blueprints/tutorial) - Blueprints API crash course. The tutorial will guide you through the complete process of creating a blueprint that loads a theme and plugin (among other things).

- [Blueprint data Format](/blueprints/data-format): Blueprint JSON files define your Playground instance with various properties. This section highlights the key properties you need to know.
- [Blueprint data Format](/blueprints/data-format): Blueprint JSON files define your Playground instance with various properties. This section highlights the key properties you need to know.

- [Using Blueprints](/blueprints/using-blueprints): Learn in this section different ways to use Blueprints.
- [Using Blueprints](/blueprints/using-blueprints): Learn in this section different ways to use Blueprints.

- [Steps](/blueprints/steps): API Reference of all the available steps that can be set in a blueprint to run tasks such as login, plugin/theme activation, file operations, and more.
- [Steps](/blueprints/steps): API Reference of all the available steps that can be set in a blueprint to run tasks such as login, plugin/theme activation, file operations, and more.

- [Blueprint Bundles](/blueprints/bundles): Learn how to create and use Blueprint bundles - self-contained packages that include a Blueprint and all its resources.
- [Blueprint Bundles](/blueprints/bundles): Learn how to create and use Blueprint bundles - self-contained packages that include a Blueprint and all its resources.

- [Examples](/blueprints/examples): Compilation of Blueprint examples for various WordPress Playground setups, including installing themes/plugins, running PHP code, enabling features, and loading specific WordPress versions.
- [Examples](/blueprints/examples): Compilation of Blueprint examples for various WordPress Playground setups, including installing themes/plugins, running PHP code, enabling features, and loading specific WordPress versions.

- [Troubleshoot and debug Blueprints](/blueprints/troubleshoot-and-debug): Tips and tools for troubleshooting and debugging Blueprints.
- [Troubleshoot and debug Blueprints](/blueprints/troubleshoot-and-debug): Tips and tools for troubleshooting and debugging Blueprints.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Blueprints are an invaluable tool for building WordPress sites via Playground

Visit these links to learn more about the (endless) possibilities of Blueprints:

- [Introduction to WordPress Playground](https://developer.wordpress.org/news/2024/04/05/introduction-to-playground-running-wordpress-in-the-browser/)
- Embed a pre-configured WordPress site in your website using the [WordPress Playground Block](https://wordpress.org/plugins/interactive-code-block/).
- [Blueprints examples](/blueprints/examples)
- [Demos and apps built with Blueprints](/resources#apps-built-with-wordpress-playground)
- <a href="https://developer.wordpress.org/news/2024/04/05/introduction-to-playground-running-wordpress-in-the-browser/">Introduction to WordPress Playground</a>
- Embed a pre-configured WordPress site in your website using the <a href="https://wordpress.org/plugins/interactive-code-block/">WordPress Playground Block</a>.
- <a href="/blueprints/examples">Blueprints examples</a>
- <a href="/resources#apps-built-with-wordpress-playground">Demos and apps built with Blueprints</a>

</div>
Loading
Loading