diff --git a/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache b/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache index 48469aa7d0d931..cb7f45b7207946 100644 --- a/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache +++ b/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache @@ -8,8 +8,12 @@ * Description: {{description}} {{/description}} * Version: {{version}} - * Requires at least: 6.6 - * Requires PHP: 7.2 +{{#requiresAtLeast}} + * Requires at least: {{requiresAtLeast}} +{{/requiresAtLeast}} +{{#requiresPHP}} + * Requires PHP: {{requiresPHP}} +{{/requiresPHP}} {{#author}} * Author: {{author}} {{/author}} diff --git a/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache b/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache index c3abf5ae4ec024..19a4c8e78587b6 100644 --- a/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache +++ b/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache @@ -3,7 +3,9 @@ Contributors: {{author}} {{/author}} Tags: block -Tested up to: 6.6 +{{#testedUpTo}} +Tested up to: {{testedUpTo}} +{{/testedUpTo}} Stable tag: {{version}} {{#license}} License: {{license}} diff --git a/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache b/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache index 7ce4be3f7cc739..49959fb5b2f691 100644 --- a/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache +++ b/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache @@ -8,8 +8,12 @@ * Description: {{description}} {{/description}} * Version: {{version}} - * Requires at least: 6.6 - * Requires PHP: 7.2 +{{#requiresAtLeast}} + * Requires at least: {{requiresAtLeast}} +{{/requiresAtLeast}} +{{#requiresPHP}} + * Requires PHP: {{requiresPHP}} +{{/requiresPHP}} {{#author}} * Author: {{author}} {{/author}} diff --git a/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache b/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache index c3abf5ae4ec024..19a4c8e78587b6 100644 --- a/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache +++ b/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache @@ -3,7 +3,9 @@ Contributors: {{author}} {{/author}} Tags: block -Tested up to: 6.6 +{{#testedUpTo}} +Tested up to: {{testedUpTo}} +{{/testedUpTo}} Stable tag: {{version}} {{#license}} License: {{license}} diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md index e109e36ccbd798..983bb711f50e91 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -5,6 +5,7 @@ ### Enhancement - Add support for custom `textdomain` property for the scaffolded block ([#57197](https://github.com/WordPress/gutenberg/pull/57197)). +- Allow external templates to customize additional plugin header and readme fields: "Requires at least", "Requires PHP", and "Tested up to" ([#68193](https://github.com/WordPress/gutenberg/pull/68193)) ### Internal diff --git a/packages/create-block/docs/external-template.md b/packages/create-block/docs/external-template.md index 45c3cba8c9271d..d840896f266f30 100644 --- a/packages/create-block/docs/external-template.md +++ b/packages/create-block/docs/external-template.md @@ -76,10 +76,13 @@ The following configurable variables are used with the template files. Template - `npmDevDependencies` (default: `[]`) – the list of remote npm packages to be installed in the project with [`npm install --save-dev`](https://docs.npmjs.com/cli/v8/commands/npm-install) when `wpScripts` is enabled. - `customPackageJSON` (no default) - allows definition of additional properties for the generated package.json file. -**Plugin header fields** ([learn more](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/)): +**Plugin header and readme fields** (learn more about [header requirements](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/) and [readmes](https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/)): - `pluginURI` (no default) – the home page of the plugin. - `version` (default: `'0.1.0'`) – the current version number of the plugin. +- `requiresAtLeast` (default: `'6.7'`) – the lowest WordPress version that the plugin will work on. +- `requiresPHP` (default: `'7.4'`) – the minimum required PHP version for use with this plugin. +- `testedUpTo` (default: `'6.7'`) – the highest WordPress version that the plugin has been tested against. - `author` (default: `'The WordPress Contributors'`) – the name of the plugin author(s). - `license` (default: `'GPL-2.0-or-later'`) – the short name of the plugin’s license. - `licenseURI` (default: `'https://www.gnu.org/licenses/gpl-2.0.html'`) – a link to the full text of the license. @@ -97,6 +100,7 @@ The following configurable variables are used with the template files. Template - `description` (no default) – a short description for your block. - `dashicon` (no default) – an icon property thats makes it easier to identify a block ([available values](https://developer.wordpress.org/resource/dashicons/)). - `category` (default: `'widgets'`) – blocks are grouped into categories to help users browse and discover them. The categories provided by core are `text`, `media`, `design`, `widgets`, `theme`, and `embed`. +- `textdomain` (defaults to the `slug` value) – the text domain used to make strings translatable ([more info](https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#text-domains)). - `attributes` (no default) – block attributes ([more details](https://developer.wordpress.org/block-editor/developers/block-api/block-attributes/)). - `supports` (no default) – optional block extended support features ([more details](https://developer.wordpress.org/block-editor/developers/block-api/block-supports/). - `editorScript` (default: `'file:./index.js'`) – an editor script definition. diff --git a/packages/create-block/lib/scaffold.js b/packages/create-block/lib/scaffold.js index bc7cb3b8bfcd32..4e09e49f77bce5 100644 --- a/packages/create-block/lib/scaffold.js +++ b/packages/create-block/lib/scaffold.js @@ -36,6 +36,9 @@ module.exports = async ( domainPath, updateURI, version, + requiresAtLeast, + requiresPHP, + testedUpTo, wpScripts, wpEnv, npmDependencies, @@ -79,6 +82,9 @@ module.exports = async ( domainPath, updateURI, version, + requiresAtLeast, + requiresPHP, + testedUpTo, wpScripts, wpEnv, npmDependencies, diff --git a/packages/create-block/lib/templates.js b/packages/create-block/lib/templates.js index db78ee80aa429a..b29b361384e869 100644 --- a/packages/create-block/lib/templates.js +++ b/packages/create-block/lib/templates.js @@ -236,6 +236,9 @@ const getDefaultValues = ( projectTemplate, variant ) => { license: 'GPL-2.0-or-later', licenseURI: 'https://www.gnu.org/licenses/gpl-2.0.html', version: '0.1.0', + requiresAtLeast: '6.7', + requiresPHP: '7.4', + testedUpTo: '6.7', wpScripts: true, customScripts: {}, wpEnv: false, diff --git a/packages/create-block/lib/templates/es5/$slug.php.mustache b/packages/create-block/lib/templates/es5/$slug.php.mustache index 825fd1bfd8b5aa..5beb2ca06712c9 100644 --- a/packages/create-block/lib/templates/es5/$slug.php.mustache +++ b/packages/create-block/lib/templates/es5/$slug.php.mustache @@ -7,9 +7,13 @@ {{#description}} * Description: {{description}} {{/description}} - * Requires at least: 6.6 - * Requires PHP: 7.2 * Version: {{version}} +{{#requiresAtLeast}} + * Requires at least: {{requiresAtLeast}} +{{/requiresAtLeast}} +{{#requiresPHP}} + * Requires PHP: {{requiresPHP}} +{{/requiresPHP}} {{#author}} * Author: {{author}} {{/author}} diff --git a/packages/create-block/lib/templates/es5/readme.txt.mustache b/packages/create-block/lib/templates/es5/readme.txt.mustache index c3abf5ae4ec024..19a4c8e78587b6 100644 --- a/packages/create-block/lib/templates/es5/readme.txt.mustache +++ b/packages/create-block/lib/templates/es5/readme.txt.mustache @@ -3,7 +3,9 @@ Contributors: {{author}} {{/author}} Tags: block -Tested up to: 6.6 +{{#testedUpTo}} +Tested up to: {{testedUpTo}} +{{/testedUpTo}} Stable tag: {{version}} {{#license}} License: {{license}} diff --git a/packages/create-block/lib/templates/plugin/$slug.php.mustache b/packages/create-block/lib/templates/plugin/$slug.php.mustache index 75666af3a850b2..8f61d9bdfcc044 100644 --- a/packages/create-block/lib/templates/plugin/$slug.php.mustache +++ b/packages/create-block/lib/templates/plugin/$slug.php.mustache @@ -7,9 +7,13 @@ {{#description}} * Description: {{description}} {{/description}} - * Requires at least: 6.6 - * Requires PHP: 7.2 * Version: {{version}} +{{#requiresAtLeast}} + * Requires at least: {{requiresAtLeast}} +{{/requiresAtLeast}} +{{#requiresPHP}} + * Requires PHP: {{requiresPHP}} +{{/requiresPHP}} {{#author}} * Author: {{author}} {{/author}} diff --git a/packages/create-block/lib/templates/plugin/readme.txt.mustache b/packages/create-block/lib/templates/plugin/readme.txt.mustache index c3abf5ae4ec024..19a4c8e78587b6 100644 --- a/packages/create-block/lib/templates/plugin/readme.txt.mustache +++ b/packages/create-block/lib/templates/plugin/readme.txt.mustache @@ -3,7 +3,9 @@ Contributors: {{author}} {{/author}} Tags: block -Tested up to: 6.6 +{{#testedUpTo}} +Tested up to: {{testedUpTo}} +{{/testedUpTo}} Stable tag: {{version}} {{#license}} License: {{license}}