wp-lemon-create 2.0.5 → 2.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.
Files changed (2) hide show
  1. package/lib/index.js +22 -21
  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 has_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,16 @@ 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 or npm not found.');
67
69
  shell.exit(1);
68
- }
69
- {
70
- shell.echo('✔️ Yarn installed');
70
+ } else {
71
+ shell.echo(`✔️ ${hasYarn ? 'Yarn' : 'Npm'} installed`);
71
72
  }
72
73
 
73
74
  if (!shell.which('wp')) {
@@ -276,21 +277,6 @@ program
276
277
  */
277
278
  shell.cd('../../../../');
278
279
 
279
- shell.exec(`touch workspace.code-workspace`);
280
- shell.exec(`echo '{
281
- "folders": [
282
- {
283
- "name": "root",
284
- "path": "."
285
- },
286
- {
287
- "name": "${project_name}",
288
- "path": "web/app/themes/${project_name}"
289
- }
290
- ]
291
- }' >> workspace.code-workspace`);
292
- shell.echo('✔️ .code-workspace file created.\n');
293
-
294
280
 
295
281
  /**
296
282
  * reload host file so browsersync works without a restart.
@@ -320,6 +306,21 @@ program
320
306
  if (project_type == 'new') {
321
307
  shell.echo('⏳ Installing WordPress.\n');
322
308
 
309
+ shell.exec(`touch workspace.code-workspace`);
310
+ shell.exec(`echo '{
311
+ "folders": [
312
+ {
313
+ "name": "root",
314
+ "path": "."
315
+ },
316
+ {
317
+ "name": "${project_name}",
318
+ "path": "web/app/themes/${project_name}"
319
+ }
320
+ ]
321
+ }' >> workspace.code-workspace`);
322
+ shell.echo('✔️ .code-workspace file created.\n');
323
+
323
324
  if (shell.exec(`wp db create`, { silent: true }).code !== 0) {
324
325
  prompt('Database creation failed. Please make sure your server is running. Press enter to continue.');
325
326
  createDB();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-lemon-create",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Bootstrap your wp-lemon project",
5
5
  "main": "index.js",
6
6
  "author": "Studio Lemon <erik@studiolemon.nl>",