@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,13 +1,19 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { php74 } = require('../php/releases');
3
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
4
+ const { repo } = require('../php/base-repo');
5
+ const { php74 } = require('../php/versions');
4
6
  const { sslTerminator } = require('../ssl-terminator');
5
7
  const { varnish60 } = require('../varnish/varnish-6-0');
6
8
 
7
9
  module.exports = ({ templateDir } = {}) => ({
8
10
  magentoVersion: '2.4.0-p1',
9
11
  configuration: {
10
- php: php74({ templateDir }),
12
+ php: php74({
13
+ templateDir,
14
+ extensions: magento24PHPExtensionList,
15
+ baseImage: `${ repo }:php-7.4-magento-2.4`
16
+ }),
11
17
  nginx: {
12
18
  version: '1.18.0',
13
19
  configTemplate: path.join(templateDir || '', 'nginx.template.conf')
@@ -22,7 +28,7 @@ module.exports = ({ templateDir } = {}) => ({
22
28
  version: '10.2'
23
29
  },
24
30
  elasticsearch: {
25
- version: '7.6.2'
31
+ version: '7.12.1'
26
32
  },
27
33
  composer: {
28
34
  version: '1'
@@ -1,13 +1,19 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { php74 } = require('../php/releases');
3
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
4
+ const { repo } = require('../php/base-repo');
5
+ const { php74 } = require('../php/versions');
4
6
  const { sslTerminator } = require('../ssl-terminator');
5
7
  const { varnish60 } = require('../varnish/varnish-6-0');
6
8
 
7
9
  module.exports = ({ templateDir } = {}) => ({
8
10
  magentoVersion: '2.4.0',
9
11
  configuration: {
10
- php: php74({ templateDir }),
12
+ php: php74({
13
+ templateDir,
14
+ extensions: magento24PHPExtensionList,
15
+ baseImage: `${ repo }:php-7.4-magento-2.4`
16
+ }),
11
17
  nginx: {
12
18
  version: '1.18.0',
13
19
  configTemplate: path.join(templateDir || '', 'nginx.template.conf')
@@ -22,7 +28,7 @@ module.exports = ({ templateDir } = {}) => ({
22
28
  version: '10.2'
23
29
  },
24
30
  elasticsearch: {
25
- version: '7.6.2'
31
+ version: '7.12.1'
26
32
  },
27
33
  composer: {
28
34
  version: '1'
@@ -1,18 +1,19 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.1-p1',
10
12
  configuration: {
11
13
  php: php74({
12
14
  templateDir,
13
- additionalExtensions: {
14
- libsodium
15
- }
15
+ extensions: { ...magento24PHPExtensionList, sodium },
16
+ baseImage: `${ repo }:php-7.4-magento-2.4`
16
17
  }),
17
18
  nginx: {
18
19
  version: '1.18.0',
@@ -1,13 +1,20 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
4
6
  const { sslTerminator } = require('../ssl-terminator');
5
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
6
9
 
7
10
  module.exports = ({ templateDir } = {}) => ({
8
11
  magentoVersion: '2.4.1',
9
12
  configuration: {
10
- php: php74({ templateDir }),
13
+ php: php74({
14
+ templateDir,
15
+ extensions: { ...magento24PHPExtensionList, sodium },
16
+ baseImage: `${ repo }:php-7.4-magento-2.4`
17
+ }),
11
18
  nginx: {
12
19
  version: '1.18.0',
13
20
  configTemplate: path.join(templateDir || '', 'nginx.template.conf')
@@ -1,9 +1,11 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.2-p1',
@@ -11,9 +13,8 @@ module.exports = ({ templateDir } = {}) => ({
11
13
  configuration: {
12
14
  php: php74({
13
15
  templateDir,
14
- additionalExtensions: {
15
- libsodium
16
- }
16
+ extensions: { ...magento24PHPExtensionList, sodium },
17
+ baseImage: `${ repo }:php-7.4-magento-2.4`
17
18
  }),
18
19
  nginx: {
19
20
  version: '1.18.0',
@@ -1,9 +1,11 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.2-p2',
@@ -11,10 +13,8 @@ module.exports = ({ templateDir } = {}) => ({
11
13
  configuration: {
12
14
  php: php74({
13
15
  templateDir,
14
- additionalExtensions: {
15
- libsodium,
16
- fileinfo: {}
17
- }
16
+ extensions: { ...magento24PHPExtensionList, sodium },
17
+ baseImage: `${ repo }:php-7.4-magento-2.4`
18
18
  }),
19
19
  nginx: {
20
20
  version: '1.18.0',
@@ -1,19 +1,19 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.2',
10
12
  configuration: {
11
13
  php: php74({
12
14
  templateDir,
13
- additionalExtensions: {
14
- libsodium,
15
- fileinfo: {}
16
- }
15
+ extensions: { ...magento24PHPExtensionList, sodium },
16
+ baseImage: `${ repo }:php-7.4-magento-2.4`
17
17
  }),
18
18
  nginx: {
19
19
  version: '1.18.0',
@@ -1,9 +1,11 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.3-p1',
@@ -11,10 +13,8 @@ module.exports = ({ templateDir } = {}) => ({
11
13
  configuration: {
12
14
  php: php74({
13
15
  templateDir,
14
- additionalExtensions: {
15
- libsodium,
16
- fileinfo: {}
17
- }
16
+ extensions: { ...magento24PHPExtensionList, sodium },
17
+ baseImage: `${ repo }:php-7.4-magento-2.4`
18
18
  }),
19
19
  nginx: {
20
20
  version: '1.18.0',
@@ -30,7 +30,7 @@ module.exports = ({ templateDir } = {}) => ({
30
30
  version: '10.4'
31
31
  },
32
32
  elasticsearch: {
33
- version: '7.12.1'
33
+ version: '7.16.3'
34
34
  },
35
35
  composer: {
36
36
  version: '2'
@@ -1,9 +1,11 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.3-p2',
@@ -11,10 +13,8 @@ module.exports = ({ templateDir } = {}) => ({
11
13
  configuration: {
12
14
  php: php74({
13
15
  templateDir,
14
- additionalExtensions: {
15
- libsodium,
16
- fileinfo: {}
17
- }
16
+ extensions: { ...magento24PHPExtensionList, sodium },
17
+ baseImage: `${ repo }:php-7.4-magento-2.4`
18
18
  }),
19
19
  nginx: {
20
20
  version: '1.18.0',
@@ -30,7 +30,7 @@ module.exports = ({ templateDir } = {}) => ({
30
30
  version: '10.4'
31
31
  },
32
32
  elasticsearch: {
33
- version: '7.12.1'
33
+ version: '7.16.3'
34
34
  },
35
35
  composer: {
36
36
  version: '2'
@@ -1,9 +1,11 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { libsodium } = require('../php/extensions');
4
- const { php74 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php74 } = require('../php/versions');
5
6
  const { sslTerminator } = require('../ssl-terminator');
6
7
  const { varnish66 } = require('../varnish/varnish-6-6');
8
+ const { repo } = require('../php/base-repo');
7
9
 
8
10
  module.exports = ({ templateDir } = {}) => ({
9
11
  magentoVersion: '2.4.3',
@@ -11,10 +13,8 @@ module.exports = ({ templateDir } = {}) => ({
11
13
  configuration: {
12
14
  php: php74({
13
15
  templateDir,
14
- additionalExtensions: {
15
- libsodium,
16
- fileinfo: {}
17
- }
16
+ extensions: { ...magento24PHPExtensionList, sodium },
17
+ baseImage: `${ repo }:php-7.4-magento-2.4`
18
18
  }),
19
19
  nginx: {
20
20
  version: '1.18.0',
@@ -30,7 +30,7 @@ module.exports = ({ templateDir } = {}) => ({
30
30
  version: '10.4'
31
31
  },
32
32
  elasticsearch: {
33
- version: '7.12.1'
33
+ version: '7.16.3'
34
34
  },
35
35
  composer: {
36
36
  version: '2'
@@ -1,14 +1,21 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
- const { php81 } = require('../php/releases');
3
+ const sodium = require('../php/extensions/sodium');
4
+ const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
5
+ const { php81 } = require('../php/versions');
4
6
  const { sslTerminator } = require('../ssl-terminator');
5
7
  const { varnish70 } = require('../varnish/varnish-7-0');
8
+ const { repo } = require('../php/base-repo');
6
9
 
7
10
  module.exports = ({ templateDir } = {}) => ({
8
11
  magentoVersion: '2.4.4',
9
12
  isDefault: true,
10
13
  configuration: {
11
- php: php81({ templateDir }),
14
+ php: php81({
15
+ templateDir,
16
+ extensions: { ...magento24PHPExtensionList, sodium },
17
+ baseImage: `${ repo }:php-8.1-magento-2.4`
18
+ }),
12
19
  nginx: {
13
20
  version: '1.18.0',
14
21
  configTemplate: path.join(templateDir || '', 'nginx.template.conf')
@@ -1,12 +1,12 @@
1
1
  const { removeCacheFolder } = require('./cache');
2
2
  const { stopServices } = require('./docker');
3
- const { removeVolumes } = require('./docker/volumes');
3
+ const { removeVolumes } = require('./docker/volume/tasks');
4
4
  const {
5
5
  uninstallMagento,
6
6
  removeMagento
7
7
  } = require('./magento');
8
8
  const getMagentoVersionConfig = require('../config/get-magento-version-config');
9
- const { stopPhpFpm } = require('./php-fpm');
9
+ // const { stopPhpFpm } = require('./php-fpm');
10
10
  const getProjectConfiguration = require('../config/get-project-configuration');
11
11
  const checkConfigurationFile = require('../config/check-configuration-file');
12
12
 
@@ -19,7 +19,7 @@ const cleanup = () => ({
19
19
  checkConfigurationFile(),
20
20
  getMagentoVersionConfig(),
21
21
  getProjectConfiguration(),
22
- stopPhpFpm(),
22
+ // stopPhpFpm(),
23
23
  stopServices(),
24
24
  removeVolumes(),
25
25
  removeCacheFolder(),
@@ -1,127 +1,33 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const semver = require('semver');
4
- const logger = require('@scandipwa/scandipwa-dev-utils/logger');
5
- const downloadFile = require('../../util/download-file');
6
- const { execAsyncSpawn } = require('../../util/exec-async-command');
7
- const pathExists = require('../../util/path-exists');
8
1
  const safeRegexExtract = require('../../util/safe-regex-extract');
9
- const installPrestissimo = require('./install-prestissimo');
10
2
  const UnknownError = require('../../errors/unknown-error');
11
- const KnownError = require('../../errors/known-error');
3
+ const { runContainerImage } = require('../../util/run-container-image');
12
4
 
13
5
  /**
14
- * @param {import('../../../typings/context').ListrContext['config']} param0
6
+ * @param {import('../../../typings/context').ListrContext} ctx
15
7
  * @returns {Promise<string>}
16
8
  */
17
- const getComposerVersion = async ({ composer, php }) => {
18
- const composerVersionOutput = await execAsyncSpawn(`${php.binPath} -c ${php.iniPath} ${composer.binPath} --version --no-ansi`);
9
+ const getComposerVersion = async (ctx) => {
10
+ const { php } = ctx.config.docker.getContainers(ctx.ports);
11
+ const composerVersionOutput = await runContainerImage(php.image, 'composer --version --no-ansi');
19
12
 
20
13
  const composerVersion = safeRegexExtract({
21
14
  string: composerVersionOutput,
22
15
  regex: /composer.+(\d+\.\d+\.\d+)/i,
23
16
  onNoMatch: () => {
24
- throw new UnknownError(`
25
- No composer version found in composer version output!\n\n${composerVersionOutput}
26
-
27
- Follow steps below to resolve this issue:
28
- 1. Check ${logger.style.file(path.relative(process.cwd(), composer.binPath))} file content, inside this file should be Composer PHP code.
29
- 2. If file content is not correct, try deleting this file and run ${logger.style.command('start')} command again, CMA will try re-download this file.
30
- 3. If steps above didn't help, manually download Composer version ${composer.version} from ${logger.style.code('https://getcomposer.org/download/')} and put it inside cache directory ${logger.style.file(path.relative(process.cwd(), composer.dirPath))} with ${logger.style.code('composer.phar')} file name.
31
- `);
17
+ throw new UnknownError(`No composer version found in composer version output!\n\n${composerVersionOutput}`);
32
18
  }
33
19
  });
34
20
 
35
21
  return composerVersion;
36
22
  };
37
23
 
38
- /**
39
- * @param {import('../../../typings/context').ListrContext['config']} param0
40
- */
41
- const createComposerDir = async ({ composer }) => {
42
- const dirExists = await pathExists(composer.dirPath);
43
- if (!dirExists) {
44
- await fs.promises.mkdir(composer.dirPath, { recursive: true });
45
- }
46
- };
47
-
48
- /**
49
- * @param {import('../../../typings/context').ListrContext['config']} param0
50
- */
51
- const downloadComposerBinary = async ({ composer }) => {
52
- const composerVersion = /^\d$/.test(composer.version)
53
- ? `latest-${composer.version}.x`
54
- : composer.version;
55
-
56
- try {
57
- await downloadFile(`https://getcomposer.org/download/${composerVersion}/composer.phar`, {
58
- destination: composer.binPath
59
- });
60
- } catch (e) {
61
- throw new UnknownError(
62
- `Unexpected issue, while installing composer.
63
- Please see the error log below.\n\n${e}`
64
- );
65
- }
66
- };
67
-
68
24
  /**
69
25
  * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
70
26
  */
71
- const installComposer = () => ({
72
- title: 'Installing Composer',
27
+ const getComposerVersionTask = () => ({
28
+ title: 'Retrieving Composer version',
73
29
  task: async (ctx, task) => {
74
- const { composer, php } = ctx.config;
75
- const hasComposerInCache = await pathExists(composer.binPath);
76
-
77
- if (!hasComposerInCache) {
78
- task.title = 'Installing Composer';
79
- await createComposerDir({ composer });
80
- await downloadComposerBinary({ composer });
81
- } else {
82
- const currentComposerVersion = await getComposerVersion({ composer, php });
83
- const expectedComposerVersion = /^\d$/.test(composer.version)
84
- ? `${composer.version}.x`
85
- : composer.version;
86
-
87
- if (!semver.satisfies(currentComposerVersion, expectedComposerVersion)) {
88
- const continueComposerBinaryVersionSwitch = await task.prompt({
89
- type: 'Select',
90
- message: `You have Composer ${logger.style.misc(`${currentComposerVersion}`)} while your Magento version requires ${logger.style.misc(expectedComposerVersion)}!`,
91
- choices: [
92
- {
93
- message: `Continue with current installed version (${logger.style.misc(`${currentComposerVersion}`)})`,
94
- name: 'continue'
95
- },
96
- {
97
- message: 'Install correct version and continue (you will probably have to fix composer dependencies versions)',
98
- name: 'install-and-continue'
99
- },
100
- {
101
- message: 'Exit installation.',
102
- name: 'exit'
103
- }
104
- ]
105
- });
106
-
107
- switch (continueComposerBinaryVersionSwitch) {
108
- case 'install-and-continue': {
109
- await downloadComposerBinary({ composer });
110
- break;
111
- }
112
- case 'exit': {
113
- throw new KnownError(`Current composer version ${logger.style.misc(`v${currentComposerVersion}`)} is not compatible with version ${logger.style.misc(expectedComposerVersion)}!`);
114
- }
115
- case 'continue':
116
- default: {
117
- ctx.continueWithExistingComposerVersion = true;
118
- break;
119
- }
120
- }
121
- }
122
- }
123
-
124
- const composerVersion = await getComposerVersion({ composer, php });
30
+ const composerVersion = await getComposerVersion(ctx);
125
31
  task.title = `Using Composer version ${composerVersion}`;
126
32
  ctx.composerVersion = composerVersion;
127
33
  },
@@ -130,4 +36,8 @@ const installComposer = () => ({
130
36
  }
131
37
  });
132
38
 
133
- module.exports = { installComposer, installPrestissimo, getComposerVersion };
39
+ module.exports = {
40
+ getComposerVersionTask,
41
+ // installPrestissimo,
42
+ getComposerVersion
43
+ };
@@ -0,0 +1,117 @@
1
+ const mysql2 = require('mysql2/promise');
2
+ const UnknownError = require('../../errors/unknown-error');
3
+ const { execAsyncSpawn } = require('../../util/exec-async-command');
4
+ const sleep = require('../../util/sleep');
5
+ const { createMagentoDatabase } = require('./create-magento-database');
6
+
7
+ /**
8
+ * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
9
+ */
10
+ const waitForDatabaseInitialization = () => ({
11
+ title: 'Waiting for Database to initialize',
12
+ task: async (ctx, task) => {
13
+ const { mariadb } = ctx.config.docker.getContainers();
14
+
15
+ let databaseReadyForConnections = false;
16
+
17
+ while (!databaseReadyForConnections) {
18
+ const databaseOutput = await execAsyncSpawn(`docker logs ${mariadb.name}`);
19
+ if (databaseOutput.includes('ready for connections')) {
20
+ databaseReadyForConnections = true;
21
+ break;
22
+ } else if (databaseOutput.includes('Initializing database files')) {
23
+ task.output = `${mariadb._} is initializing database files!
24
+ Please wait, this will take some time and do not restart the ${mariadb._} container until initialization is finished!`;
25
+
26
+ let databaseFinishedInitialization = false;
27
+ while (!databaseFinishedInitialization) {
28
+ const databaseOutput2 = await execAsyncSpawn(`docker logs ${mariadb.name}`);
29
+ if (databaseOutput2.includes('init process done.') && !databaseFinishedInitialization) {
30
+ databaseFinishedInitialization = true;
31
+ break;
32
+ }
33
+ await sleep(2000);
34
+ }
35
+ }
36
+
37
+ await sleep(2000);
38
+ }
39
+ },
40
+ options: {
41
+ bottomBar: 10
42
+ }
43
+ });
44
+
45
+ /**
46
+ * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
47
+ */
48
+ const gettingDatabaseConnection = () => ({
49
+ title: 'Getting Database connection',
50
+ task: async (ctx, task) => {
51
+ const { config: { docker }, ports } = ctx;
52
+ const { mariadb } = docker.getContainers(ctx.ports);
53
+ let tries = 0;
54
+ const maxTries = 20;
55
+ const errors = [];
56
+
57
+ while (tries < maxTries) {
58
+ tries++;
59
+ try {
60
+ const connection = await mysql2.createConnection({
61
+ host: '127.0.0.1',
62
+ port: ports.mariadb,
63
+ user: mariadb.env.MARIADB_USER,
64
+ password: mariadb.env.MARIADB_PASSWORD,
65
+ database: mariadb.env.MARIADB_DATABASE
66
+ });
67
+
68
+ ctx.databaseConnection = connection;
69
+ break;
70
+ } catch (e) {
71
+ errors.push(e);
72
+ }
73
+ await sleep(1000);
74
+ }
75
+
76
+ if (tries === maxTries) {
77
+ throw new UnknownError(`Unable to connect to ${ mariadb._ } server. Check your server configuration!\n\n${ errors.join(' ') }`);
78
+ }
79
+
80
+ task.title = `${ mariadb._ } server connected!`;
81
+ }
82
+ });
83
+
84
+ /**
85
+ * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
86
+ */
87
+ const terminatingExistingConnection = () => ({
88
+ title: 'Terminating existing Database connection',
89
+ skip: (ctx) => !ctx.databaseConnection,
90
+ task: (ctx) => {
91
+ ctx.databaseConnection.destroy();
92
+ }
93
+ });
94
+
95
+ /**
96
+ * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
97
+ */
98
+ const connectToDatabase = () => ({
99
+ title: 'Connecting to Database server',
100
+ skip: (ctx) => ctx.skipSetup,
101
+ task: (ctx, task) => task.newListr([
102
+ waitForDatabaseInitialization(),
103
+ createMagentoDatabase(),
104
+ terminatingExistingConnection(),
105
+ gettingDatabaseConnection()
106
+ ], {
107
+ concurrent: false,
108
+ rendererOptions: {
109
+ collapse: true
110
+ }
111
+ }),
112
+ options: {
113
+ bottomBar: 10
114
+ }
115
+ });
116
+
117
+ module.exports = connectToDatabase;
@@ -0,0 +1,18 @@
1
+ const { execAsyncSpawn } = require('../../util/exec-async-command');
2
+
3
+ /**
4
+ * Will create database 'magento' in MariaDB if it does not exist for some reason
5
+ * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
6
+ */
7
+ const createMagentoDatabase = () => ({
8
+ title: 'Creating Magento database',
9
+ task: async (ctx, task) => {
10
+ const { mariadb } = ctx.config.docker.getContainers();
11
+ task.title = `Creating Magento database in ${ mariadb._ }`;
12
+ await execAsyncSpawn(`docker exec ${mariadb.name} mysql -umagento -pmagento -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`);
13
+ }
14
+ });
15
+
16
+ module.exports = {
17
+ createMagentoDatabase
18
+ };
@@ -6,9 +6,9 @@ const { isTableExists } = require('../../util/database');
6
6
  const dumpThemeConfig = () => ({
7
7
  title: 'Dumping themes and theme configuration',
8
8
  task: async (ctx, task) => {
9
- const { mysqlConnection } = ctx;
9
+ const { databaseConnection } = ctx;
10
10
  if (await isTableExists('magento', 'theme', ctx)) {
11
- const [themes] = await mysqlConnection.query('select * from theme;');
11
+ const [themes] = await databaseConnection.query('select * from theme;');
12
12
  if (themes.length === 0) {
13
13
  ctx.themeDump = {
14
14
  themes: [],
@@ -17,7 +17,7 @@ const dumpThemeConfig = () => ({
17
17
  }
18
18
 
19
19
  if (await isTableExists('magento', 'core_config_data', ctx)) {
20
- const [themeIdConfig] = await mysqlConnection.query('select * from core_config_data where path = \'design/theme/theme_id\';');
20
+ const [themeIdConfig] = await databaseConnection.query('select * from core_config_data where path = \'design/theme/theme_id\';');
21
21
  if (themeIdConfig.length !== 0) {
22
22
  ctx.themeDump = {
23
23
  themes,