|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +title: ブループリントデータ形式 |
| 4 | +slug: /blueprints/data-format |
| 5 | +--- |
| 6 | + |
| 7 | +# ブループリントデータ形式 |
| 8 | + |
| 9 | +<!-- |
| 10 | +# Blueprint data format |
| 11 | +--> |
| 12 | + |
| 13 | +ブループリント JSON ファイルには、Playground インスタンスを定義するために使用する様々なプロパティを含めることができます。最も重要なプロパティについては以下で詳しく説明します。 |
| 14 | + |
| 15 | +<!-- |
| 16 | +A Blueprint JSON file can have many different properties that will be used to define your Playground instance. The most important properties are detailed below. |
| 17 | +--> |
| 18 | + |
| 19 | +以下に、それらの多くを使用する例を示します。 |
| 20 | + |
| 21 | +<!-- |
| 22 | +Here's an example that uses many of them: |
| 23 | +--> |
| 24 | + |
| 25 | +import BlueprintExample from '@site/src/components/Blueprints/BlueprintExample.mdx'; |
| 26 | + |
| 27 | +<BlueprintExample blueprint={{ |
| 28 | + "landingPage": "/wp-admin/", |
| 29 | + "preferredVersions": { |
| 30 | + "php": "7.4", |
| 31 | + "wp": "6.5" |
| 32 | + }, |
| 33 | + "features": { |
| 34 | + "networking": true |
| 35 | + }, |
| 36 | + "steps": [ |
| 37 | + { |
| 38 | + "step": "login", |
| 39 | + "username": "admin", |
| 40 | + "password": "password" |
| 41 | + } |
| 42 | + ] |
| 43 | +}} /> |
| 44 | + |
| 45 | +## JSON スキーマ |
| 46 | + |
| 47 | +<!-- |
| 48 | +## JSON schema |
| 49 | +--> |
| 50 | + |
| 51 | +JSON ファイルの記述は面倒で、間違いやすいものです。Playground では、エディタで自動補完と検証を利用できる[JSON スキーマ](https://playground.wordpress.net/blueprint-schema.json)ファイルを提供しています。`$schema`プロパティを以下のように設定するだけです。 |
| 52 | + |
| 53 | +<!-- |
| 54 | +JSON files can be tedious to write and easy to get wrong. To help with that, Playground provides a [JSON schema](https://playground.wordpress.net/blueprint-schema.json) file that you can use to get auto-completion and validation in your editor. Just set the `$schema` property to the following: |
| 55 | +--> |
| 56 | + |
| 57 | +```js |
| 58 | +{ |
| 59 | + "$schema": "https://playground.wordpress.net/blueprint-schema.json", |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +## ランディングページ |
| 64 | + |
| 65 | +<!-- |
| 66 | +## Landing page |
| 67 | +--> |
| 68 | + |
| 69 | +`landingPage` プロパティは、ブループリント実行後に Playground にどの URL へ移動するかを指定します。これは特にテーマやプラグインのデモを作成する際に便利なツールです。多くの場合、サイトエディタで Playground を起動したり、投稿エディタで特定の投稿を開いたりする必要があるでしょう。必ず相対パスを使用してください。 |
| 70 | + |
| 71 | +<!-- |
| 72 | +The `landingPage` property tells Playground which URL to navigate to after the Blueprint has been run. This is a great tool, especially when creating theme or plugin demos. Often, you will want to start Playground in the Site Editor or have a specific post open in the Post Editor. Make sure you use a relative path. |
| 73 | +--> |
| 74 | + |
| 75 | +```js |
| 76 | +{ |
| 77 | + "landingPage": "/wp-admin/site-editor.php", |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +## 推奨バージョン |
| 82 | + |
| 83 | +<!-- |
| 84 | +## Preferred versions |
| 85 | +--> |
| 86 | + |
| 87 | +`preferredVersions` プロパティは、優先する PHP および WordPress のバージョンを宣言します。以下のプロパティを含めることができます。 |
| 88 | + |
| 89 | +<!-- |
| 90 | +The `preferredVersions` property declares your preferred PHP and WordPress versions. It can contain the following properties: |
| 91 | +--> |
| 92 | + |
| 93 | +- `php` (文字列): 指定された PHP バージョンを読み込みます。`7.0`、`7.1`、`7.2`、`7.3`、`7.4`、`8.0`、`8.1`、`8.2`、`8.3`、`8.4`、`latest` が使用できます。`7.4.1` などのマイナーバージョンはサポートされていません。 |
| 94 | +- `wp` (文字列): 指定された WordPress バージョンを読み込みます。最新の 4 つのメジャー WordPress バージョンが使用できます。2024 年 6 月 1 日時点では、`6.2`、`6.3`、`6.4`、`6.5` が使用できます。汎用値として `latest`、`nightly`、`beta` も使用できます。WordPress のプレリリース版を使用する場合、`beta` はリリースサイクルの最新のベータ版またはリリース候補版 (ベータ版または RC 版) を読み込みます。 |
| 95 | + |
| 96 | +<!-- |
| 97 | +- `php` (string): Loads the specified PHP version. Accepts `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, `8.3`, `8.4`, or `latest`. Minor versions like `7.4.1` are not supported. |
| 98 | +- `wp` (string): Loads the specified WordPress version. Accepts the last four major WordPress versions. As of June 1, 2024, that's `6.2`, `6.3`, `6.4`, or `6.5`. You can also use the generic values `latest`, `nightly`, or `beta`. To use a pre-release version of WordPress, `beta` will load the latest beta or release candidate versions of a release cycle (Beta or RC). |
| 99 | +--> |
| 100 | + |
| 101 | +```js |
| 102 | +{ |
| 103 | + "preferredVersions": { |
| 104 | + "php": "8.0", |
| 105 | + "wp": "6.5" |
| 106 | + }, |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +## 特徴 |
| 111 | + |
| 112 | +<!-- |
| 113 | +## Features |
| 114 | +--> |
| 115 | + |
| 116 | +`features` プロパティを使用して、Playground インスタンスの特定の機能をオンまたはオフにすることができます。このプロパティには以下のプロパティが含まれます。 |
| 117 | + |
| 118 | +<!-- |
| 119 | +You can use the `features` property to turn on or off certain features of the Playground instance. It can contain the following properties: |
| 120 | +--> |
| 121 | + |
| 122 | +- `networking`: デフォルトは `true` です。Playground のネットワークサポートを有効または無効にします。有効にすると、[`wp_safe_remote_get`](https://developer.wordpress.org/reference/functions/wp_safe_remote_get/) などの WordPress 関数は、実際には `fetch()` を使用して HTTP リクエストを送信します。無効にすると、代わりに即座に失敗します。ユーザーがプラグインやテーマをインストールできるようにするには、このプロパティを有効にする必要があります。 |
| 123 | + |
| 124 | +<!-- |
| 125 | +- `networking`: Defaults to `true`. Enables or disables the networking support for Playground. If enabled, [`wp_safe_remote_get`](https://developer.wordpress.org/reference/functions/wp_safe_remote_get/) and similar WordPress functions will actually use `fetch()` to make HTTP requests. If disabled, they will immediately fail instead. You will need this property enabled if you want the user to be able to install plugins or themes. |
| 126 | +--> |
| 127 | + |
| 128 | +```js |
| 129 | +{ |
| 130 | + "features": { |
| 131 | + "networking": false |
| 132 | + }, |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +## 追加ライブラリ |
| 137 | + |
| 138 | +<!-- |
| 139 | +## Extra libraries |
| 140 | +--> |
| 141 | + |
| 142 | +Playground インスタンスに追加のライブラリをプリロードできます。以下のライブラリがサポートされています。 |
| 143 | + |
| 144 | +<!-- |
| 145 | +You can preload extra libraries into the Playground instance. The following libraries are supported: |
| 146 | +--> |
| 147 | + |
| 148 | +- `wp-cli`: Playground の WP-CLI サポートを有効にします。これを含めると、起動時に WP-CLI がインストールされます。含めない場合、JS API を使用して WP-CLI コマンドを実行しようとするとエラーメッセージが表示されます。ブループリントに `wp-cli` ステップが含まれている場合、WP-CLI はデフォルトでインストールされます。 |
| 149 | + |
| 150 | +<!-- |
| 151 | +- `wp-cli`: Enables WP-CLI support for Playground. If included, WP-CLI will be installed during boot. If not included, you will get an error message when trying to run WP-CLI commands using the JS API. WP-CLI will be installed by default if the blueprint contains any `wp-cli` steps. |
| 152 | +--> |
| 153 | + |
| 154 | +```js |
| 155 | +{ |
| 156 | + "extraLibraries": [ "wp-cli" ], |
| 157 | +} |
| 158 | +``` |
| 159 | + |
| 160 | +## 手順 |
| 161 | + |
| 162 | +<!-- |
| 163 | +## Steps |
| 164 | +--> |
| 165 | + |
| 166 | +おそらく最も強力なプロパティである `steps` を使うと、Playground インスタンスにプリインストールされたテーマ、プラグイン、デモコンテンツなどを設定できます。次の例では、専用のユーザー名とパスワードでユーザーをログインさせ、Gutenberg プラグインをインストールして有効化します。[steps の詳細](/blueprints/steps) |
| 167 | + |
| 168 | +<!-- |
| 169 | +Arguably the most powerful property, `steps` allows you to configure the Playground instance with preinstalled themes, plugins, demo content, and more. The following example logs the user in with a dedicated username and password. It then installs and activates the Gutenberg plugin. [Learn more about steps](/blueprints/steps). |
| 170 | +--> |
| 171 | + |
| 172 | +```js |
| 173 | +{ |
| 174 | + "steps": [ |
| 175 | + { |
| 176 | + "step": "login", |
| 177 | + "username": "admin", |
| 178 | + "password": "password" |
| 179 | + }, |
| 180 | + { |
| 181 | + "step": "installPlugin", |
| 182 | + "pluginData": { |
| 183 | + "resource": "wordpress.org/plugins", |
| 184 | + "slug": "gutenberg" |
| 185 | + } |
| 186 | + }, |
| 187 | + ] |
| 188 | +} |
| 189 | +``` |
0 commit comments