@caweb/cli 1.11.2 → 1.12.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.
@@ -1,132 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import path from 'path';
5
- import fs from 'fs';
6
- import getHostUser from '@wordpress/env/lib/get-host-user.js';
7
- import yaml from 'js-yaml';
8
- import os from 'os';
9
-
10
- /**
11
- * Internal Dependencies
12
- */
13
-
14
- /**
15
- * Generate config.yml
16
- *
17
- * @param {string} workDirectoryPath Path to the work directory located in ~/.wp-env.
18
- *
19
- * @returns void
20
- */
21
- async function generateCLIConfig(workDirectoryPath){
22
- let yml = {
23
- path: '/var/www/html',
24
- apache_modules: ['mod_rewrite']
25
- };
26
-
27
- fs.writeFileSync(
28
- path.join(workDirectoryPath, 'config.yml'),
29
- yaml.dump(yml));
30
- }
31
-
32
- /**
33
- * Build docker-compose.override.yml
34
- *
35
- * @param {string} workDirectoryPath Path to the work directory located in ~/.wp-env.
36
- * @returns object
37
- */
38
- export default function dockerConfig ( workDirectoryPath ) {
39
- const {name} = getHostUser();
40
-
41
- // generate cli config file for cli containers.
42
- generateCLIConfig(workDirectoryPath);
43
-
44
- let dockerConfig = {
45
- services: {
46
- phpmyadmin: {
47
- image: `phpmyadmin:latest`,
48
- restart: 'always',
49
- ports: ['8080:80'],
50
- environment: {
51
- PMA_HOSTS : 'mysql,tests-mysql',
52
- UPLOAD_LIMIT: '3G',
53
- MEMORY_LIMIT: '5G',
54
- MAX_EXECUTION_TIME: 7200
55
- }
56
- },
57
- cli: {
58
- build: {
59
- context: '.',
60
- dockerfile: 'CLI.Dockerfile'
61
- },
62
- volumes: [ path.join(workDirectoryPath, 'config.yml') + `:/home/${name}/.wp-cli/config.yml` ]
63
- },
64
- "tests-cli": {
65
- build: {
66
- context: '.',
67
- dockerfile: 'Tests-CLI.Dockerfile'
68
- },
69
- volumes: [ path.join(workDirectoryPath, 'config.yml') + `:/home/${name}/.wp-cli/config.yml`]
70
- },
71
- wordpress: {
72
- build: {
73
- context: '.',
74
- dockerfile: 'WordPress.Dockerfile'
75
- }
76
- },
77
- "tests-wordpress": {
78
- build: {
79
- context: '.',
80
- dockerfile: 'Tests-WordPress.Dockerfile'
81
- }
82
- }
83
- }
84
-
85
- };
86
-
87
- let extraVolumes = [];
88
-
89
- // Add downloaded themes to services volumes.
90
- if( fs.existsSync(path.join(workDirectoryPath, 'themes')) ){
91
- extraVolumes = extraVolumes.concat(path.join(workDirectoryPath, 'themes') + ':/var/www/html/wp-content/themes');
92
- }
93
-
94
- // Add downloaded plugins to services volumes.
95
- if( fs.existsSync(path.join(workDirectoryPath, 'plugins')) ){
96
- extraVolumes = extraVolumes.concat(path.join(workDirectoryPath, 'plugins') + ':/var/www/html/wp-content/plugins');
97
- }
98
-
99
- // Add extra volumes to WordPress instances.
100
- if( extraVolumes.length ){
101
- dockerConfig.services.wordpress = {
102
- ...dockerConfig.services.wordpress,
103
- volumes: [
104
- ...extraVolumes
105
- ],
106
- };
107
- dockerConfig.services.cli = {
108
- ...dockerConfig.services.cli,
109
- volumes: [
110
- ...dockerConfig.services.cli.volumes,
111
- ...extraVolumes
112
- ],
113
- };
114
- dockerConfig.services['tests-wordpress'] = {
115
- ...dockerConfig.services['tests-wordpress'],
116
- volumes: [
117
- ...extraVolumes
118
- ],
119
- };
120
- dockerConfig.services['tests-cli'] = {
121
- ...dockerConfig.services['tests-cli'],
122
- volumes: [
123
- ...dockerConfig.services['tests-cli'].volumes,
124
- ...extraVolumes
125
- ],
126
- };
127
-
128
- }
129
-
130
- return dockerConfig;
131
-
132
- }
File without changes
File without changes