@wordpress/create-block 2.8.0 → 2.9.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/CHANGELOG.md +7 -0
- package/README.md +15 -8
- package/lib/init-package-json.js +15 -8
- package/lib/scaffold.js +3 -0
- package/lib/templates.js +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 2.9.0 (2022-02-10)
|
|
6
|
+
|
|
7
|
+
### New Features
|
|
8
|
+
|
|
9
|
+
- Automatically add a `"env": "wp-env"` entry to scripts when the `--wp-env` is passed or when a template sets `wpEnv` to `true` ([#38530](https://github.com/WordPress/gutenberg/pull/38530)).
|
|
10
|
+
- Introduce the `customScripts` property to allow templates to define additional scripts ([#38535](https://github.com/WordPress/gutenberg/pull/38535)).
|
|
11
|
+
|
|
5
12
|
## 2.8.0 (2022-01-27)
|
|
6
13
|
|
|
7
14
|
### New Features
|
package/README.md
CHANGED
|
@@ -87,37 +87,37 @@ When bootstrapped with the `esnext` template (or any external template with `wpS
|
|
|
87
87
|
$ npm start
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Starts the build for development. [Learn more](/packages/scripts#start).
|
|
90
|
+
Starts the build for development. [Learn more](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#start).
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
$ npm run build
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
Builds the code for production. [Learn more](/packages/scripts#build).
|
|
96
|
+
Builds the code for production. [Learn more](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#build).
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
$ npm run format
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
Formats files. [Learn more](/packages/scripts#format).
|
|
102
|
+
Formats files. [Learn more](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#format).
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
105
|
$ npm run lint:css
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
Lints CSS files. [Learn more](/packages/scripts#lint-style).
|
|
108
|
+
Lints CSS files. [Learn more](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#lint-style).
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
111
|
$ npm run lint:js
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
Lints JavaScript files. [Learn more](/packages/scripts#lint-js).
|
|
114
|
+
Lints JavaScript files. [Learn more](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#lint-js).
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
117
|
$ npm run packages-update
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
Updates WordPress packages to the latest version. [Learn more](/packages/scripts#packages-update).
|
|
120
|
+
Updates WordPress packages to the latest version. [Learn more](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#packages-update).
|
|
121
121
|
|
|
122
122
|
_Note: You don’t need to install or configure tools like [webpack](https://webpack.js.org), [Babel](https://babeljs.io) or [ESLint](https://eslint.org) yourself. They are preconfigured and hidden so that you can focus on coding._
|
|
123
123
|
|
|
@@ -206,11 +206,18 @@ The following configurable variables are used with the template files. Template
|
|
|
206
206
|
- `licenseURI` (default: `'https://www.gnu.org/licenses/gpl-2.0.html'`)
|
|
207
207
|
- `version` (default: `'0.1.0'`)
|
|
208
208
|
- `wpScripts` (default: `true`)
|
|
209
|
-
- `wpEnv` (default: `false`)
|
|
209
|
+
- `wpEnv` (default: `false`) - enables integration with the `@wordpress/env` package and adds the `env` command to the package.json.
|
|
210
210
|
- `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.
|
|
211
|
+
`customScripts` (default: {}) - the list of custom scripts to add to `package.json`. It also allows overriding default scripts.
|
|
211
212
|
- `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.
|
|
212
213
|
- `editorScript` (default: `'file:./build/index.js'`)
|
|
213
214
|
- `editorStyle` (default: `'file:./build/index.css'`)
|
|
214
215
|
- `style` (default: `'file:./build/style-index.css'`)
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
## Contributing to this package
|
|
218
|
+
|
|
219
|
+
This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
|
|
220
|
+
|
|
221
|
+
To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
|
|
222
|
+
|
|
223
|
+
<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
package/lib/init-package-json.js
CHANGED
|
@@ -18,13 +18,16 @@ module.exports = async ( {
|
|
|
18
18
|
license,
|
|
19
19
|
slug,
|
|
20
20
|
version,
|
|
21
|
+
wpEnv,
|
|
21
22
|
wpScripts,
|
|
22
23
|
npmDependencies,
|
|
24
|
+
customScripts,
|
|
23
25
|
} ) => {
|
|
24
26
|
const cwd = join( process.cwd(), slug );
|
|
25
27
|
|
|
26
28
|
info( '' );
|
|
27
29
|
info( 'Creating a "package.json" file.' );
|
|
30
|
+
|
|
28
31
|
await writePkg(
|
|
29
32
|
cwd,
|
|
30
33
|
omitBy(
|
|
@@ -35,14 +38,18 @@ module.exports = async ( {
|
|
|
35
38
|
author,
|
|
36
39
|
license,
|
|
37
40
|
main: wpScripts && 'build/index.js',
|
|
38
|
-
scripts:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
scripts: {
|
|
42
|
+
...( wpScripts && {
|
|
43
|
+
build: 'wp-scripts build',
|
|
44
|
+
format: 'wp-scripts format',
|
|
45
|
+
'lint:css': 'wp-scripts lint-style',
|
|
46
|
+
'lint:js': 'wp-scripts lint-js',
|
|
47
|
+
'packages-update': 'wp-scripts packages-update',
|
|
48
|
+
'plugin-zip': 'wp-scripts plugin-zip',
|
|
49
|
+
start: 'wp-scripts start',
|
|
50
|
+
} ),
|
|
51
|
+
...( wpEnv && { env: 'wp-env' } ),
|
|
52
|
+
...customScripts,
|
|
46
53
|
},
|
|
47
54
|
},
|
|
48
55
|
isEmpty
|
package/lib/scaffold.js
CHANGED
|
@@ -33,6 +33,7 @@ module.exports = async (
|
|
|
33
33
|
wpScripts,
|
|
34
34
|
wpEnv,
|
|
35
35
|
npmDependencies,
|
|
36
|
+
customScripts,
|
|
36
37
|
folderName,
|
|
37
38
|
editorScript,
|
|
38
39
|
editorStyle,
|
|
@@ -65,7 +66,9 @@ module.exports = async (
|
|
|
65
66
|
licenseURI,
|
|
66
67
|
textdomain: slug,
|
|
67
68
|
wpScripts,
|
|
69
|
+
wpEnv,
|
|
68
70
|
npmDependencies,
|
|
71
|
+
customScripts,
|
|
69
72
|
folderName,
|
|
70
73
|
editorScript,
|
|
71
74
|
editorStyle,
|
package/lib/templates.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/create-block",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"wp-create-block": "./index.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@wordpress/lazy-import": "^1.4.
|
|
34
|
+
"@wordpress/lazy-import": "^1.4.1",
|
|
35
35
|
"chalk": "^4.0.0",
|
|
36
36
|
"check-node-version": "^4.1.0",
|
|
37
37
|
"commander": "^4.1.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "2e4922861e49f5a090f9dc52056165092cfba163"
|
|
52
52
|
}
|