wp-lemon-create 1.7.2 → 1.9.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/lib/index.js +82 -62
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -49,7 +49,7 @@ program
|
|
|
49
49
|
shell.exit(1);
|
|
50
50
|
}
|
|
51
51
|
{
|
|
52
|
-
shell.echo('✔️
|
|
52
|
+
shell.echo('✔️ Git installed');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (!shell.which('composer')) {
|
|
@@ -57,7 +57,7 @@ program
|
|
|
57
57
|
shell.exit(1);
|
|
58
58
|
}
|
|
59
59
|
{
|
|
60
|
-
shell.echo('✔️
|
|
60
|
+
shell.echo('✔️ Composer installed');
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (!shell.which('yarn')) {
|
|
@@ -65,7 +65,7 @@ program
|
|
|
65
65
|
shell.exit(1);
|
|
66
66
|
}
|
|
67
67
|
{
|
|
68
|
-
shell.echo('✔️
|
|
68
|
+
shell.echo('✔️ Yarn installed');
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (!shell.which('wp')) {
|
|
@@ -73,7 +73,7 @@ program
|
|
|
73
73
|
shell.exit(1);
|
|
74
74
|
}
|
|
75
75
|
{
|
|
76
|
-
shell.echo('✔️
|
|
76
|
+
shell.echo('✔️ wp-cli installed');
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (shell.exec('wp dotenv --help', { silent: true }).code !== 0) {
|
|
@@ -81,7 +81,7 @@ program
|
|
|
81
81
|
shell.exit(1);
|
|
82
82
|
}
|
|
83
83
|
{
|
|
84
|
-
shell.echo('✔️
|
|
84
|
+
shell.echo('✔️ wp-cli dotenv package installed');
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
if (shell.exec('grep -q Microsoft /proc/version', { silent: true }).code == 0) {
|
|
@@ -127,13 +127,13 @@ program
|
|
|
127
127
|
shell.echo(`🎉 Setting up ${project_type} wp-lemon project with url ${project_url} \n`);
|
|
128
128
|
|
|
129
129
|
if (project_type == 'new') {
|
|
130
|
-
shell.echo('⏳
|
|
130
|
+
shell.echo('⏳ Downloading Bedrock. This may take a minute or so.\n');
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* cloning bedrock and removing unneeded dirs
|
|
134
134
|
*/
|
|
135
135
|
shell.exec('composer create-project roots/bedrock .', { silent: true });
|
|
136
|
-
shell.echo('✔️
|
|
136
|
+
shell.echo('✔️ Bedrock installed.\n');
|
|
137
137
|
shell.rm('-rf', 'CHANGELOG.MD');
|
|
138
138
|
shell.rm('-rf', 'LICENSE.MD');
|
|
139
139
|
shell.rm('-rf', 'composer.lock');
|
|
@@ -151,10 +151,10 @@ program
|
|
|
151
151
|
/**
|
|
152
152
|
* Add composer packages
|
|
153
153
|
*/
|
|
154
|
-
shell.echo('⏳
|
|
154
|
+
shell.echo('⏳ Installing plugins, parent theme and packages. This may take a while\n');
|
|
155
155
|
|
|
156
156
|
shell.exec('composer require composer/installers ~1.0', { silent: true });
|
|
157
|
-
|
|
157
|
+
shell.exec('"roots/wordpress', { silent: true });
|
|
158
158
|
// Add libraries and parent theme
|
|
159
159
|
shell.exec('composer require highground/bulldozer giggsey/libphonenumber-for-php timber/timber satispress/wp-lemon --with-all-dependencies', { silent: true });
|
|
160
160
|
|
|
@@ -187,7 +187,7 @@ program
|
|
|
187
187
|
if (!skipGit) {
|
|
188
188
|
shell.exec('git init', { silent: true });
|
|
189
189
|
shell.exec(`git remote add origin ${project_repository} `);
|
|
190
|
-
shell.echo(`✔️
|
|
190
|
+
shell.echo(`✔️ Setting up empty local git repository and adding ${project_repository} as remote.\n`);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
/**
|
|
@@ -201,14 +201,14 @@ program
|
|
|
201
201
|
/**
|
|
202
202
|
* Downloading child theme
|
|
203
203
|
*/
|
|
204
|
-
shell.echo('⏳
|
|
204
|
+
shell.echo('⏳ Downloading child theme.\n');
|
|
205
205
|
shell.cd('web/app/themes/');
|
|
206
206
|
|
|
207
207
|
shell.exec(`composer create-project --repository https://packagist.studiolemon.nl/satispress/ satispress/wp-lemon-child ${child_theme_folder} --no-dev`, { silent: true });
|
|
208
208
|
|
|
209
209
|
shell.cd(child_theme_folder);
|
|
210
210
|
shell.rm('-rf', '.github');
|
|
211
|
-
shell.echo('✔️
|
|
211
|
+
shell.echo('✔️ Downloading child theme succesful.');
|
|
212
212
|
} else {
|
|
213
213
|
/**
|
|
214
214
|
* Task: existing project.
|
|
@@ -239,18 +239,18 @@ program
|
|
|
239
239
|
shell.sed('-i', 'http://wplemon.local', `http://${project_url}`, 'resources/assets/config.json');
|
|
240
240
|
shell.sed('-i', 'wp-lemon-child', child_theme_folder, 'resources/assets/config.json');
|
|
241
241
|
shell.sed('-i', 'wp-lemon child', project_name, 'style.css');
|
|
242
|
-
shell.echo('✔️
|
|
242
|
+
shell.echo('✔️ Configuring child theme succesful.\n');
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
245
|
* Installing node modules in child theme and parent theme.
|
|
246
246
|
*/
|
|
247
|
-
shell.echo('⏳
|
|
247
|
+
shell.echo('⏳ Installing npm dependencies. This may take a while.\n');
|
|
248
248
|
if (shell.exec(`yarn run bootstrap-project`, { silent: true }).code !== 0) {
|
|
249
249
|
shell.echo('Error: yarn run bootstrap-project failed. Please install node dependencies manually by running yarn run bootstrap-project in your child theme.');
|
|
250
250
|
} else {
|
|
251
|
-
shell.echo('✔️
|
|
251
|
+
shell.echo('✔️ Installing npm dependencies succesful.');
|
|
252
252
|
shell.exec(`yarn run dev`, { silent: true });
|
|
253
|
-
shell.echo('✔️
|
|
253
|
+
shell.echo('✔️ First webpack build succesful.\n');
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/**
|
|
@@ -263,7 +263,7 @@ program
|
|
|
263
263
|
*/
|
|
264
264
|
shell.cd('../../../../');
|
|
265
265
|
|
|
266
|
-
shell.exec(`touch
|
|
266
|
+
shell.exec(`touch workspace.code-workspace`);
|
|
267
267
|
shell.exec(`echo '{
|
|
268
268
|
"folders": [
|
|
269
269
|
{
|
|
@@ -275,8 +275,8 @@ program
|
|
|
275
275
|
"path": "web/app/themes/${project_name}"
|
|
276
276
|
}
|
|
277
277
|
]
|
|
278
|
-
}' >>
|
|
279
|
-
shell.echo('✔️
|
|
278
|
+
}' >> workspace.code-workspace`);
|
|
279
|
+
shell.echo('✔️ .code-workspace file created.\n');
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
/**
|
|
@@ -296,7 +296,7 @@ program
|
|
|
296
296
|
shell.exec(`wp dotenv set DB_PASSWORD ${DBpassword}`, { silent: true });
|
|
297
297
|
shell.exec(`wp dotenv set WP_HOME http://${project_url}`, { silent: true });
|
|
298
298
|
shell.exec(`wp dotenv salts generate`, { silent: true });
|
|
299
|
-
shell.echo('✔️
|
|
299
|
+
shell.echo('✔️ Generating .env successful.\n');
|
|
300
300
|
|
|
301
301
|
if (is_wsl) {
|
|
302
302
|
shell.echo('Uncommenting #DB_host and changing to 127.0.0.1 for allowing connection in WSL\n');
|
|
@@ -308,52 +308,22 @@ program
|
|
|
308
308
|
shell.echo('⏳ Installing WordPress.\n');
|
|
309
309
|
|
|
310
310
|
if (shell.exec(`wp db create`, { silent: true }).code !== 0) {
|
|
311
|
-
|
|
311
|
+
prompt('Database creation failed. Please make sure your server is running. Press enter to continue.');
|
|
312
|
+
createDB(child_theme_folder);
|
|
312
313
|
} else {
|
|
313
|
-
shell.echo('✔️
|
|
314
|
+
shell.echo('✔️ Database created');
|
|
315
|
+
setupWordPress(child_theme_folder);
|
|
314
316
|
}
|
|
315
317
|
|
|
316
|
-
if (
|
|
317
|
-
shell.exec(
|
|
318
|
-
`wp core install --skip-email --url="http://${project_url}" --title="${project_name}" --admin_user="${username}" --admin_password="${password}" --admin_email="${email}"`,
|
|
319
|
-
{ silent: true },
|
|
320
|
-
).code !== 0
|
|
321
|
-
) {
|
|
322
|
-
shell.echo('Error: Installing WordPress failed.');
|
|
323
|
-
shell.exit(1);
|
|
324
|
-
}
|
|
325
318
|
|
|
326
|
-
shell.echo('✔️ Installing WordPress succesful.');
|
|
327
|
-
shell.exec(`wp rewrite structure '/%postname%/'`, { silent: true });
|
|
328
|
-
shell.echo('✔️ Setting permalink structure.');
|
|
329
|
-
|
|
330
|
-
shell.exec(`wp theme activate ${child_theme_folder}`, { silent: true });
|
|
331
|
-
shell.echo(`✔️ Activating child theme ${child_theme_folder}`);
|
|
332
|
-
|
|
333
|
-
shell.exec(`wp post update 2 --post_title='Home'`, { silent: true });
|
|
334
|
-
shell.exec(`wp option update show_on_front 'page'`, { silent: true });
|
|
335
|
-
shell.exec(`wp option update timezone_string 'Europe/Amsterdam'`, { silent: true });
|
|
336
|
-
shell.exec(`wp option update page_on_front 2`, { silent: true });
|
|
337
|
-
shell.exec(`wp post delete 1 --force`, { silent: true });
|
|
338
|
-
shell.exec(`wp comment delete 1 --force`, { silent: true });
|
|
339
|
-
shell.echo('✔️ Create homepage and set as front-page.');
|
|
340
|
-
// Set language
|
|
341
|
-
shell.exec(`wp language core install nl_NL`, { silent: true });
|
|
342
|
-
shell.exec(`wp language plugin install nl_NL --all`, { silent: true });
|
|
343
|
-
shell.exec(`wp language core activate nl_NL`, { silent: true });
|
|
344
|
-
shell.echo('✔️ Installed Dutch language.');
|
|
345
|
-
// set menu
|
|
346
|
-
shell.exec(`wp menu create "Hoofdmenu"`, { silent: true });
|
|
347
|
-
shell.exec(`wp menu item add-post Hoofdmenu 2`, { silent: true });
|
|
348
|
-
shell.exec(`wp menu location assign Hoofdmenu primary_navigation`, { silent: true });
|
|
349
|
-
shell.echo('✔️ Created primary menu.');
|
|
350
319
|
} else {
|
|
351
320
|
shell.echo('Creating Database.\n');
|
|
352
321
|
|
|
353
322
|
if (shell.exec(`wp db create`, { silent: true }).code !== 0) {
|
|
354
|
-
|
|
323
|
+
prompt('Database creation failed. Please make sure your server is running. Press enter to continue.');
|
|
324
|
+
|
|
355
325
|
} else {
|
|
356
|
-
shell.echo('✔️
|
|
326
|
+
shell.echo('✔️ Database created.');
|
|
357
327
|
}
|
|
358
328
|
|
|
359
329
|
/**
|
|
@@ -361,13 +331,63 @@ program
|
|
|
361
331
|
*/
|
|
362
332
|
shell.echo('You can import your database by placing the .sql dump in the project root and run wp db import databasename.sql.');
|
|
363
333
|
prompt('Please import your database and uploads. After that press enter to continue.');
|
|
364
|
-
|
|
365
|
-
// Flush rewrite rules
|
|
366
|
-
shell.exec(`wp rewrite flush`);
|
|
367
334
|
}
|
|
368
335
|
|
|
336
|
+
// Flush rewrite rules
|
|
337
|
+
shell.exec(`wp rewrite flush`);
|
|
338
|
+
|
|
369
339
|
shell.echo(`\n`);
|
|
370
|
-
shell.echo(`🎉
|
|
371
|
-
shell.echo(`🌐
|
|
340
|
+
shell.echo(`🎉 All done! Happy developing!`);
|
|
341
|
+
shell.echo(`🌐 You can now navigate to http://${project_url}`);
|
|
372
342
|
})
|
|
373
343
|
.parse(process.argv);
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
function createDB(theme_name) {
|
|
347
|
+
if (shell.exec(`wp db create`, { silent: true }).code !== 0) {
|
|
348
|
+
prompt('Database creation failed. Please make sure your server is running. Press enter to continue.');
|
|
349
|
+
} else {
|
|
350
|
+
shell.echo('✔️ Database created');
|
|
351
|
+
setupWordPress(theme_name);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
function setupWordPress(child_theme_folder) {
|
|
358
|
+
if (
|
|
359
|
+
shell.exec(
|
|
360
|
+
`wp core install --skip-email --url="http://${project_url}" --title="${project_name}" --admin_user="${username}" --admin_password="${password}" --admin_email="${email}"`,
|
|
361
|
+
{ silent: true },
|
|
362
|
+
).code !== 0
|
|
363
|
+
) {
|
|
364
|
+
shell.echo('Error: Installing WordPress failed.');
|
|
365
|
+
shell.exit(1);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
shell.echo('✔️ Installing WordPress succesful.');
|
|
369
|
+
shell.exec(`wp rewrite structure '/%postname%/'`, { silent: true });
|
|
370
|
+
shell.echo('✔️ Setting permalink structure.');
|
|
371
|
+
|
|
372
|
+
shell.exec(`wp theme activate ${child_theme_folder}`, { silent: true });
|
|
373
|
+
shell.echo(`✔️ Activating child theme ${child_theme_folder}`);
|
|
374
|
+
|
|
375
|
+
shell.exec(`wp post update 2 --post_title='Home'`, { silent: true });
|
|
376
|
+
shell.exec(`wp option update show_on_front 'page'`, { silent: true });
|
|
377
|
+
shell.exec(`wp option update timezone_string 'Europe/Amsterdam'`, { silent: true });
|
|
378
|
+
shell.exec(`wp option update page_on_front 2`, { silent: true });
|
|
379
|
+
shell.exec(`wp post delete 1 --force`, { silent: true });
|
|
380
|
+
shell.exec(`wp comment delete 1 --force`, { silent: true });
|
|
381
|
+
shell.echo('✔️ Create homepage and set as front-page.');
|
|
382
|
+
// Set language
|
|
383
|
+
shell.exec(`wp language core install nl_NL`, { silent: true });
|
|
384
|
+
shell.exec(`wp language plugin install nl_NL --all`, { silent: true });
|
|
385
|
+
shell.exec(`wp language core activate nl_NL`, { silent: true });
|
|
386
|
+
shell.echo('✔️ Installed Dutch language.');
|
|
387
|
+
// set menu
|
|
388
|
+
shell.exec(`wp menu create "Hoofdmenu"`, { silent: true });
|
|
389
|
+
shell.exec(`wp menu item add-post Hoofdmenu 2`, { silent: true });
|
|
390
|
+
shell.exec(`wp menu location assign Hoofdmenu primary_navigation`, { silent: true });
|
|
391
|
+
shell.echo('✔️ Created primary menu.');
|
|
392
|
+
|
|
393
|
+
}
|