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.
Files changed (2) hide show
  1. package/lib/index.js +11 -9
  2. 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 (!shell.which('yarn')) {
66
- shell.echo('Sorry, this script requires yarn');
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
- shell.echo('✔️ Yarn installed');
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(`yarn run bootstrap-project`, { silent: true }).code !== 0) {
262
- shell.echo('Error: yarn run bootstrap-project failed. Please install node dependencies manually by running yarn run bootstrap-project in your child theme.');
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(`yarn run dev`, { silent: true });
267
+ shell.exec(`${package_manager} run dev`, { silent: true });
266
268
  shell.echo('✔️ First webpack build succesful.\n');
267
269
  }
268
270
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-lemon-create",
3
- "version": "2.0.6",
3
+ "version": "2.1.1",
4
4
  "description": "Bootstrap your wp-lemon project",
5
5
  "main": "index.js",
6
6
  "author": "Studio Lemon <erik@studiolemon.nl>",