wp-lemon-create 2.0.6 → 2.1.1
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/lib/index.js +11 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -25,6 +25,9 @@ let is_spinup = false;
|
|
|
25
25
|
let skipGit = false;
|
|
26
26
|
let branch = false;
|
|
27
27
|
let version_constraints = '*';
|
|
28
|
+
let package_manager = false;
|
|
29
|
+
const hasYarn = shell.which('yarn');
|
|
30
|
+
const hasNpm = shell.which('npm');
|
|
28
31
|
|
|
29
32
|
program
|
|
30
33
|
.name(commandName)
|
|
@@ -56,18 +59,17 @@ program
|
|
|
56
59
|
|
|
57
60
|
if (!shell.which('composer')) {
|
|
58
61
|
shell.echo('Sorry, this script requires composer');
|
|
59
|
-
shell.exit(1);
|
|
60
62
|
}
|
|
61
63
|
{
|
|
62
64
|
shell.echo('✔️ Composer installed');
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
if (!
|
|
66
|
-
shell.echo('
|
|
67
|
+
if (!hasYarn && !hasNpm) {
|
|
68
|
+
shell.echo('Yarn and npm are both missing. Please install one of them.');
|
|
67
69
|
shell.exit(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
} else {
|
|
71
|
+
shell.echo(`✔️ ${hasYarn ? 'Yarn' : 'Npm'} installed`);
|
|
72
|
+
package_manager = hasYarn ? 'yarn' : 'npm';
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
if (!shell.which('wp')) {
|
|
@@ -258,11 +260,11 @@ program
|
|
|
258
260
|
* Installing node modules in child theme and parent theme.
|
|
259
261
|
*/
|
|
260
262
|
shell.echo('⏳ Installing npm dependencies. This may take a while.\n');
|
|
261
|
-
if (shell.exec(
|
|
262
|
-
shell.echo(
|
|
263
|
+
if (shell.exec(`${package_manager} run bootstrap-project`, { silent: true }).code !== 0) {
|
|
264
|
+
shell.echo(`Error: ${package_manager} run bootstrap-project failed. Please install node dependencies manually by running ${package_manager} run bootstrap-project in your child theme.`);
|
|
263
265
|
} else {
|
|
264
266
|
shell.echo('✔️ Installing npm dependencies succesful.');
|
|
265
|
-
shell.exec(
|
|
267
|
+
shell.exec(`${package_manager} run dev`, { silent: true });
|
|
266
268
|
shell.echo('✔️ First webpack build succesful.\n');
|
|
267
269
|
}
|
|
268
270
|
|