Skip to content
Draft
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
29 changes: 12 additions & 17 deletions packages/docs/site/docs/main/guides/for-plugin-developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,15 @@ Blueprints can be passed to a Playground instance [in several ways](/blueprints/

### Plugin in a GitHub repository

A plugin stored in a GitHub repository can also be loaded in a Playground instance via Blueprints.
A plugin stored in a GitHub repository can be loaded in a Playground instance via Blueprints using the [`git:directory` resource](/blueprints/steps/resources#gitdirectoryreference).

With the `pluginData` property of the [`installPlugin` blueprint step](/blueprints/steps#installPlugin), you can define a [`url` resource](/blueprints/steps/resources#urlreference) that points to the location of the `.zip` file containing the plugin you want to load in the Playground instance.

To avoid CORS issues, the Playground project provides a [GitHub proxy](https://playground.wordpress.net/proxy) that allows you to generate a `.zip` from a repository (or even a folder inside a repo) containing your plugin.

:::info
[GitHub proxy](https://playground.wordpress.net/proxy) is an incredibly useful tool to load plugins from GitHub repositories as it allows you to load a plugin from a specific branch, a specific directory, a specific commit or a specific PR.
:::
With the `pluginData` property of the [`installPlugin` blueprint step](/blueprints/steps#installPlugin), you can define a `git:directory` resource that points to your GitHub repository. This allows you to load a plugin from a specific branch, directory, commit, tag, or even a PR.

:::tip
If your plugin is hosted on GitHub, you can automatically add preview buttons to your pull requests using the Playground PR Preview GitHub Action. This lets reviewers test your changes instantly without any setup. See [Adding PR Preview Buttons with GitHub Actions](/guides/github-action-pr-preview) for details.
:::

For example, the following `blueprint.json` installs a plugin from a GitHub repository leveraging the https://github-proxy.com tool:
For example, the following `blueprint.json` installs a plugin from a GitHub repository:

```json
{
Expand All @@ -72,15 +66,16 @@ For example, the following `blueprint.json` installs a plugin from a GitHub repo
{
"step": "installPlugin",
"pluginData": {
"resource": "url",
"url": "https://github-proxy.com/proxy/?repo=wptrainingteam/devblog-dataviews-plugin"
"resource": "git:directory",
"url": "https://github.com/wptrainingteam/devblog-dataviews-plugin",
"ref": "trunk"
}
}
]
}
```

[<kbd> &nbsp; Run Blueprint &nbsp; </kbd>](https://playground.wordpress.net/builder/builder.html#{%22landingPage%22:%22/wp-admin/admin.php?page=add-media-from-third-party-service%22,%22login%22:true,%22steps%22:[{%22step%22:%22installPlugin%22,%22pluginData%22:{%22resource%22:%22url%22,%22url%22:%22https://github-proxy.com/proxy/?repo=wptrainingteam/devblog-dataviews-plugin%22}}]})
[<kbd> &nbsp; Run Blueprint &nbsp; </kbd>](https://playground.wordpress.net/builder/builder.html#{%22landingPage%22:%22/wp-admin/admin.php?page=add-media-from-third-party-service%22,%22login%22:true,%22steps%22:[{%22step%22:%22installPlugin%22,%22pluginData%22:{%22resource%22:%22git:directory%22,%22url%22:%22https://github.com/wptrainingteam/devblog-dataviews-plugin%22,%22ref%22:%22trunk%22}}]})

### Plugin from code in a file or gist in GitHub

Expand Down Expand Up @@ -126,9 +121,9 @@ When providing a link to a WordPress Playground instance with some plugins activ

Some useful tools and resources provided by the Playground project to work with blueprints are:

- 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.
- 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!
- The [Blueprints builder](https://playground.wordpress.net/builder/builder.html) tool allows you edit your blueprint online and run it directly in a Playground instance.
- 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.
- 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!
- The [Blueprints builder](https://playground.wordpress.net/builder/builder.html) tool allows you edit your blueprint online and run it directly in a Playground instance.

:::

Expand Down Expand Up @@ -213,8 +208,8 @@ npx @wp-playground/cli server --auto-mount

With Google Chrome you can synchronize a Playground instance with your local plugin's code and your plugin's GitHub repo. With this connection you can:

- See live (in the Playground instance) your local changes
- Create PRs in the GitHub repo with your changes
- See live (in the Playground instance) your local changes
- Create PRs in the GitHub repo with your changes

Here's a little demo of this workflow in action:

Expand Down
22 changes: 10 additions & 12 deletions packages/docs/site/docs/main/guides/for-theme-developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,24 @@ You can also load any theme from the WordPress themes directory by setting the [

A theme stored in a GitHub repository can also be loaded in a Playground instance with Blueprints.

In the `themeData` property of the [`installTheme` blueprint step](/blueprints/steps#InstallThemeStep), you can define a [`url` resource](/blueprints/steps/resources#urlreference) that points to the location of the `.zip` file containing the theme you want to load in the Playground instance.

To avoid CORS issues, the Playground project provides a [GitHub proxy](https://playground.wordpress.net/proxy) that allows you to generate a `.zip` from a repository (or even a folder inside a repo) containing your or theme.
In the `themeData` property of the [`installTheme` blueprint step](/blueprints/steps#InstallThemeStep), you can define a [`git:directory` resource](/blueprints/steps/resources#gitdirectoryreference) that points to your GitHub repository. This allows you to load a theme from a specific branch, directory, commit, tag, or even a PR.

:::tip
[GitHub proxy](https://playground.wordpress.net/proxy) is an incredibly useful tool to load themes from GitHub repositories as it allows you to load a theme from a specific branch, a specific directory, a specific commit or a specific PR.

If your theme is hosted on GitHub, you can automatically add preview buttons to your pull requests using the Playground PR Preview GitHub Action. This lets reviewers test your changes instantly without any setup. See [Adding PR Preview Buttons with GitHub Actions](/guides/github-action-pr-preview) for details.
:::

For example the following `blueprint.json` installs a theme from a GitHub repository leveraging the https://github-proxy.com tool:
For example the following `blueprint.json` installs a theme from a GitHub repository:

```json
{
"steps": [
{
"step": "installTheme",
"themeData": {
"resource": "url",
"url": "https://github-proxy.com/proxy/?repo=Automattic/themes&branch=trunk&directory=assembler"
"resource": "git:directory",
"url": "https://github.com/Automattic/themes",
"ref": "trunk",
"path": "assembler"
},
"options": {
"activate": true
Expand All @@ -75,7 +73,7 @@ For example the following `blueprint.json` installs a theme from a GitHub reposi
}
```

[<kbd> &nbsp; Run Blueprint &nbsp; </kbd>](https://playground.wordpress.net/builder/builder.html#{%22steps%22:[{%22step%22:%22installTheme%22,%22themeData%22:{%22resource%22:%22url%22,%22url%22:%22https://github-proxy.com/proxy/?repo=Automattic/themes&branch=trunk&directory=assembler%22},%22options%22:{%22activate%22:true}}]})
[<kbd> &nbsp; Run Blueprint &nbsp; </kbd>](https://playground.wordpress.net/builder/builder.html#{%22steps%22:[{%22step%22:%22installTheme%22,%22themeData%22:{%22resource%22:%22git:directory%22,%22url%22:%22https://github.com/Automattic/themes%22,%22ref%22:%22trunk%22,%22path%22:%22assembler%22},%22options%22:{%22activate%22:true}}]})

A blueprint can be passed to a Playground instance [in several ways](/blueprints/using-blueprints).

Expand All @@ -87,9 +85,9 @@ When providing a link to a WordPress Playground instance with a specific theme a

Some useful tools and resources provided by the Playground project to work with blueprints are:

- 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.
- 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!
- The [Blueprints builder](https://playground.wordpress.net/builder/builder.html) tool allows you edit your blueprint online and run it directly in a Playground instance.
- 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.
- 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!
- The [Blueprints builder](https://playground.wordpress.net/builder/builder.html) tool allows you edit your blueprint online and run it directly in a Playground instance.

:::

Expand Down
6 changes: 3 additions & 3 deletions packages/php-wasm/stream-compression/src/zip/encode-zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function encodeZipTransform() {
...header,
signature: SIGNATURE_CENTRAL_DIRECTORY,
fileComment: new Uint8Array(0),
diskNumber: 1,
diskNumber: 0,
internalAttributes: 0,
externalAttributes: 0,
firstByteAt: fileOffset,
Expand All @@ -121,10 +121,10 @@ function encodeZipTransform() {
}
const centralDirectoryEnd: CentralDirectoryEndEntry = {
signature: SIGNATURE_CENTRAL_DIRECTORY_END,
numberOfDisks: 1,
numberOfDisks: 0,
centralDirectoryOffset,
centralDirectorySize,
centralDirectoryStartDisk: 1,
centralDirectoryStartDisk: 0,
numberCentralDirectoryRecordsOnThisDisk:
offsetToFileHeaderMap.size,
numberCentralDirectoryRecords: offsetToFileHeaderMap.size,
Expand Down
Loading