diff --git a/packages/create-block/lib/prompts.js b/packages/create-block/lib/prompts.js index 99d49120e2d6e..e891331dbc20b 100644 --- a/packages/create-block/lib/prompts.js +++ b/packages/create-block/lib/prompts.js @@ -73,6 +73,31 @@ const category = { choices: [ 'common', 'embed', 'formatting', 'layout', 'widgets' ], }; +const author = { + type: 'input', + name: 'author', + message: + 'The list of contributors containing only WordPress.org usernames (optional):', +}; + +const license = { + type: 'input', + name: 'license', + message: 'The plugin license (optional):', +}; + +const licenseURI = { + type: 'input', + name: 'licenseURI', + message: 'The plugin license URI (optional):', +}; + +const version = { + type: 'input', + name: 'version', + message: 'The plugin version (optional):', +}; + module.exports = { slug, namespace, @@ -80,4 +105,8 @@ module.exports = { description, dashicon, category, + author, + license, + licenseURI, + version, }; diff --git a/packages/create-block/lib/scaffold.js b/packages/create-block/lib/scaffold.js index 85186c15eb717..be9b09588bde6 100644 --- a/packages/create-block/lib/scaffold.js +++ b/packages/create-block/lib/scaffold.js @@ -25,6 +25,7 @@ module.exports = async function( category, author, license, + licenseURI, version, } ) { @@ -46,6 +47,7 @@ module.exports = async function( version, author, license, + licenseURI, textdomain: namespace, }; await Promise.all( diff --git a/packages/create-block/lib/templates.js b/packages/create-block/lib/templates.js index da5ea63312a35..581e4ee1c4845 100644 --- a/packages/create-block/lib/templates.js +++ b/packages/create-block/lib/templates.js @@ -9,6 +9,7 @@ const dashicon = 'smiley'; const category = 'widgets'; const author = 'The WordPress Contributors'; const license = 'GPL-2.0-or-later'; +const licenseURI = 'https://www.gnu.org/licenses/gpl-2.0.html'; const version = '0.1.0'; const templates = { @@ -23,6 +24,7 @@ const templates = { category, author, license, + licenseURI, version, }, outputFiles: [ @@ -31,6 +33,7 @@ const templates = { 'index.js', '$slug.php', 'style.css', + 'readme.txt', ], }, esnext: { @@ -44,6 +47,7 @@ const templates = { category, author, license, + licenseURI, version, }, outputFiles: [ @@ -53,6 +57,7 @@ const templates = { 'src/index.js', '$slug.php', 'style.css', + 'readme.txt', ], wpScriptsEnabled: true, }, diff --git a/packages/create-block/lib/templates/es5/readme.txt.mustache b/packages/create-block/lib/templates/es5/readme.txt.mustache new file mode 100644 index 0000000000000..b0e13c215642b --- /dev/null +++ b/packages/create-block/lib/templates/es5/readme.txt.mustache @@ -0,0 +1,57 @@ +=== {{title}} === +Contributors: {{author}} +Tags: block +Requires at least: 5.3.2 +Tested up to: 5.3.2 +Stable tag: {{version}} +Requires PHP: 7.0.0 +License: {{license}} +License URI: {{{licenseURI}}} + +{{description}} + +== Description == + +This is the long description. No limit, and you can use Markdown (as well as in the following sections). + +For backwards compatibility, if this section is missing, the full length of the short description will be used, and +Markdown parsed. + +== Installation == + +This section describes how to install the plugin and get it working. + +e.g. + +1. Upload the plugin files to the `/wp-content/plugins/{{slug}}` directory, or install the plugin through the WordPress plugins screen directly. +1. Activate the plugin through the 'Plugins' screen in WordPress + + +== Frequently Asked Questions == + += A question that someone might have = + +An answer to that question. + += What about foo bar? = + +Answer to foo bar dilemma. + +== Screenshots == + +1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from +the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets +directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` +(or jpg, jpeg, gif). +2. This is the second screen shot + +== Changelog == + += {{version}} = +* Release + +== Arbitrary section == + +You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated +plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or +"installation." Arbitrary sections will be shown below the built-in sections outlined above. diff --git a/packages/create-block/lib/templates/esnext/readme.txt.mustache b/packages/create-block/lib/templates/esnext/readme.txt.mustache new file mode 100644 index 0000000000000..b0e13c215642b --- /dev/null +++ b/packages/create-block/lib/templates/esnext/readme.txt.mustache @@ -0,0 +1,57 @@ +=== {{title}} === +Contributors: {{author}} +Tags: block +Requires at least: 5.3.2 +Tested up to: 5.3.2 +Stable tag: {{version}} +Requires PHP: 7.0.0 +License: {{license}} +License URI: {{{licenseURI}}} + +{{description}} + +== Description == + +This is the long description. No limit, and you can use Markdown (as well as in the following sections). + +For backwards compatibility, if this section is missing, the full length of the short description will be used, and +Markdown parsed. + +== Installation == + +This section describes how to install the plugin and get it working. + +e.g. + +1. Upload the plugin files to the `/wp-content/plugins/{{slug}}` directory, or install the plugin through the WordPress plugins screen directly. +1. Activate the plugin through the 'Plugins' screen in WordPress + + +== Frequently Asked Questions == + += A question that someone might have = + +An answer to that question. + += What about foo bar? = + +Answer to foo bar dilemma. + +== Screenshots == + +1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from +the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets +directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` +(or jpg, jpeg, gif). +2. This is the second screen shot + +== Changelog == + += {{version}} = +* Release + +== Arbitrary section == + +You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated +plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or +"installation." Arbitrary sections will be shown below the built-in sections outlined above.