@wordpress/create-block 3.5.1 → 3.6.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 +6 -0
- package/lib/check-system-requirements.js +31 -4
- package/lib/templates.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
+
const inquirer = require( 'inquirer' );
|
|
4
5
|
const checkSync = require( 'check-node-version' );
|
|
6
|
+
const tools = require( 'check-node-version/tools' );
|
|
5
7
|
const { forEach } = require( 'lodash' );
|
|
6
8
|
const { promisify } = require( 'util' );
|
|
7
9
|
|
|
@@ -14,20 +16,45 @@ const check = promisify( checkSync );
|
|
|
14
16
|
|
|
15
17
|
async function checkSystemRequirements( engines ) {
|
|
16
18
|
const result = await check( engines );
|
|
19
|
+
|
|
17
20
|
if ( ! result.isSatisfied ) {
|
|
18
21
|
log.error( 'Minimum system requirements not met!' );
|
|
19
22
|
log.info( '' );
|
|
23
|
+
|
|
20
24
|
forEach( result.versions, ( { isSatisfied, wanted }, name ) => {
|
|
21
25
|
if ( ! isSatisfied ) {
|
|
22
26
|
log.error(
|
|
23
27
|
`Error: Wanted ${ name } version ${ wanted.raw } (${ wanted.range })`
|
|
24
28
|
);
|
|
25
|
-
log.info(
|
|
26
|
-
check.PROGRAMS[ name ].getInstallInstructions( wanted.raw )
|
|
27
|
-
);
|
|
28
29
|
}
|
|
29
30
|
} );
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
log.info( '' );
|
|
33
|
+
log.error( 'The program may not complete correctly if you continue.' );
|
|
34
|
+
log.info( '' );
|
|
35
|
+
|
|
36
|
+
const { yesContinue } = await inquirer.prompt( [
|
|
37
|
+
{
|
|
38
|
+
type: 'confirm',
|
|
39
|
+
name: 'yesContinue',
|
|
40
|
+
message: 'Are you sure you want to continue anyway?',
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
] );
|
|
44
|
+
|
|
45
|
+
if ( ! yesContinue ) {
|
|
46
|
+
log.error( 'Cancelled.' );
|
|
47
|
+
log.info( '' );
|
|
48
|
+
|
|
49
|
+
forEach( result.versions, ( { isSatisfied, wanted }, name ) => {
|
|
50
|
+
if ( ! isSatisfied ) {
|
|
51
|
+
log.info(
|
|
52
|
+
tools[ name ].getInstallInstructions( wanted.raw )
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
} );
|
|
56
|
+
process.exit( 1 );
|
|
57
|
+
}
|
|
31
58
|
}
|
|
32
59
|
}
|
|
33
60
|
|
package/lib/templates.js
CHANGED
|
@@ -6,7 +6,7 @@ const glob = require( 'fast-glob' );
|
|
|
6
6
|
const { resolve } = require( 'path' );
|
|
7
7
|
const { existsSync } = require( 'fs' );
|
|
8
8
|
const { mkdtemp, readFile } = require( 'fs' ).promises;
|
|
9
|
-
const { fromPairs
|
|
9
|
+
const { fromPairs } = require( 'lodash' );
|
|
10
10
|
const npmPackageArg = require( 'npm-package-arg' );
|
|
11
11
|
const { tmpdir } = require( 'os' );
|
|
12
12
|
const { join } = require( 'path' );
|
|
@@ -103,7 +103,7 @@ const configToTemplate = async ( {
|
|
|
103
103
|
assetsPath,
|
|
104
104
|
...deprecated
|
|
105
105
|
} ) => {
|
|
106
|
-
if (
|
|
106
|
+
if ( defaultValues === null || typeof defaultValues !== 'object' ) {
|
|
107
107
|
throw new CLIError( 'Template found but invalid definition provided.' );
|
|
108
108
|
}
|
|
109
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/create-block",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.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": "
|
|
51
|
+
"gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
|
|
52
52
|
}
|