@wordpress/create-block 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,8 @@ _(requires `node` version `14.0.0` or above, and `npm` version `6.14.4` or above
24
24
 
25
25
  It creates a WordPress plugin that you need to [install manually](https://wordpress.org/support/article/managing-plugins/#manual-plugin-installation).
26
26
 
27
+ [Watch a video introduction to create-block on Learn.wordpress.org](https://learn.wordpress.org/tutorial/using-the-create-block-tool/)
28
+
27
29
  ## Usage
28
30
 
29
31
  The following command generates a project with PHP, JS, and CSS code for registering a block with a WordPress plugin.
@@ -87,7 +89,6 @@ $ npx @wordpress/create-block --help
87
89
 
88
90
  5. No plugin mode – it is also possible to scaffold only block files into the current directory.
89
91
 
90
-
91
92
  ```bash
92
93
  $ npx @wordpress/create-block --no-plugin
93
94
  ```
@@ -144,107 +145,7 @@ _Note: You don’t need to install or configure tools like [webpack](https://web
144
145
 
145
146
  ## External Project Templates
146
147
 
147
- Are you looking for a way to share your project configuration? Creating an external project template hosted on npm or located in a local directory is possible. These npm packages can provide custom `.mustache` files that replace default files included in the tool for the WordPress plugin or/and the block. It's also possible to override default configuration values used during the scaffolding process.
148
-
149
- ### Project Template Configuration
150
-
151
- Providing the main file (`index.js` by default) for the package that returns a configuration object is mandatory. Several options allow customizing the scaffolding process.
152
-
153
- #### `pluginTemplatesPath`
154
-
155
- This optional field allows overriding file templates related to **the WordPress plugin shell**. The path points to a location with template files ending with the `.mustache` extension (nested folders are also supported). When not set, the tool uses its own set of templates.
156
-
157
- _Example:_
158
-
159
- ```js
160
- const { join } = require( 'path' );
161
-
162
- module.exports = {
163
- pluginTemplatesPath: join( __dirname, 'plugin-templates' ),
164
- };
165
- ```
166
-
167
- #### `blockTemplatesPath`
168
-
169
- This optional field allows overriding file templates related to **the individual block**. The path points to a location with template files ending with the `.mustache` extension (nested folders are also supported). When not set, the tool uses its own set of templates.
170
-
171
- _Example:_
172
-
173
- ```js
174
- const { join } = require( 'path' );
175
-
176
- module.exports = {
177
- blockTemplatesPath: join( __dirname, 'block-templates' ),
178
- };
179
- ```
180
-
181
- #### `assetsPath`
182
-
183
- This setting is useful when your template scaffolds a WordPress plugin that uses static assets like images or fonts, which should not be processed. It provides the path pointing to the location where assets are located. They will be copied to the `assets` subfolder in the generated plugin.
184
-
185
- _Example:_
186
-
187
- ```js
188
- const { join } = require( 'path' );
189
-
190
- module.exports = {
191
- assetsPath: join( __dirname, 'plugin-assets' ),
192
- };
193
- ```
194
-
195
- #### `defaultValues`
196
-
197
- It is possible to override the default template configuration using the `defaultValues` field.
198
-
199
- _Example:_
200
-
201
- ```js
202
- module.exports = {
203
- defaultValues: {
204
- slug: 'my-fantastic-block',
205
- title: 'My fantastic block',
206
- dashicon: 'palmtree',
207
- version: '1.2.3',
208
- },
209
- };
210
- ```
211
-
212
- The following configurable variables are used with the template files. Template authors can change default values to use when users don't provide their data.
213
-
214
- **Project**:
215
-
216
- - `wpScripts` (default: `true`) – enables integration with the `@wordpress/scripts` package and adds common scripts to the `package.json`.
217
- - `wpEnv` (default: `false`) – enables integration with the `@wordpress/env` package and adds the `env` script to the `package.json`.
218
- - `customScripts` (default: {}) – the list of custom scripts to add to `package.json` . It also allows overriding default scripts.
219
- - `npmDependencies` (default: `[]`) – the list of remote npm packages to be installed in the project with [`npm install`](https://docs.npmjs.com/cli/v8/commands/npm-install) when `wpScripts` is enabled.
220
- - `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.
221
-
222
- **Plugin header fields** ([learn more](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/)):
223
-
224
- - `pluginURI` (no default) – the home page of the plugin.
225
- - `version` (default: `'0.1.0'`) – the current version number of the plugin.
226
- - `author` (default: `'The WordPress Contributors'`) – the name of the plugin author(s).
227
- - `license` (default: `'GPL-2.0-or-later'`) – the short name of the plugin’s license.
228
- - `licenseURI` (default: `'https://www.gnu.org/licenses/gpl-2.0.html'`) – a link to the full text of the license.
229
- - `domainPath` (no default) – a custom domain path for the translations ([more info](https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#domain-path)).
230
- - `updateURI:` (no default) – a custom update URI for the plugin ([related dev note](https://make.wordpress.org/core/2021/06/29/introducing-update-uri-plugin-header-in-wordpress-5-8/)).
231
-
232
- **Block metadata** ([learn more](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/)):
233
-
234
- - `folderName` (default: `.`) – the location for the `block.json` file and other optional block files generated from block templates included in the folder set with the `blockTemplatesPath` setting.
235
- - `$schema` (default: `https://schemas.wp.org/trunk/block.json`) – the schema URL used for block validation.
236
- - `apiVersion` (default: `2`) – the block API version ([related dev note](https://make.wordpress.org/core/2020/11/18/block-api-version-2/)).
237
- - `slug` (no default) – the block slug used for identification in the block name.
238
- - `namespace` (default: `'create-block'`) – the internal namespace for the block name.
239
- - `title` (no default) – a display title for your block.
240
- - `description` (no default) – a short description for your block.
241
- - `dashicon` (no default) – an icon property thats makes it easier to identify a block ([available values](https://developer.wordpress.org/resource/dashicons/)).
242
- - `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`.
243
- - `attributes` (no default) – block attributes ([more details](https://developer.wordpress.org/block-editor/developers/block-api/block-attributes/)).
244
- - `supports` (no default) – optional block extended support features ([more details](https://developer.wordpress.org/block-editor/developers/block-api/block-supports/).
245
- - `editorScript` (default: `'file:./index.js'`) – an editor script definition.
246
- - `editorStyle` (default: `'file:./index.css'`) – an editor style definition.
247
- - `style` (default: `'file:./style-index.css'`) – a frontend and editor style definition.
148
+ [Click here](https://github.com/WordPress/gutenberg/tree/HEAD/packages/create-block/docs/external-template.md) for information on External Project Templates
248
149
 
249
150
  ## Contributing to this package
250
151
 
package/lib/scaffold.js CHANGED
@@ -144,7 +144,7 @@ module.exports = async (
144
144
  success(
145
145
  plugin
146
146
  ? `Done: WordPress plugin ${ title } bootstrapped in the ${ slug } directory.`
147
- : `Done: Block "${ title }" bootstrapped in the ${ slug }directory.`
147
+ : `Done: Block "${ title }" bootstrapped in the ${ slug } directory.`
148
148
  );
149
149
 
150
150
  if ( plugin && wpScripts ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/create-block",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "171b87c7465b93e685e081c5f57f153507363c95"
51
+ "gitHead": "0d732d4b184adcb28cc83087603e81b764390d4b"
52
52
  }