Blueprints v2 Specification
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 20/100
調査の方向性
この issue には、リポジトリのファイル、テスト、エントリーポイントが記載されていません。まず既存の Blueprint スキーマ、issue #5 の互換性に関する議論、wp-env の設定形式を確認し、その後ここにある runtime の例を比較してください。互換性、runtime とクライアントの動作、WordPress のセットアップ、shorthand properties、メタデータを網羅する、合意済みの v2 仕様ができれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The previous, TypeScript-powered, Blueprint schema only makes sense in the browser, not in a portable PHP library. Let's design one that does.
The existing Blueprints should keep working as much as possible. The library could detect an outdated syntax and rewrite it to the new one behind the scenes.
Converging with wp-env
wp-env has its own config format.
Let's converge wp-env and Blueprints. This could mean either:
- Transitioning both to the v2 schema format
- Replacing
wp-envwith Blueprints using Docker as a backend as both solve the same problem
cc @youknowriad @noahtallen
Runtime setup options
The following Blueprint options are for setting up the PHP.wasm runtime. They make sense in Playground and Docker where we need to set up the runtime, but not in native PHP where the runtime is already provided:
{
"preferredVersions": {
"php": "7.4"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
}
}
An alternative syntax would make that apparent and allow for environment-specific overrides. Here's one idea:
{
"php": {
"version": "7.4",
"extensions": [ "libcurl", "libxml" ],
"playground": {
"networking": "fetch()"
},
"docker": {
"networking": false
}
}
}
The Native PHP driver could log a message saying that PHP setup instructions are unsupported and were ignored. Optionally, it could verify if the requested PHP version and extensions match.
Open questions
How should PHP.ini setup be defined and how should it work? Should we do an mu-plugin with ini_set()?
Client setup
The following Blueprint options only make sense in the browser where we control the client:
{
"landingPage": "/wp-admin/",
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
What should they do when building a site using the native PHP CLI. Perhaps they could start a server, open a web browser, and open /wp-admin/ in a logged in state? Controlling the browser isn't trivial, so presumably there would be a special, one-time, magic login link with a ?redirect= query arg or so. If so, we could express it as follows:
{
"onBoot": {
"openURL": "/wp-admin/",
"loginAs": "admin"
}
}
What if we cannot start the server or open the browser, though? For example, we're building in a headless mode. Should the runtime ignore those options? Should it issue a warning? Should these options be runtime-specific?
WordPress setup
The following Blueprint options are responsible for setting up WordPress:
{
"preferredVersions": {
"wp": "5.9"
},
"steps": [
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "friends"
}
},
// ... other steps ...
]
}
They could be bundled under a single top-level key as follows:
{
"wpVersion": "5.9",
"steps": [
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "friends"
}
},
// ... other steps ...
]
}
Open questions
- In which directory should WordPress be installed? Current working directory? A directory provided by the runtime, e.g.
blueprint --target=./build? How should that directory be referenced in steps likewriteFileorrunPHP? Using special syntax like%DOCROOT%?
Shorthand properties
The step-by-step syntax is overly verbose for most developers, let's make it shorter.
The verbose syntax must remain available as it's the only way to enable reproducible, reliable builds. Some developers may need to correct site options or import content after plugin A was activated but before plugin B was installed and Blueprints should empower them. However, most the developers will never run into nuances like that.
Let's design a schema that's convenient for most use-cases, yet powerful enough to handle nuanced setups.
Here's what it could look like:
{
"wpVersion": "5.9",
"plugins": [
"woocommerce",
"gutenberg"
],
// Optional: all plugins are activated if this isn't specified:
"activatePlugins": [
"woocommerce"
],
"themes": [ "pendant", "twentytwentythree" ],
"siteOptions": {
"blogname": "My new site"
},
"wpConfig": {
"WP_DEBUG": true
},
"content": [
"./theme-unit-test-data.xml",
"./accessibility-testing-content.xml"
],
"files": {
"wp-content/mu-plugins/0-my-mu-plugin.php": [
"<?php",
"add_filter('wp_init', function() {"
"echo 'Hello, world';",
"}"
]
},
"steps": [
// All the above options are translated into steps and prepended to the `steps` array
// in an opinionated order. Whenever the developer needs to customize the execution
// order, they could re-express the relevant part of the Blueprint using explicitly-ordered
// operations.
]
}
Metadata
WordPress.org could have a Blueprints community space on WordPress.org for folks to share and collaborate on WordPress setups. Similarly to plugins metadata, Blueprints would need to carry some meta information as well.
Here's what a top-level meta key could look like:
{
"meta": {
"title": "WooCommerce Developer Environment",
"description": "A local development environment for WooCommerce that includes WP-CLI.",
"version": "0.0.8",
"author": "zieladam",
"contributors": ["zieladam", "dmsnell"],
"authorUrl": "https://example.com",
"donateLink": "https://example.com",
"tags": ["woocommerce", "developer environment"],
"license": "GPLv2 or later",
}
}
Which other fields would be required? Do we need to separate contributors and authors? Should each contributor be able to provide their own website URL?
It could be validated using the JSON Schema below. Note the main Blueprints library could simply ignore the meta key. The validation would happen exclusively during the submission process to the community space.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"meta": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string",
"maxLength": 150
},
"version": {
"type": "string"
},
"author": {
"type": "string"
},
"authorUrl": {
"type": "string",
"format": "uri"
},
"contributors": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"tags": {
"type": "array",
"items": {
"type": "string",
"enum": ["woocommerce", "developer environment"]
}
},
"donateLink": {
"type": "string",
"format": "uri"
},
"license": {
"type": "string"
}
},
"required": ["author", "version", "title", "contributors", "tags", "license"]
}
},
"required": ["meta"]
}
What new features would be useful?
- https://github.com/WordPress/blueprints/issues/32
- https://github.com/WordPress/wordpress-playground/pull/1020
- https://github.com/WordPress/blueprints/issues/46
- Creating a post and being able to reference it later, e.g. redirect to the editor in the
openURLsection
cc @bgrgicak @dmsnell @mtias @tellyworth @danielbachhuber
- 主要言語
- PHP
- スター
- 62
- フォーク
- 23
- 平均マージ
- 4時間 12分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
WordPress/php-toolkit のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
WordPress/php-toolkit#313 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
WordPress/php-toolkit#306 ·
-
WPCS complianceオープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
WordPress/php-toolkit#157 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
WordPress/php-toolkit#138 · コメント 7 件 · リアクション 2 件 ·
-
[Blueprints v2] Constraint the Blueprint bundle format対応中かも @JanJakes が 441 日前に担当しました。 オープンBlueprints enhancement
WordPress/php-toolkit#132 · コメント 4 件 · 担当者 1 名 ·
WordPress/php-toolkit の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
WordPress/hosting-handbook#506 ·
メンテナーはふだん 2 日以内に返信
-
Installing a plugin with composer_packages installs dev dependencies and breaks the autoloader (Error 500)対応中かも @Boy132 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
nginx: static-file locations drop the security headers, and the dotfile deny is matched after themオープンbug Low Security
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
backdrop-contrib/commerce#60 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100