|
| 1 | +--- |
| 2 | +title: ブループリントバンドル |
| 3 | +slug: /blueprints/bundles |
| 4 | +--- |
| 5 | + |
| 6 | +# ブループリントバンドル |
| 7 | + |
| 8 | +<!-- |
| 9 | +# Blueprint Bundles |
| 10 | +--> |
| 11 | + |
| 12 | +ブループリントバンドルは、ブループリント宣言(`blueprint.json`)と、コンパイルおよび実行に必要なすべての追加リソースを含む自己完結型パッケージです。これにより、WordPress Playground の完全なセットアップを容易に配布・共有できます。 |
| 13 | + |
| 14 | +<!-- |
| 15 | +Blueprint bundles are self-contained packages that include a Blueprint declaration (`blueprint.json`) along with all the additional resources required to compile and run it. This makes it easier to distribute and share complete WordPress Playground setups. |
| 16 | +--> |
| 17 | + |
| 18 | +## What are Blueprint Bundles? |
| 19 | + |
| 20 | +<!-- |
| 21 | +## ブループリント バンドルとは何ですか? |
| 22 | +--> |
| 23 | + |
| 24 | +ブループリント バンドルは、次のものを含むファイルのコレクションです: |
| 25 | + |
| 26 | +<!-- |
| 27 | +A Blueprint bundle is a collection of files that includes: |
| 28 | +--> |
| 29 | + |
| 30 | +1. ブループリントの設定を定義する `blueprint.json` ファイル |
| 31 | +2. ブループリントが参照する追加リソース(テーマ、プラグイン、コンテンツファイルなど) |
| 32 | + |
| 33 | +<!-- |
| 34 | +1. A `blueprint.json` file that defines the Blueprint configuration |
| 35 | +2. Any additional resources referenced by the Blueprint (themes, plugins, content files, etc.) |
| 36 | +--> |
| 37 | + |
| 38 | +ブループリント バンドルはさまざまな形式で配布できます: |
| 39 | + |
| 40 | +<!-- |
| 41 | +Blueprint bundles can be distributed in various formats: |
| 42 | +--> |
| 43 | + |
| 44 | +- トップレベルの `blueprint.json` ファイルと追加リソースを含む ZIP ファイル |
| 45 | +- Git リポジトリ内の `blueprint.json` とその他のリソースが格納されているディレクトリ |
| 46 | +- コンピュータ上のローカルディレクトリ |
| 47 | +- 関連ファイルがインライン化されたインライン JavaScript オブジェクト |
| 48 | + |
| 49 | +<!-- |
| 50 | +- A ZIP file with a top-level `blueprint.json` file and additional resources |
| 51 | +- A directory inside a git repository where `blueprint.json` resides alongside other resources |
| 52 | +- A local directory on your computer |
| 53 | +- An inline JavaScript object with the relevant files inlined |
| 54 | +--> |
| 55 | + |
| 56 | +## ブループリントバンドルの使用 |
| 57 | + |
| 58 | +<!-- |
| 59 | +## Using Blueprint Bundles |
| 60 | +--> |
| 61 | + |
| 62 | +### ウェブサイト |
| 63 | + |
| 64 | +<!-- |
| 65 | +### On the Website |
| 66 | +--> |
| 67 | + |
| 68 | +WordPress Playground ウェブサイトは、`?blueprint-url=` クエリパラメータを通じて Blueprint バンドルをサポートしています。Blueprint バンドルを含む ZIP ファイルの URL を指定できます。 |
| 69 | + |
| 70 | +<!-- |
| 71 | +The WordPress Playground website supports Blueprint bundles through the `?blueprint-url=` query parameter. You can provide a URL to a ZIP file containing your Blueprint bundle. |
| 72 | +--> |
| 73 | + |
| 74 | +``` |
| 75 | +https://playground.wordpress.net/?blueprint-url=https://example.com/my-blueprint-bundle.zip |
| 76 | +``` |
| 77 | + |
| 78 | +ZIP ファイルには、ルート レベルの `blueprint.json` ファイルと、ブループリントによって参照される追加のリソースが含まれている必要があります。 |
| 79 | + |
| 80 | +<!-- |
| 81 | +The ZIP file should contain a `blueprint.json` file at the root level, along with any additional resources referenced by the Blueprint. |
| 82 | +--> |
| 83 | + |
| 84 | +### CLI の場合 |
| 85 | + |
| 86 | +<!-- |
| 87 | +### In the CLI |
| 88 | +--> |
| 89 | + |
| 90 | +Playground CLI は `--blueprint=` オプションを通じてブループリントバンドルをサポートします。以下のオプションを指定できます: |
| 91 | + |
| 92 | +<!-- |
| 93 | +The Playground CLI supports Blueprint bundles through the `--blueprint=` option. You can provide: |
| 94 | +--> |
| 95 | + |
| 96 | +- ブループリントバンドルを含むローカルディレクトリへのパス |
| 97 | +- ブループリントバンドルを含むローカル ZIP ファイルへのパス |
| 98 | +- リモートブループリントバンドルへの URL (http:// または https://) |
| 99 | + |
| 100 | +<!-- |
| 101 | +- A path to a local directory containing a Blueprint bundle |
| 102 | +- A path to a local ZIP file containing a Blueprint bundle |
| 103 | +- A URL to a remote Blueprint bundle (http:// or https://) |
| 104 | +--> |
| 105 | + |
| 106 | +例えば: |
| 107 | + |
| 108 | +<!-- |
| 109 | +For example: |
| 110 | +--> |
| 111 | + |
| 112 | +```bash |
| 113 | +# Using a local ZIP file |
| 114 | +npx @wp-playground/cli --blueprint=./my-blueprint.zip server |
| 115 | + |
| 116 | +# Using a remote URL |
| 117 | +npx @wp-playground/cli --blueprint=https://example.com/my-blueprint.zip server |
| 118 | + |
| 119 | +# Using a local directory |
| 120 | +npx @wp-playground/cli --blueprint=./my-blueprint-directory server |
| 121 | +``` |
| 122 | + |
| 123 | +デフォルトでは、セキュリティ上の理由から、CLI はローカルファイルへのアクセスを制限します。ブループリントが同じ親ディレクトリ内のファイルにアクセスする必要がある場合は、`--blueprint-may-read-adjacent-files`フラグを使用して明示的に権限を付与する必要があります。 |
| 124 | + |
| 125 | +<!-- |
| 126 | +By default, the CLI restricts access to local files for security reasons. If your Blueprint needs to access files in the same parent directory, you need to explicitly grant permission using the `--blueprint-may-read-adjacent-files` flag: |
| 127 | +--> |
| 128 | + |
| 129 | +```bash |
| 130 | +npx @wp-playground/cli --blueprint=./my-blueprint.json --blueprint-may-read-adjacent-files server |
| 131 | +``` |
| 132 | + |
| 133 | +## ブループリントバンドルの作成 |
| 134 | + |
| 135 | +<!-- |
| 136 | +## Creating Blueprint Bundles |
| 137 | +--> |
| 138 | + |
| 139 | +### 基本構造 |
| 140 | + |
| 141 | +<!-- |
| 142 | +### Basic Structure |
| 143 | +--> |
| 144 | + |
| 145 | +基本的なブループリント バンドルは次のようになります: |
| 146 | + |
| 147 | +<!-- |
| 148 | +A basic Blueprint bundle might look like this: |
| 149 | +--> |
| 150 | + |
| 151 | +``` |
| 152 | +my-blueprint-bundle/ |
| 153 | +├── blueprint.json |
| 154 | +├── theme.zip |
| 155 | +├── plugin.zip |
| 156 | +└── content/ |
| 157 | + └── sample-content.wxr |
| 158 | +``` |
| 159 | + |
| 160 | +### バンドルされたリソースを含むブループリントの例 |
| 161 | + |
| 162 | +<!-- |
| 163 | +### Example Blueprint with Bundled Resources |
| 164 | +--> |
| 165 | + |
| 166 | +バンドルされたリソースを参照する `blueprint.json` ファイルの例を次に示します。 |
| 167 | + |
| 168 | +<!-- |
| 169 | +Here's an example of a `blueprint.json` file that references bundled resources: |
| 170 | +--> |
| 171 | + |
| 172 | +```json |
| 173 | +{ |
| 174 | + "landingPage": "/my-file.txt", |
| 175 | + "steps": [ |
| 176 | + { |
| 177 | + "step": "writeFile", |
| 178 | + "path": "/wordpress/my-file.txt", |
| 179 | + "data": { |
| 180 | + "resource": "bundled", |
| 181 | + "path": "/bundled-text-file.txt" |
| 182 | + } |
| 183 | + }, |
| 184 | + { |
| 185 | + "step": "installTheme", |
| 186 | + "themeData": { |
| 187 | + "resource": "bundled", |
| 188 | + "path": "/theme.zip" |
| 189 | + } |
| 190 | + }, |
| 191 | + { |
| 192 | + "step": "installPlugin", |
| 193 | + "pluginData": { |
| 194 | + "resource": "bundled", |
| 195 | + "path": "/plugin.zip" |
| 196 | + } |
| 197 | + }, |
| 198 | + { |
| 199 | + "step": "importWxr", |
| 200 | + "file": { |
| 201 | + "resource": "bundled", |
| 202 | + "path": "/content/sample-content.wxr" |
| 203 | + } |
| 204 | + } |
| 205 | + ] |
| 206 | +} |
| 207 | +``` |
| 208 | + |
| 209 | +この例では、ブループリントはバンドルされたいくつかのリソースを参照します: |
| 210 | + |
| 211 | +<!-- |
| 212 | +In this example, the Blueprint references several bundled resources: |
| 213 | +--> |
| 214 | + |
| 215 | +- `/bundled-text-file.txt` にあるテキストファイル |
| 216 | +- `/theme.zip` にあるテーマの ZIP ファイル |
| 217 | +- `/plugin.zip` にあるプラグインの ZIP ファイル |
| 218 | +- `/content/sample-content.wxr` にある WXR コンテンツファイル |
| 219 | + |
| 220 | +<!-- |
| 221 | +- A text file at `/bundled-text-file.txt` |
| 222 | +- A theme ZIP file at `/theme.zip` |
| 223 | +- A plugin ZIP file at `/plugin.zip` |
| 224 | +- A WXR content file at `/content/sample-content.wxr` |
| 225 | +--> |
| 226 | + |
| 227 | +### ZIP バンドルの作成 |
| 228 | + |
| 229 | +<!-- |
| 230 | +### Creating a ZIP Bundle |
| 231 | +--> |
| 232 | + |
| 233 | +ZIP バンドルを作成するには、`blueprint.json` と必要なすべてのリソースを含むディレクトリを作成し、それを ZIP 形式で圧縮するだけです: |
| 234 | + |
| 235 | +<!-- |
| 236 | +To create a ZIP bundle, simply create a directory with your `blueprint.json` and all required resources, then zip it up: |
| 237 | +--> |
| 238 | + |
| 239 | +```bash |
| 240 | +# Create a directory for your bundle |
| 241 | +mkdir my-blueprint-bundle |
| 242 | +cd my-blueprint-bundle |
| 243 | + |
| 244 | +# Create your blueprint.json and add resources |
| 245 | +# ... |
| 246 | + |
| 247 | +# Zip it up |
| 248 | +zip -r ../my-blueprint-bundle.zip . |
| 249 | +``` |
| 250 | + |
| 251 | +## トラブルシューティング |
| 252 | + |
| 253 | +<!-- |
| 254 | +## Troubleshooting |
| 255 | +--> |
| 256 | + |
| 257 | +ブループリント バンドルで問題が発生した場合: |
| 258 | + |
| 259 | +<!-- |
| 260 | +If you encounter issues with Blueprint bundles: |
| 261 | +--> |
| 262 | + |
| 263 | +1. `blueprint.json` ファイルが ZIP ファイルのルートレベルにあることを確認してください。 |
| 264 | +2. バンドルされたリソース参照内のすべてのパスが正しいことを確認してください。 |
| 265 | +3. ZIP ファイルが適切にフォーマットされていることを確認してください。 |
| 266 | +4. CLI を使用する場合は、`--blueprint-may-read-adjacent-files` フラグが必要かどうかを確認してください。 |
| 267 | +5. 必要なすべてのリソースがバンドルに含まれていることを確認してください。 |
| 268 | + |
| 269 | +<!-- |
| 270 | +1. Ensure your `blueprint.json` file is at the root level of your ZIP file |
| 271 | +2. Check that all paths in your bundled resource references are correct |
| 272 | +3. Verify that your ZIP file is properly formatted |
| 273 | +4. When using the CLI, check if you need the `--blueprint-may-read-adjacent-files` flag |
| 274 | +5. Ensure all required resources are included in the bundle |
| 275 | +--> |
0 commit comments