@scandipwa/magento-scripts 1.16.1 → 2.0.0-alpha.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 (226) hide show
  1. package/lib/commands/cli.js +4 -6
  2. package/lib/commands/execute.js +29 -4
  3. package/lib/commands/import-db.js +1 -1
  4. package/lib/commands/logs.js +1 -1
  5. package/lib/commands/start.js +38 -20
  6. package/lib/commands/status.js +2 -0
  7. package/lib/config/docker.js +102 -84
  8. package/lib/config/get-project-configuration.js +3 -1
  9. package/lib/config/index.js +10 -7
  10. package/lib/config/magento/required-php-extensions/index.js +29 -0
  11. package/lib/config/magento/required-php-extensions/magento-2.3.js +19 -0
  12. package/lib/config/magento/required-php-extensions/magento-2.4.js +29 -0
  13. package/lib/config/php/base-repo.js +3 -0
  14. package/lib/config/php/extensions/apcu.js +12 -0
  15. package/lib/config/php/extensions/bcmath.js +7 -0
  16. package/lib/config/php/extensions/curl.js +11 -0
  17. package/lib/config/php/extensions/gd.js +14 -0
  18. package/lib/config/php/extensions/index.js +18 -2
  19. package/lib/config/php/extensions/intl.js +10 -0
  20. package/lib/config/php/extensions/opcache.js +10 -0
  21. package/lib/config/php/extensions/pdo_mysql.js +7 -0
  22. package/lib/config/php/extensions/soap.js +10 -0
  23. package/lib/config/php/extensions/sodium.js +10 -0
  24. package/lib/config/php/extensions/xdebug.js +8 -5
  25. package/lib/config/php/extensions/xsl.js +10 -0
  26. package/lib/config/php/extensions/zip.js +10 -0
  27. package/lib/config/php/{releases → versions}/index.js +0 -0
  28. package/lib/config/php/versions/php-7.2.js +23 -0
  29. package/lib/config/php/versions/php-7.3.js +23 -0
  30. package/lib/config/php/versions/php-7.4.js +23 -0
  31. package/lib/config/php/versions/php-8.1.js +23 -0
  32. package/lib/config/php-config.js +8 -12
  33. package/lib/config/port-config.js +2 -6
  34. package/lib/config/services/elasticsearch/base-repo.js +3 -0
  35. package/lib/config/services/elasticsearch/default-es-env.js +6 -0
  36. package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
  37. package/lib/config/services/elasticsearch/versions/index.js +5 -0
  38. package/lib/config/templates/magentorc.template +5 -5
  39. package/lib/config/templates/mariadb.template.cnf +191 -0
  40. package/lib/config/templates/php-fpm.template.conf +3 -3
  41. package/lib/config/templates/php.template.ini +12 -6
  42. package/lib/config/templates/ssl-terminator.template.conf +1 -1
  43. package/lib/config/templates/vscode-launch.template.json +3 -1
  44. package/lib/config/versions/magento-2.3.0.js +10 -5
  45. package/lib/config/versions/magento-2.3.1.js +10 -5
  46. package/lib/config/versions/magento-2.3.2-p1.js +43 -0
  47. package/lib/config/versions/magento-2.3.2-p2.js +10 -5
  48. package/lib/config/versions/magento-2.3.2.js +10 -5
  49. package/lib/config/versions/magento-2.3.3-p1.js +10 -5
  50. package/lib/config/versions/magento-2.3.3.js +10 -5
  51. package/lib/config/versions/magento-2.3.4-p1.js +43 -0
  52. package/lib/config/versions/magento-2.3.4-p2.js +10 -5
  53. package/lib/config/versions/magento-2.3.4.js +10 -5
  54. package/lib/config/versions/magento-2.3.5-p1.js +8 -2
  55. package/lib/config/versions/magento-2.3.5-p2.js +8 -2
  56. package/lib/config/versions/magento-2.3.5.js +8 -2
  57. package/lib/config/versions/magento-2.3.6-p1.js +8 -2
  58. package/lib/config/versions/magento-2.3.6.js +8 -2
  59. package/lib/config/versions/magento-2.3.7-p1.js +8 -2
  60. package/lib/config/versions/magento-2.3.7-p2.js +8 -2
  61. package/lib/config/versions/magento-2.3.7-p3.js +8 -2
  62. package/lib/config/versions/magento-2.3.7.js +8 -2
  63. package/lib/config/versions/magento-2.4.0-p1.js +9 -3
  64. package/lib/config/versions/magento-2.4.0.js +9 -3
  65. package/lib/config/versions/magento-2.4.1-p1.js +6 -5
  66. package/lib/config/versions/magento-2.4.1.js +9 -2
  67. package/lib/config/versions/magento-2.4.2-p1.js +6 -5
  68. package/lib/config/versions/magento-2.4.2-p2.js +6 -6
  69. package/lib/config/versions/magento-2.4.2.js +6 -6
  70. package/lib/config/versions/magento-2.4.3-p1.js +7 -7
  71. package/lib/config/versions/magento-2.4.3-p2.js +7 -7
  72. package/lib/config/versions/magento-2.4.3.js +7 -7
  73. package/lib/config/versions/magento-2.4.4.js +9 -2
  74. package/lib/tasks/cleanup.js +3 -3
  75. package/lib/tasks/composer/index.js +14 -104
  76. package/lib/tasks/database/connect-to-database.js +117 -0
  77. package/lib/tasks/database/create-magento-database.js +18 -0
  78. package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
  79. package/lib/tasks/{mysql → database}/fix-db.js +2 -2
  80. package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +65 -22
  81. package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
  82. package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
  83. package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
  84. package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
  85. package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
  86. package/lib/tasks/{mysql → database}/index.js +2 -2
  87. package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
  88. package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
  89. package/lib/tasks/docker/api.d.ts +71 -0
  90. package/lib/tasks/docker/api.js +30 -0
  91. package/lib/tasks/docker/containers/container-api.d.ts +128 -0
  92. package/lib/tasks/docker/containers/container-api.js +153 -0
  93. package/lib/tasks/docker/containers/index.js +19 -0
  94. package/lib/tasks/docker/containers/tasks.js +215 -0
  95. package/lib/tasks/docker/convert-legacy-volumes.js +15 -10
  96. package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
  97. package/lib/tasks/docker/image/image-api.d.ts +34 -0
  98. package/lib/tasks/docker/image/image-api.js +49 -0
  99. package/lib/tasks/docker/image/index.js +5 -0
  100. package/lib/tasks/docker/index.js +1 -13
  101. package/lib/tasks/docker/network/index.js +7 -0
  102. package/lib/tasks/docker/network/network-api.d.ts +103 -0
  103. package/lib/tasks/docker/network/network-api.js +99 -0
  104. package/lib/tasks/docker/{network.js → network/tasks.js} +17 -10
  105. package/lib/tasks/docker/project-image-builder.js +167 -0
  106. package/lib/tasks/docker/volume/index.js +8 -0
  107. package/lib/tasks/docker/{volumes.js → volume/tasks.js} +5 -19
  108. package/lib/tasks/docker/volume/volume-api.d.ts +39 -0
  109. package/lib/tasks/docker/volume/volume-api.js +66 -0
  110. package/lib/tasks/execute/index.js +5 -2
  111. package/lib/tasks/file-system/create-mariadb-config.js +23 -0
  112. package/lib/tasks/file-system/create-nginx-config.js +2 -3
  113. package/lib/tasks/file-system/create-php-config.js +20 -5
  114. package/lib/tasks/file-system/create-php-fpm-config.js +8 -4
  115. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +41 -29
  116. package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -0
  117. package/lib/tasks/file-system/create-phpstorm-config/keys.js +15 -1
  118. package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +4 -1
  119. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +3 -3
  120. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +81 -0
  121. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/index.js +42 -0
  122. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/php-docker-settings-config.js +9 -0
  123. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/setup-php-docker-container-settings-config.js +66 -0
  124. package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +11 -9
  125. package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +2 -1
  126. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +15 -30
  127. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +24 -5
  128. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/mess-detector-project-configuration-config.js +50 -0
  129. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-code-sniffer-project-configuration-config.js +50 -0
  130. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-cs-fixer-project-configuration-config.js +50 -0
  131. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +15 -15
  132. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +29 -3
  133. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-stan-project-configuration-config.js.js +50 -0
  134. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +42 -0
  135. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/psalm-project-configuration-config.js.js +50 -0
  136. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +0 -2
  137. package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -2
  138. package/lib/tasks/file-system/create-vscode-config.js +57 -42
  139. package/lib/tasks/file-system/index.js +5 -2
  140. package/lib/tasks/import-dump.js +6 -6
  141. package/lib/tasks/link.js +5 -4
  142. package/lib/tasks/magento/install-magento-project.js +31 -63
  143. package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +4 -4
  144. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +7 -3
  145. package/lib/tasks/magento/setup-magento/create-admin.js +5 -6
  146. package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
  147. package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
  148. package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
  149. package/lib/tasks/magento/setup-magento/disable-2fa.js +3 -5
  150. package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +3 -4
  151. package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
  152. package/lib/tasks/magento/setup-magento/index.js +2 -0
  153. package/lib/tasks/magento/setup-magento/install-magento.js +21 -20
  154. package/lib/tasks/magento/setup-magento/migrate-database.js +7 -14
  155. package/lib/tasks/magento/setup-magento/set-base-url.js +2 -2
  156. package/lib/tasks/magento/setup-magento/set-deployment-mode.js +4 -4
  157. package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
  158. package/lib/tasks/magento/setup-magento/varnish-config.js +10 -8
  159. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +128 -3
  160. package/lib/tasks/php/php-container.js +108 -0
  161. package/lib/tasks/php/update-env-php.js +39 -21
  162. package/lib/tasks/php/update-env.php +66 -61
  163. package/lib/tasks/php/working_health_check.php +85 -0
  164. package/lib/tasks/requirements/{composer.js → composer-credentials.js} +3 -1
  165. package/lib/tasks/requirements/docker/index.js +15 -12
  166. package/lib/tasks/requirements/docker/performance.js +54 -0
  167. package/lib/tasks/requirements/docker/version.js +8 -8
  168. package/lib/tasks/requirements/index.js +5 -8
  169. package/lib/tasks/requirements/php-version.js +8 -116
  170. package/lib/tasks/requirements/platform.js +12 -25
  171. package/lib/tasks/start.js +21 -50
  172. package/lib/tasks/status/index.js +8 -12
  173. package/lib/tasks/stop.js +0 -2
  174. package/lib/tasks/theme/install-theme.js +1 -1
  175. package/lib/tasks/theme/link-theme.js +2 -2
  176. package/lib/tasks/theme/symlink-theme.js +2 -3
  177. package/lib/util/config-file-validator.js +27 -13
  178. package/lib/util/config-php-json.js +13 -4
  179. package/lib/util/database.js +7 -7
  180. package/lib/util/dockerfile-builder/build-instructions.js +197 -0
  181. package/lib/util/dockerfile-builder/index.js +276 -0
  182. package/lib/util/dockerfile-builder/types.d.ts +123 -0
  183. package/lib/util/env-php-json.js +10 -6
  184. package/lib/util/exec-async-command.js +3 -9
  185. package/lib/util/macos-version.js +20 -0
  186. package/lib/util/magento-task.js +3 -4
  187. package/lib/util/nginx-logs-parser.js +122 -0
  188. package/lib/util/php-task.js +3 -6
  189. package/lib/util/run-composer.js +6 -14
  190. package/lib/util/run-container-image.js +17 -0
  191. package/lib/util/run-magento.js +6 -14
  192. package/lib/util/run-php.js +6 -17
  193. package/package.json +9 -9
  194. package/typings/context.d.ts +7 -13
  195. package/typings/index.d.ts +67 -85
  196. package/yarn-error.log +9660 -0
  197. package/lib/config/composer.js +0 -11
  198. package/lib/config/php/extensions/libsodium.js +0 -36
  199. package/lib/config/php/releases/php-7.2.js +0 -25
  200. package/lib/config/php/releases/php-7.3.js +0 -25
  201. package/lib/config/php/releases/php-7.4.js +0 -23
  202. package/lib/config/php/releases/php-8.1.js +0 -25
  203. package/lib/config/phpbrew.js +0 -12
  204. package/lib/tasks/composer/install-prestissimo.js +0 -103
  205. package/lib/tasks/docker/containers.js +0 -231
  206. package/lib/tasks/mysql/connect-to-mysql.js +0 -114
  207. package/lib/tasks/mysql/create-magento-database.js +0 -18
  208. package/lib/tasks/php/bundled-extensions.js +0 -27
  209. package/lib/tasks/php/compile-options.js +0 -56
  210. package/lib/tasks/php/compile.js +0 -55
  211. package/lib/tasks/php/configure.js +0 -89
  212. package/lib/tasks/php/extensions/disable.js +0 -49
  213. package/lib/tasks/php/extensions/enable.js +0 -52
  214. package/lib/tasks/php/extensions/index.js +0 -80
  215. package/lib/tasks/php/extensions/install.js +0 -54
  216. package/lib/tasks/php/index.js +0 -79
  217. package/lib/tasks/php/install-sodium.js +0 -93
  218. package/lib/tasks/php/update-phpbrew.js +0 -45
  219. package/lib/tasks/php/validate-php.js +0 -67
  220. package/lib/tasks/php-fpm/get-process-id.js +0 -14
  221. package/lib/tasks/php-fpm/index.js +0 -4
  222. package/lib/tasks/php-fpm/start-php-fpm.js +0 -49
  223. package/lib/tasks/php-fpm/stop-php-fpm.js +0 -48
  224. package/lib/tasks/requirements/phpbrew/index.js +0 -61
  225. package/lib/tasks/requirements/phpbrew/install.js +0 -159
  226. package/lib/tasks/requirements/phpbrew/version.js +0 -28
@@ -1,8 +1,9 @@
1
- const { execAsyncSpawn } = require('./exec-async-command');
2
- const { getConfigFromMagentoVersion, defaultConfiguration, magento } = require('../config');
3
1
  const UnknownError = require('../errors/unknown-error');
2
+ const { runPHPContainerCommand } = require('../tasks/php/php-container');
4
3
  /**
5
4
  * Execute magento command
5
+ *
6
+ * @param {import('../../typings/context').ListrContext} ctx
6
7
  * @param {String} command magento command
7
8
  * @param {Object} options
8
9
  * @param {Boolean} options.logOutput Log output to console using logger
@@ -10,20 +11,11 @@ const UnknownError = require('../errors/unknown-error');
10
11
  * @param {String} options.cwd
11
12
  * @param {() => {}} options.callback
12
13
  * @param {Boolean} options.throwNonZeroCode Throw if command return non 0 code.
13
- * @param {String} options.magentoVersion Magento version for config
14
14
  */
15
- const runMagentoCommand = async (command, options = {}) => {
16
- const {
17
- throwNonZeroCode = true,
18
- magentoVersion = defaultConfiguration.name
19
- } = options;
20
- const {
21
- php,
22
- baseConfig: { magentoDir }
23
- } = await getConfigFromMagentoVersion(magentoVersion);
24
- const { code, result } = await execAsyncSpawn(`${php.binPath} -c ${php.iniPath} ${magento.binPath} ${command}`, {
15
+ const runMagentoCommand = async (ctx, command, options = {}) => {
16
+ const { throwNonZeroCode = true } = options;
17
+ const { code, result } = await runPHPContainerCommand(ctx, `bin/magento ${command}`, {
25
18
  ...options,
26
- cwd: magentoDir,
27
19
  withCode: true
28
20
  });
29
21
 
@@ -1,34 +1,23 @@
1
- const { execAsyncSpawn } = require('./exec-async-command');
2
- const { getConfigFromMagentoVersion, defaultConfiguration } = require('../config');
3
1
  const UnknownError = require('../errors/unknown-error');
2
+ const { runPHPContainerCommand } = require('../tasks/php/php-container');
4
3
  /**
5
4
  * Execute PHP code
6
- * @param {String} command magento command
5
+ * @param {import('../../typings/context').ListrContext} ctx
6
+ * @param {String} command php command
7
7
  * @param {Object} options
8
8
  * @param {Boolean} options.logOutput Log output to console using logger
9
9
  * @param {Boolean} options.withCode
10
10
  * @param {String} options.cwd
11
11
  * @param {() => {}} options.callback
12
12
  * @param {Boolean} options.throwNonZeroCode Throw if command return non 0 code.
13
- * @param {String} options.magentoVersion Magento version for config
14
13
  * @param {Record<string, string>} options.env Environment variables
15
14
  * @param {Boolean} options.useRosettaOnMac Use Rosetta 2 on MacOS
16
15
  */
17
- const runPhpCode = async (command, options = {}) => {
16
+ const runPhpCode = async (ctx, command, options = {}) => {
18
17
  const {
19
- throwNonZeroCode = true,
20
- magentoVersion = defaultConfiguration.magentoVersion
18
+ throwNonZeroCode = true
21
19
  } = options;
22
- const { php } = await getConfigFromMagentoVersion(magentoVersion);
23
- let spawnCommand = `${php.binPath} -c ${php.iniPath} ${command}`;
24
- if (options.env && Object.keys(options.env).length > 0) {
25
- const env = Object.entries(options.env).map(([key, value]) => `${key}=${value}`).join(' ');
26
- spawnCommand = `${env} ${spawnCommand}`;
27
- }
28
- if (options.useRosettaOnMac) {
29
- spawnCommand = `arch -x86_64 bash -c '${spawnCommand}'`;
30
- }
31
- const { code, result } = await execAsyncSpawn(spawnCommand, {
20
+ const { code, result } = await runPHPContainerCommand(ctx, `php ${command}`, {
32
21
  ...options,
33
22
  withCode: true
34
23
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Scripts and configuration used by CMA.",
4
4
  "homepage": "https://docs.create-magento-app.com/",
5
5
  "repository": "github:scandipwa/create-magento-app",
6
- "version": "1.16.1",
6
+ "version": "2.0.0-alpha.2",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -23,22 +23,22 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@scandipwa/scandipwa-dev-utils": "0.1.13",
26
- "conf": "10.1.1",
26
+ "conf": "10.1.2",
27
27
  "enquirer": "2.3.6",
28
28
  "eta": "1.12.3",
29
- "fast-xml-parser": "^4.0.7",
29
+ "fast-xml-parser": "^4.0.9",
30
30
  "hjson": "^3.2.2",
31
31
  "is-installed-globally": "0.4.0",
32
32
  "joi": "17.6.0",
33
33
  "listr2": "4.0.5",
34
34
  "macos-version": "5.2.1",
35
35
  "merge-files": "0.1.2",
36
- "mysql2": "2.3.2",
37
- "node-ssh": "12.0.0",
38
- "semver": "7.3.5",
36
+ "mysql2": "2.3.3",
37
+ "node-ssh": "12.0.5",
38
+ "semver": "7.3.7",
39
39
  "smol-request": "^2.1.2",
40
- "systeminformation": "5.11.7",
41
- "yargs": "17.3.1"
40
+ "systeminformation": "5.12.1",
41
+ "yargs": "17.5.1"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
@@ -53,5 +53,5 @@
53
53
  "mysql",
54
54
  "scandipwa"
55
55
  ],
56
- "gitHead": "ced1b75c1b448ef198a658edf010f53179aaaeb0"
56
+ "gitHead": "feac3f9df219e0a033bacf1f04afe154064bbf2f"
57
57
  }
@@ -11,7 +11,7 @@ export interface ListrContext {
11
11
  app: number
12
12
  fpm: number
13
13
  xdebug: number
14
- mysql: number
14
+ mariadb: number
15
15
  redis: number
16
16
  elasticsearch: number
17
17
  varnish: number
@@ -31,12 +31,8 @@ export interface ListrContext {
31
31
  edition?: 'community' | 'enterprise'
32
32
  config: {
33
33
  php: {
34
- binPath: string
35
- iniPath: string
36
34
  iniTemplatePath: string
37
- fpmBinPath: string
38
35
  fpmConfPath: string
39
- fpmPidFilePath: string
40
36
  extensions: PHPExtensions
41
37
  version: string
42
38
  }
@@ -49,15 +45,15 @@ export interface ListrContext {
49
45
  network: {
50
46
  name: string
51
47
  }
52
- volumes: Record<'mysql' | 'redis' | 'elasticsearch' | 'nginx' | 'appPub' | 'appSetup', {
48
+ volumes: Record<'mariadb' | 'redis' | 'elasticsearch' | 'nginx' | 'appPub' | 'appSetup', {
53
49
  name: string
54
- opts?: {
50
+ opt?: {
55
51
  type: string
56
52
  device: string
57
53
  o: string
58
54
  }
59
55
  }>
60
- getContainers(): Record<'nginx' | 'redis' | 'mysql' | 'elasticsearch' | 'varnish', {
56
+ getContainers(): Record<'php' | 'sslTerminator' | 'nginx' | 'redis' | 'mariadb' | 'elasticsearch' | 'varnish', {
61
57
  _: string
62
58
  ports: string[]
63
59
  healthCheck: {
@@ -70,10 +66,7 @@ export interface ListrContext {
70
66
  securityOptions: string[]
71
67
  network: string
72
68
  image: string
73
- imageDetails: {
74
- name: string
75
- tag: string
76
- }
69
+ debugImage?: string
77
70
  name: string
78
71
  command: string
79
72
  connectCommand: string[]
@@ -84,6 +77,7 @@ export interface ListrContext {
84
77
  magentoDir: string
85
78
  templateDir: string
86
79
  cacheDir: string
80
+ containerMagentoDir: string
87
81
  }
88
82
  overridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
89
83
  userConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
@@ -94,6 +88,6 @@ export interface ListrContext {
94
88
  analytics: boolean
95
89
  useNonOverlappingPorts: boolean
96
90
  }
97
- mysqlConnection: mysql2.Connection
91
+ databaseConnection: mysql2.Connection
98
92
  isSetupUpgradeNeeded?: boolean
99
93
  }
@@ -1,16 +1,21 @@
1
- import { ListrTaskWrapper } from 'listr2';
2
-
3
1
  import { ListrContext } from './context';
4
2
 
5
3
  /* eslint-disable no-use-before-define */
6
- export interface ServiceWithVersion {
4
+ export interface ServiceWithImage {
7
5
  /**
8
6
  * Service version
7
+ *
8
+ * @deprecated
9
9
  */
10
10
  version: string
11
+
12
+ /**
13
+ * Service Docker image
14
+ */
15
+ image: string
11
16
  }
12
17
 
13
- export interface SSLTerminatorConfiguration extends ServiceWithVersion {
18
+ export interface SSLTerminatorConfiguration extends ServiceWithImage {
14
19
  /**
15
20
  * Configuration file location
16
21
  *
@@ -19,7 +24,7 @@ export interface SSLTerminatorConfiguration extends ServiceWithVersion {
19
24
  configTemplate: string
20
25
  }
21
26
 
22
- export interface NginxConfiguration extends ServiceWithVersion {
27
+ export interface NginxConfiguration extends ServiceWithImage {
23
28
  /**
24
29
  * Configuration file location
25
30
  *
@@ -28,7 +33,14 @@ export interface NginxConfiguration extends ServiceWithVersion {
28
33
  configTemplate: string
29
34
  }
30
35
 
31
- export interface VarnishConfiguration extends ServiceWithVersion {
36
+ export interface ElasticSearchConfiguration extends ServiceWithImage {
37
+ /**
38
+ * Environmental variables used for Elasticsearch container
39
+ */
40
+ env: Record<string, unknown>
41
+ }
42
+
43
+ export interface VarnishConfiguration extends ServiceWithImage {
32
44
  /**
33
45
  * Enable or disable Varnish in the project
34
46
  */
@@ -42,80 +54,63 @@ export interface VarnishConfiguration extends ServiceWithVersion {
42
54
  configTemplate: string
43
55
  }
44
56
 
45
- export interface PHPExtension extends Record<string, unknown> {
46
- version?: string
57
+ export interface ComposerConfiguration {
47
58
  /**
48
- * Name of the extension loaded to PHP.
49
- *
50
- * @example `libsodium` extension is using `sodium` extensionName because it is loaded into PHP as `sodium` extension
51
- * and dynamic library that it requires called `sodium`
59
+ * Composer version
60
+ */
61
+ version: string
62
+ }
63
+
64
+ export interface PHPExtensionInstallationInstruction {
65
+ /**
66
+ * Alternative name for extension
52
67
  *
53
- * ```
54
- * {
55
- * php: {
56
- * extensions: {
57
- * libsodium: {
58
- * extensionName: 'sodium'
59
- * }
60
- * }
61
- * }
62
- * }
68
+ * @example ```js
69
+ * alternativeName: ['Zend OPcache']
63
70
  * ```
64
71
  */
65
- linuxOptions?: string
66
- macosOptions?: string
67
- extensionName?: string
68
- hooks?: {
69
- preEnable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
70
- postEnable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
71
- preDisable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
72
- postDisable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
73
- preInstall?: (config: CMAConfiguration['configuration']) => Promise<void> | void
74
- postInstall?: (config: CMAConfiguration['configuration']) => Promise<void> | void
75
- }
72
+ alternativeName?: string[]
76
73
  /**
77
- * Allow to define custom logic to install extension
74
+ * Command to install extension
75
+ *
76
+ * @example ```bash
77
+ * docker-php-ext-install bcmath
78
+ * ```
79
+ * @example ```bash
80
+ * pecl install xdebug && docker-php-ext-enable xdebug
81
+ * ```
78
82
  */
79
- install?: (
80
- ctx: ListrContext,
81
- task: ListrTaskWrapper<ListrContext, any>
82
- ) => Promise<void> | void
83
+ command: (arg0: (Omit<PHPExtensionInstallationInstruction, 'command'> & { ctx: ListrContext})) => string | string
83
84
 
84
85
  /**
85
- * Allow to define custom logic to enable an extension
86
+ * System dependencies required by the extension
87
+ *
88
+ * @example ```js
89
+ * dependencies: ['icu-dev']
90
+ * ```
86
91
  */
87
- enable?: (
88
- ctx: ListrContext,
89
- task: ListrTaskWrapper<ListrContext, any>
90
- ) => Promise<void> | void
92
+ dependencies?: string[]
91
93
 
92
94
  /**
93
- * Allow to define custom logic to disable an extension
95
+ * Extension version (if supported)
94
96
  */
95
- disable?: (
96
- ctx: ListrContext,
97
- task: ListrTaskWrapper<ListrContext, any>
98
- ) => Promise<void> | void
97
+ version?: string
99
98
  }
100
99
 
101
100
  export interface PHPExtensions {
102
- gd: PHPExtension
103
- intl: PHPExtension
104
- zlib: PHPExtension
105
- openssl: PHPExtension
106
- sockets: PHPExtension
107
- simpleXML: PHPExtension
108
- xdebug: PHPExtension
109
- fileinfo: PHPExtension
110
- libsodium: PHPExtension
111
- [key: string]: PHPExtension
101
+ [key: string]: PHPExtensionInstallationInstruction
112
102
  }
113
103
 
114
104
  export interface PHPConfiguration {
115
105
  /**
116
- * PHP version
106
+ * Base image with tag
117
107
  */
118
- version: string
108
+ baseImage?: string
109
+
110
+ /**
111
+ * Image with XDebug enabled
112
+ */
113
+ debugImage?: string
119
114
 
120
115
  /**
121
116
  * Configuration file template location
@@ -125,14 +120,16 @@ export interface PHPConfiguration {
125
120
  configTemplate: string
126
121
 
127
122
  /**
128
- * Extensions for PHP
123
+ * PHP-FPM configuration file template location
124
+ *
125
+ * @example ./my-php-fpm-template.conf
129
126
  */
130
- extensions: PHPExtensions & Record<string, PHPExtension>
127
+ fpmConfigTemplate: string
131
128
 
132
129
  /**
133
- * Disabled extension list
130
+ * Extensions for PHP
134
131
  */
135
- disabledExtensions?: string[]
132
+ extensions: PHPExtensions
136
133
  }
137
134
  export interface SSLConfiguration {
138
135
  /**
@@ -172,30 +169,25 @@ export interface CMAConfiguration {
172
169
  */
173
170
  nginx: NginxConfiguration
174
171
 
175
- /**
176
- * MySQL configuration
177
- */
178
- mysql: ServiceWithVersion
179
-
180
172
  /**
181
173
  * MariaDB configuration
182
174
  */
183
- mariadb: ServiceWithVersion
175
+ mariadb: ServiceWithImage
184
176
 
185
177
  /**
186
178
  * ElasticSearch configuration
187
179
  */
188
- elasticsearch: ServiceWithVersion
180
+ elasticsearch: ElasticSearchConfiguration
189
181
 
190
182
  /**
191
183
  * Redis configuration
192
184
  */
193
- redis: ServiceWithVersion
185
+ redis: ServiceWithImage
194
186
 
195
187
  /**
196
188
  * Composer configuration
197
189
  */
198
- composer: ServiceWithVersion
190
+ composer: ComposerConfiguration
199
191
 
200
192
  /**
201
193
  * Varnish configuration
@@ -241,8 +233,8 @@ export interface CMAConfiguration {
241
233
  }
242
234
  /**
243
235
  * Custom host for website base url
244
- * @default 'localhost'
245
- * */
236
+ * @default 'localhost'
237
+ */
246
238
  host: string
247
239
 
248
240
  /**
@@ -261,14 +253,4 @@ export interface CMAConfiguration {
261
253
  * If prefix is set to `false` docker container and volume names will only include folder name **which is not safe and not recommended**.
262
254
  */
263
255
  prefix: boolean
264
-
265
- /**
266
- * Non-overlapping ports config
267
- * @default false
268
- *
269
- * @deprecated Use global configuration file.
270
- * @description If set to `true` CMA will try retrieving others CMA projects port configuration
271
- * and will not use their ports for itself.
272
- */
273
- useNonOverlappingPorts: boolean
274
256
  }