|
1 |
| -const fs = require('fs'); |
2 |
| -const YAML = require('yaml'); |
| 1 | +const fs = require("fs"); |
| 2 | +const YAML = require("yaml"); |
3 | 3 |
|
4 |
| -const configFileName = 'config.yml'; |
| 4 | +const configFileName = "config.yml"; |
5 | 5 | const defaultPhpVersion = 7.4;
|
6 | 6 |
|
7 | 7 | console.info(`Generating ${configFileName}...`);
|
8 | 8 |
|
9 |
| -const sitesConfig = require('./sites.json'); |
| 9 | +const sitesConfig = require("./sites.json"); |
10 | 10 |
|
11 | 11 | const vvvConfig = {
|
12 | 12 | sites: {},
|
13 | 13 | utilities: {
|
14 | 14 | core: [
|
15 |
| - 'tls-ca', |
16 |
| - 'phpmyadmin', |
17 |
| - 'memcached-admin', |
18 |
| - 'opcache-status', |
19 |
| - 'webgrind', |
20 |
| - 'php73', |
21 |
| - 'php74', |
22 |
| - 'php80', |
| 15 | + "tls-ca", |
| 16 | + "phpmyadmin", |
| 17 | + "memcached-admin", |
| 18 | + "opcache-status", |
| 19 | + "webgrind", |
| 20 | + "php73", |
| 21 | + "php74", |
| 22 | + "php80", |
23 | 23 | ],
|
24 | 24 | pmc: [
|
25 |
| - 'coretech', |
| 25 | + "coretech", |
26 | 26 | // 'dev-tools',
|
27 |
| - 'http-concat', |
28 |
| - 'phpcs', |
| 27 | + "http-concat", |
| 28 | + "phpcs", |
29 | 29 | ],
|
30 | 30 | },
|
31 |
| - 'utility-sources': { |
| 31 | + "utility-sources": { |
32 | 32 | pmc: {
|
33 |
| - repo: '[email protected]:penske-media-corp/pmc-vvv-utilities.git', |
34 |
| - branch: 'main', |
| 33 | + repo: "[email protected]:penske-media-corp/pmc-vvv-utilities.git", |
| 34 | + branch: "main", |
35 | 35 | },
|
36 | 36 | },
|
37 |
| - 'vm_config': { |
| 37 | + vm_config: { |
38 | 38 | memory: 4096,
|
39 | 39 | cores: 3,
|
40 | 40 | },
|
41 | 41 | general: {
|
42 |
| - 'db_backup': true, |
43 |
| - 'db_restore': true, |
44 |
| - 'db_share': false, |
| 42 | + db_backup: true, |
| 43 | + db_restore: false, |
| 44 | + db_share: false, |
45 | 45 | },
|
46 |
| - 'vagrant-plugins': { |
47 |
| - disksize: '65GB', |
| 46 | + "vagrant-plugins": { |
| 47 | + disksize: "65GB", |
48 | 48 | },
|
49 | 49 | };
|
50 | 50 |
|
51 |
| -Object.entries(sitesConfig).forEach( |
52 |
| - (entry) => { |
53 |
| - const [ liveUrl, config ] = entry; |
| 51 | +Object.entries(sitesConfig).forEach((entry) => { |
| 52 | + const [liveUrl, config] = entry; |
54 | 53 |
|
55 |
| - if (! config.theme_repo) { |
56 |
| - console.warn(` - Skipping ${liveUrl} due to misconfiguration`); |
57 |
| - return; |
58 |
| - } |
| 54 | + if (!config.theme_repo) { |
| 55 | + console.warn(` - Skipping ${liveUrl} due to misconfiguration`); |
| 56 | + return; |
| 57 | + } |
59 | 58 |
|
60 |
| - const slugifiedUrl = liveUrl.replace(/\./g,'-'); |
| 59 | + const slugifiedUrl = liveUrl.replace(/\./g, "-"); |
61 | 60 |
|
62 |
| - const phpVersion = parseFloat(config.php_version ?? defaultPhpVersion).toFixed(1); |
63 |
| - const nginxUpstream = `php${phpVersion}`.replace('.', ''); |
| 61 | + const phpVersion = parseFloat( |
| 62 | + config.php_version ?? defaultPhpVersion |
| 63 | + ).toFixed(1); |
| 64 | + const nginxUpstream = `php${phpVersion}`.replace(".", ""); |
64 | 65 |
|
65 |
| - vvvConfig.sites[slugifiedUrl] = { |
66 |
| - skip_provisioning: true, |
67 |
| - description: liveUrl, |
68 |
| - repo: config.provisioner_url ?? '[email protected]:penske-media-corp/pmc-vvv-site-provisioners.git', |
69 |
| - branch: config.provisioner_branch ?? 'main', |
70 |
| - hosts: [ |
71 |
| - `${slugifiedUrl}.test`, |
72 |
| - ], |
73 |
| - nginx_upstream: nginxUpstream, |
74 |
| - custom: { |
75 |
| - live_url: `https://${liveUrl}`, |
76 |
| - site_title: `${config.site_title_prefix} (LOCAL)`, |
77 |
| - admin_user: 'pmcdev', |
78 |
| - admin_password: 'pmcdev', |
79 |
| - pmc: { |
80 |
| - theme_repo: config.theme_repo, |
81 |
| - theme_slug: config.theme_slug ?? '', |
82 |
| - parent_theme_slug: config.parent_theme_slug ?? '', |
83 |
| - theme_dir_uses_vip: config.theme_dir_uses_vip ?? false, |
84 |
| - } |
85 |
| - } |
86 |
| - }; |
87 |
| - } |
88 |
| -); |
| 66 | + vvvConfig.sites[slugifiedUrl] = { |
| 67 | + skip_provisioning: true, |
| 68 | + description: liveUrl, |
| 69 | + repo: |
| 70 | + config.provisioner_url ?? |
| 71 | + "[email protected]:penske-media-corp/pmc-vvv-site-provisioners.git", |
| 72 | + branch: config.provisioner_branch ?? "main", |
| 73 | + hosts: [`${slugifiedUrl}.test`], |
| 74 | + nginx_upstream: nginxUpstream, |
| 75 | + custom: { |
| 76 | + live_url: `https://${liveUrl}`, |
| 77 | + site_title: `${config.site_title_prefix} (LOCAL)`, |
| 78 | + admin_user: "pmcdev", |
| 79 | + admin_password: "pmcdev", |
| 80 | + pmc: { |
| 81 | + theme_repo: config.theme_repo, |
| 82 | + theme_slug: config.theme_slug ?? "", |
| 83 | + parent_theme_slug: config.parent_theme_slug ?? "", |
| 84 | + theme_dir_uses_vip: config.theme_dir_uses_vip ?? false, |
| 85 | + }, |
| 86 | + }, |
| 87 | + }; |
| 88 | +}); |
89 | 89 |
|
90 |
| -vvvConfig.sites['wordpress-trunk'] = { |
| 90 | +vvvConfig.sites["wordpress-trunk"] = { |
91 | 91 | skip_provisioning: true,
|
92 |
| - description: "An svn based WP Core trunk dev setup, useful for contributor days, Trac tickets, patches", |
93 |
| - repo: 'https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop.git', |
94 |
| - hosts: [ |
95 |
| - 'trunk.wordpress.test', |
96 |
| - ], |
| 92 | + description: |
| 93 | + "An svn based WP Core trunk dev setup, useful for contributor days, Trac tickets, patches", |
| 94 | + repo: "https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop.git", |
| 95 | + hosts: ["trunk.wordpress.test"], |
97 | 96 | };
|
98 | 97 |
|
99 | 98 | fs.writeFileSync(
|
100 | 99 | configFileName,
|
101 | 100 | YAML.stringify(vvvConfig, null, { lineWidth: 0 })
|
102 | 101 | );
|
103 | 102 |
|
104 |
| -console.info('Done!'); |
| 103 | +console.info("Done!"); |
0 commit comments