wp-lemon-create 1.1.2 → 1.2.2

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 +26 -8
  2. package/package.json +3 -6
package/lib/index.js CHANGED
@@ -5,7 +5,6 @@ const { program } = require('commander');
5
5
  var shell = require('shelljs');
6
6
  const commandName = 'wp-lemon-create';
7
7
  const { engines, version } = require('../package.json');
8
- var async = require('async');
9
8
  const prompt = require('prompt-sync')();
10
9
 
11
10
  program
@@ -27,6 +26,9 @@ program
27
26
  var DBuser = '';
28
27
  var DBpassword = '';
29
28
  var is_wsl = false;
29
+ var plugins_searchwp = false;
30
+ var plugins_wpml = false;
31
+ var is_spinup = false;
30
32
 
31
33
  console.log(`Starting $${commandName} @${version}`);
32
34
 
@@ -82,6 +84,9 @@ program
82
84
  username = prompt('WordPress username:');
83
85
  email = prompt('WordPress email:');
84
86
  password = prompt('WordPress password:');
87
+ plugins_searchwp = prompt('Add plugin: SearchWP? yes/no (defaults to no)', 'no');
88
+ plugins_wpml = prompt('Add plugin: WPML? yes/no (defaults to no)', 'no');
89
+ is_spinup = prompt('Does the project run on Spinup-wp? (defaults to no)', 'no');
85
90
  } else if (projecttype == 'existing') {
86
91
  project_repository = prompt('Existing repository link in ssh format:');
87
92
  } else {
@@ -92,9 +97,6 @@ program
92
97
  DBuser = prompt('Database user. Defaults to root:', 'root');
93
98
  DBpassword = prompt('Database password. Defaults to root:', 'root');
94
99
 
95
- const plugins_searchwp = prompt('Add plugin: SearchWP? yes/no (defaults to no)', 'no');
96
- const plugins_wpml = prompt('Add plugin: WPML? yes/no (defaults to no)', 'no');
97
-
98
100
  shell.echo('\n');
99
101
  shell.echo(`🎉 Setting up ${projecttype} wp-lemon project with url ${projectname + tld}\n`);
100
102
 
@@ -125,8 +127,15 @@ program
125
127
  * Add composer packages
126
128
  */
127
129
  shell.echo('Installing plugins, master theme and packages. This may take a while\n');
128
- shell.exec('composer require highground/bulldozer log1x/acf-editor-palette satispress/advanced-custom-fields-pro satispress/fluentformpro satispress/lemon-blocks satispress/quartermaster satispress/wp-lemon satispress/wp-migrate-db-pro satispress/wp-migrate-db-pro-media-files satispress/wp-rocket timber/timber wpackagist-plugin/cookie-law-info wpackagist-plugin/fluentform wpackagist-plugin/seo-by-rank-math wpackagist-plugin/simple-custom-post-order wpackagist-plugin/worker wpackagist-plugin/wp-mail-smtp --with-all-dependencies', { silent: true });
129
-
130
+ shell.exec('composer require highground/bulldozer log1x/acf-editor-palette satispress/advanced-custom-fields-pro satispress/fluentformpro satispress/lemon-blocks satispress/quartermaster satispress/wp-lemon satispress/wp-migrate-db-pro satispress/wp-migrate-db-pro-media-files wpackagist-plugin/limit-login-attempts-reloaded timber/timber wpackagist-plugin/cookie-law-info wpackagist-plugin/fluentform wpackagist-plugin/seo-by-rank-math wpackagist-plugin/simple-custom-post-order wpackagist-plugin/worker wpackagist-plugin/wp-mail-smtp --with-all-dependencies', { silent: true });
131
+ shell.exec('composer remove squizlabs/php_codesnifferes roave/security-advisories', { silent: true });
132
+
133
+ if (is_spinup == 'yes') {
134
+ shell.exec('composer require wpackagist-plugin/spinupwp', { silent: true });
135
+ } else {
136
+ shell.exec('composer require satispress/wp-rocket', { silent: true });
137
+ }
138
+
130
139
  if(plugins_searchwp == 'yes'){
131
140
  shell.exec('composer require satispress/searchwp wpackagist-plugin/searchwp-live-ajax-search', { silent: true });
132
141
  }
@@ -231,7 +240,7 @@ program
231
240
  shell.exec(`wp dotenv salts generate`, { silent: true });
232
241
  shell.echo('✔️ Generating .env succesful.\n');
233
242
 
234
- if (projecttype == 'new' && is_wsl) {
243
+ if (is_wsl) {
235
244
  shell.echo('Uncommenting #DB_host and changing to 127.0.0.1 for allowing connection in WSL\n');
236
245
  shell.sed('-i', '# DB_HOST', 'DB_HOST', '.env');
237
246
  shell.sed('-i', 'localhost', '127.0.0.1', '.env');
@@ -254,6 +263,7 @@ program
254
263
  shell.echo('✔️ Installing WordPress succesful.');
255
264
  shell.exec(`wp rewrite structure '/%postname%/'`, { silent: true });
256
265
  shell.echo('✔️ Setting permalink structure.');
266
+
257
267
  shell.exec(`wp theme activate ${projectname}`, { silent: true });
258
268
  shell.echo(`✔️ Activating child theme ${projectname}`);
259
269
 
@@ -274,10 +284,18 @@ program
274
284
  shell.exec(`wp menu location assign Hoofdmenu primary_navigation`, { silent: true });
275
285
  shell.echo('✔️ Created primary menu.');
276
286
 
287
+ } else {
277
288
  // Flush rewrite rules
278
- shell.exec(`wp rewrite flush`, { silent: true });
289
+ shell.exec(`wp rewrite flush`);
290
+ shell.echo('Creating Database.\n');
279
291
 
292
+ if (shell.exec(`wp db create`, { silent: true }).code !== 0) {
293
+ shell.echo('Database creation failed.');
294
+ } else {
295
+ shell.echo('✔️ Database created, make sure to import database and uploads.');
296
+ }
280
297
  }
298
+
281
299
  shell.echo(`\n`);
282
300
  shell.echo(`🎉 All done! Happy developing!`);
283
301
  shell.echo(`🌐 You can now navigate to http://${projectname + tld}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-lemon-create",
3
- "version": "1.1.2",
3
+ "version": "1.2.2",
4
4
  "description": "Bootstrap your wp-lemon project",
5
5
  "main": "index.js",
6
6
  "author": "Erik van der bas",
@@ -9,11 +9,8 @@
9
9
  "wp-lemon-create": "./index.js"
10
10
  },
11
11
  "dependencies": {
12
- "async": "^3.2.2",
13
- "check-node-version": "^4.1.0",
14
- "commander": "^8.3.0",
12
+ "commander": "^9.0.0",
15
13
  "prompt-sync": "^4.2.0",
16
- "shelljs": "^0.8.4",
17
- "wrappy": "^1.0.2"
14
+ "shelljs": "^0.8.5"
18
15
  }
19
16
  }