@scandipwa/magento-scripts 2.0.4 → 2.1.0-alpha.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.
Files changed (35) hide show
  1. package/lib/config/docker.js +2 -5
  2. package/lib/config/services/elasticsearch/versions/elasticsearch-7.17.js +1 -1
  3. package/lib/config/services/elasticsearch/versions/elasticsearch-8.4.js +11 -0
  4. package/lib/config/services/elasticsearch/versions/index.js +3 -1
  5. package/lib/config/services/mariadb/versions/index.js +2 -1
  6. package/lib/config/services/mariadb/versions/mariadb-10.2.js +3 -2
  7. package/lib/config/services/mariadb/versions/mariadb-10.3.js +3 -2
  8. package/lib/config/services/mariadb/versions/mariadb-10.4.js +3 -2
  9. package/lib/config/services/mariadb/versions/mariadb-10.6.js +9 -0
  10. package/lib/config/services/mysql/versions/index.js +9 -0
  11. package/lib/config/services/mysql/versions/mysql-5.7.js +8 -0
  12. package/lib/config/services/mysql/versions/mysql-8.0.28.js +8 -0
  13. package/lib/config/services/mysql/versions/mysql-8.0.js +8 -0
  14. package/lib/config/services/php/extensions/xdebug.js +1 -1
  15. package/lib/config/services/php/versions/index.js +2 -1
  16. package/lib/config/services/php/versions/php-8.2.js +31 -0
  17. package/lib/config/services/redis/index.js +2 -1
  18. package/lib/config/services/redis/redis-7.0.js +8 -0
  19. package/lib/config/services/varnish/index.js +2 -1
  20. package/lib/config/services/varnish/varnish-7-1.js +15 -0
  21. package/lib/config/templates/mariadb.template.cnf +6 -0
  22. package/lib/config/templates/varnish.template.vcl +30 -17
  23. package/lib/config/versions/magento-2.4.4-p3.js +48 -0
  24. package/lib/config/versions/magento-2.4.5-p2.js +48 -0
  25. package/lib/config/versions/magento-2.4.6.js +47 -0
  26. package/lib/tasks/docker/project-image-builder.js +0 -1
  27. package/lib/tasks/file-system/create-mariadb-config.js +8 -1
  28. package/lib/tasks/import-dump.js +26 -2
  29. package/lib/tasks/magento/setup-magento/disable-2fa.js +15 -2
  30. package/lib/tasks/requirements/docker/performance.js +0 -1
  31. package/lib/tasks/requirements/docker/version.js +2 -1
  32. package/lib/util/config-file-validator.js +11 -1
  33. package/lib/util/open-browser.js +3 -1
  34. package/package.json +2 -2
  35. package/typings/index.d.ts +11 -4
@@ -46,10 +46,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
46
46
  name: `${prefix}_maildev-data`
47
47
  },
48
48
  composer_cache: {
49
- name: 'composer_cache-data',
50
- opt: {
51
- mode: 'z'
52
- }
49
+ name: 'composer_cache-data'
53
50
  }
54
51
  }
55
52
 
@@ -442,7 +439,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
442
439
  command: `/bin/bash -c "varnishd -a :${
443
440
  isDockerDesktop ? 80 : ports.varnish
444
441
  } -t 600 -f /etc/varnish/default.vcl -s Cache=malloc,2048m -s Transient=malloc,512m -p http_resp_hdr_len=70000 -p http_resp_size=100000 && varnishlog"`,
445
- tmpfs: ['/var/lib/varnish:exec'],
442
+ tmpfs: ['/var/lib/varnish/varnishd:exec'],
446
443
  description: `Varnish HealthCheck status: ${logger.style.command(
447
444
  varnish.healthCheck ? 'enabled' : 'disabled'
448
445
  )}`
@@ -4,7 +4,7 @@ const defaultEnv = require('../default-es-env')
4
4
  * @returns {import('../../../../../typings/index').ElasticSearchConfiguration}
5
5
  */
6
6
  const elasticsearch717 = () => ({
7
- image: 'elasticsearch:7.17.6',
7
+ image: 'elasticsearch:7.17.9',
8
8
  env: defaultEnv
9
9
  })
10
10
 
@@ -0,0 +1,11 @@
1
+ const defaultEnv = require('../default-es-env')
2
+
3
+ /**
4
+ * @returns {import('../../../../../typings/index').ElasticSearchConfiguration}
5
+ */
6
+ const elasticsearch84 = () => ({
7
+ image: 'elasticsearch:8.4.3',
8
+ env: defaultEnv
9
+ })
10
+
11
+ module.exports = elasticsearch84
@@ -6,6 +6,7 @@ const elasticsearch710 = require('./elasticsearch-7.10')
6
6
  const elasticsearch712 = require('./elasticsearch-7.12')
7
7
  const elasticsearch716 = require('./elasticsearch-7.16')
8
8
  const elasticsearch717 = require('./elasticsearch-7.17')
9
+ const elasticsearch84 = require('./elasticsearch-8.4')
9
10
 
10
11
  module.exports = {
11
12
  elasticsearch68,
@@ -15,5 +16,6 @@ module.exports = {
15
16
  elasticsearch710,
16
17
  elasticsearch712,
17
18
  elasticsearch716,
18
- elasticsearch717
19
+ elasticsearch717,
20
+ elasticsearch84
19
21
  }
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  mariadb102: require('./mariadb-10.2'),
3
3
  mariadb103: require('./mariadb-10.3'),
4
- mariadb104: require('./mariadb-10.4')
4
+ mariadb104: require('./mariadb-10.4'),
5
+ mariadb106: require('./mariadb-10.6')
5
6
  }
@@ -1,8 +1,9 @@
1
1
  /**
2
- * @returns {import('../../../../../typings/index').ServiceWithImage}
2
+ * @returns {import('../../../../../typings/index').MariaDBConfiguration}
3
3
  */
4
4
  const mariadb102 = () => ({
5
- image: 'mariadb:10.2'
5
+ image: 'mariadb:10.2',
6
+ useOptimizerSwitch: false
6
7
  })
7
8
 
8
9
  module.exports = mariadb102
@@ -1,8 +1,9 @@
1
1
  /**
2
- * @returns {import('../../../../../typings/index').ServiceWithImage}
2
+ * @returns {import('../../../../../typings/index').MariaDBConfiguration}
3
3
  */
4
4
  const mariadb103 = () => ({
5
- image: 'mariadb:10.3'
5
+ image: 'mariadb:10.3',
6
+ useOptimizerSwitch: false
6
7
  })
7
8
 
8
9
  module.exports = mariadb103
@@ -1,8 +1,9 @@
1
1
  /**
2
- * @returns {import('../../../../../typings/index').ServiceWithImage}
2
+ * @returns {import('../../../../../typings/index').MariaDBConfiguration}
3
3
  */
4
4
  const mariadb104 = () => ({
5
- image: 'mariadb:10.4'
5
+ image: 'mariadb:10.4',
6
+ useOptimizerSwitch: true
6
7
  })
7
8
 
8
9
  module.exports = mariadb104
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @returns {import('../../../../../typings/index').MariaDBConfiguration}
3
+ */
4
+ const mariadb106 = () => ({
5
+ image: 'mariadb:10.6',
6
+ useOptimizerSwitch: true
7
+ })
8
+
9
+ module.exports = mariadb106
@@ -0,0 +1,9 @@
1
+ const mysql57 = require('./mysql-5.7')
2
+ const mysql80 = require('./mysql-8.0')
3
+ const mysql8028 = require('./mysql-8.0.28')
4
+
5
+ module.exports = {
6
+ mysql57,
7
+ mysql80,
8
+ mysql8028
9
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns {import('../../../../../typings/index').ServiceWithImage}
3
+ */
4
+ const mysql57 = () => ({
5
+ image: 'mysql:5.7'
6
+ })
7
+
8
+ module.exports = mysql57
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns {import('../../../../../typings/index').ServiceWithImage}
3
+ */
4
+ const mysql8028 = () => ({
5
+ image: 'mysql:8.0.28'
6
+ })
7
+
8
+ module.exports = mysql8028
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns {import('../../../../../typings/index').ServiceWithImage}
3
+ */
4
+ const mysql80 = () => ({
5
+ image: 'mysql:8.0'
6
+ })
7
+
8
+ module.exports = mysql80
@@ -10,5 +10,5 @@ module.exports = {
10
10
  && pecl install xdebug${version ? `-${version}` : ''} \
11
11
  && docker-php-ext-enable xdebug \
12
12
  && apk del -f .build-deps`,
13
- version: '3.1.5'
13
+ version: '3.1.6'
14
14
  }
@@ -2,5 +2,6 @@ module.exports = {
2
2
  php72: require('./php-7.2'),
3
3
  php73: require('./php-7.3'),
4
4
  php74: require('./php-7.4'),
5
- php81: require('./php-8.1')
5
+ php81: require('./php-8.1'),
6
+ php82: require('./php-8.2')
6
7
  }
@@ -0,0 +1,31 @@
1
+ const path = require('path')
2
+ const { repo } = require('../base-repo')
3
+ const xdebug = require('../extensions/xdebug')
4
+
5
+ /**
6
+ * @param {Object} param0
7
+ * @param {string} param0.templateDir
8
+ * @param {import('../../../../../typings/index').PHPExtensions} [param0.extensions]
9
+ * @param {string} [param0.baseImage]
10
+ * @returns {import('../../../../../typings/index').PHPConfiguration}
11
+ */
12
+ const php82 = ({
13
+ templateDir,
14
+ extensions = {},
15
+ baseImage = `${repo}:php-8.2`
16
+ }) => ({
17
+ baseImage,
18
+ debugImage: `${baseImage}-debug`,
19
+ configTemplate: path.join(templateDir || '', 'php.template.ini'),
20
+ fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
21
+ debugTemplate: path.join(templateDir || '', 'php-debug.template.ini'),
22
+ extensions: {
23
+ xdebug: {
24
+ ...xdebug,
25
+ version: '3.2.1'
26
+ },
27
+ ...extensions
28
+ }
29
+ })
30
+
31
+ module.exports = php82
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  redis50: require('./redis-5.0'),
3
3
  redis60: require('./redis-6.0'),
4
- redis62: require('./redis-6.2')
4
+ redis62: require('./redis-6.2'),
5
+ redis70: require('./redis-7.0')
5
6
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns {import('../../../../typings/index').ServiceWithImage}
3
+ */
4
+ const redis70 = () => ({
5
+ image: 'redis:7.0-alpine'
6
+ })
7
+
8
+ module.exports = redis70
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  varnish60: require('./varnish-6-0'),
3
3
  varnish66: require('./varnish-6-6'),
4
- varnish70: require('./varnish-7-0')
4
+ varnish70: require('./varnish-7-0'),
5
+ varnish71: require('./varnish-7-1')
5
6
  }
@@ -0,0 +1,15 @@
1
+ const path = require('path')
2
+
3
+ /**
4
+ * @param {Object} param0
5
+ * @param {string} param0.templateDir
6
+ * @returns {import('../../../../typings/index').VarnishConfiguration}
7
+ */
8
+ const varnish71 = ({ templateDir }) => ({
9
+ enabled: true,
10
+ healthCheck: false,
11
+ image: 'varnish:7.1',
12
+ configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
13
+ })
14
+
15
+ module.exports = varnish71
@@ -187,7 +187,13 @@ key_buffer = 16M
187
187
  [mariadb]
188
188
  skip-host-cache
189
189
  skip-name-resolve
190
+ <% if (it.config.useOptimizerSwitch) { %>
191
+ <% if (typeof it.config.useOptimizerSwitch === 'string') { %>
192
+ optimizer_switch='<%= it.config.useOptimizerSwitch %>'
193
+ <% } else { %>
190
194
  optimizer_switch='rowid_filter=off'
195
+ <% } %>
196
+ <% } %>
191
197
  optimizer_use_condition_selectivity=1
192
198
 
193
199
  !includedir /etc/mysql/conf.d/
@@ -134,8 +134,8 @@ sub vcl_recv {
134
134
  unset req.http.Cookie;
135
135
  }
136
136
 
137
- # Authenticated GraphQL requests should not be cached by default
138
- if (req.url ~ "/graphql" && req.http.Authorization ~ "^Bearer") {
137
+ # Bypass authenticated GraphQL requests without a X-Magento-Cache-Id
138
+ if (req.url ~ "/graphql" && !req.http.X-Magento-Cache-Id && req.http.Authorization ~ "^Bearer") {
139
139
  return (pass);
140
140
  }
141
141
 
@@ -143,7 +143,7 @@ sub vcl_recv {
143
143
  }
144
144
 
145
145
  sub vcl_hash {
146
- if (req.http.cookie ~ "X-Magento-Vary=") {
146
+ if ((req.url !~ "/graphql" || !req.http.X-Magento-Cache-Id) && req.http.cookie ~ "X-Magento-Vary=") {
147
147
  hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
148
148
  }
149
149
 
@@ -158,6 +158,15 @@ sub vcl_hash {
158
158
  }
159
159
 
160
160
  sub process_graphql_headers {
161
+ if (req.http.X-Magento-Cache-Id) {
162
+ hash_data(req.http.X-Magento-Cache-Id);
163
+
164
+ # When the frontend stops sending the auth token, make sure users stop getting results cached for logged-in users
165
+ if (req.http.Authorization ~ "^Bearer") {
166
+ hash_data("Authorized");
167
+ }
168
+ }
169
+
161
170
  if (req.http.Store) {
162
171
  hash_data(req.http.Store);
163
172
  }
@@ -182,12 +191,10 @@ sub vcl_backend_response {
182
191
  set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
183
192
  }
184
193
 
185
- # cache only successfully responses and 404s
186
- if (beresp.status != 200 && beresp.status != 404) {
187
- set beresp.ttl = 0s;
188
- set beresp.uncacheable = true;
189
- return (deliver);
190
- } elsif (beresp.http.Cache-Control ~ "private") {
194
+ # cache only successfully responses and 404s that are not marked as private
195
+ if (beresp.status != 200 &&
196
+ beresp.status != 404 &&
197
+ beresp.http.Cache-Control ~ "private") {
191
198
  set beresp.uncacheable = true;
192
199
  set beresp.ttl = 86400s;
193
200
  return (deliver);
@@ -207,21 +214,23 @@ sub vcl_backend_response {
207
214
  # Mark as Hit-For-Pass for the next 2 minutes
208
215
  set beresp.ttl = 120s;
209
216
  set beresp.uncacheable = true;
217
+ }
218
+
219
+ # If the cache key in the Magento response doesn't match the one that was sent in the request, don't cache under the request's key
220
+ if (bereq.url ~ "/graphql" && bereq.http.X-Magento-Cache-Id && bereq.http.X-Magento-Cache-Id != beresp.http.X-Magento-Cache-Id) {
221
+ set beresp.ttl = 0s;
222
+ set beresp.uncacheable = true;
210
223
  }
211
224
 
212
225
  return (deliver);
213
226
  }
214
227
 
215
228
  sub vcl_deliver {
216
- if (resp.http.X-Magento-Debug) {
217
- if (resp.http.x-varnish ~ " ") {
218
- set resp.http.X-Magento-Cache-Debug = "HIT";
219
- set resp.http.Grace = req.http.grace;
220
- } else {
221
- set resp.http.X-Magento-Cache-Debug = "MISS";
222
- }
229
+ if (resp.http.x-varnish ~ " ") {
230
+ set resp.http.X-Magento-Cache-Debug = "HIT";
231
+ set resp.http.Grace = req.http.grace;
223
232
  } else {
224
- unset resp.http.Age;
233
+ set resp.http.X-Magento-Cache-Debug = "MISS";
225
234
  }
226
235
 
227
236
  # Not letting browser to cache non-static files.
@@ -231,6 +240,10 @@ sub vcl_deliver {
231
240
  set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
232
241
  }
233
242
 
243
+ if (!resp.http.X-Magento-Debug) {
244
+ unset resp.http.Age;
245
+ }
246
+
234
247
  unset resp.http.X-Magento-Debug;
235
248
  unset resp.http.X-Magento-Tags;
236
249
  unset resp.http.X-Powered-By;
@@ -0,0 +1,48 @@
1
+ const { defaultMagentoConfig } = require('../magento-config')
2
+ const sodium = require('../services/php/extensions/sodium')
3
+ const {
4
+ magento24PHPExtensionList
5
+ } = require('../magento/required-php-extensions')
6
+ const { php81 } = require('../services/php/versions')
7
+ const { sslTerminator } = require('../services/ssl-terminator')
8
+ const { varnish71 } = require('../services/varnish')
9
+ const { repo } = require('../services/php/base-repo')
10
+ const { nginx118 } = require('../services/nginx/versions')
11
+ const { composer2 } = require('../services/composer/versions')
12
+ const { maildev } = require('../services/maildev')
13
+ const { redis62 } = require('../services/redis')
14
+ const { mariadb104 } = require('../services/mariadb/versions')
15
+ const { elasticsearch717 } = require('../services/elasticsearch/versions')
16
+
17
+ /**
18
+ * @param {Object} param0
19
+ * @param {string} param0.templateDir
20
+ * @returns {import('../../../typings/index').CMAConfiguration & { magentoVersion: string, isDefault?: boolean }}
21
+ */
22
+ module.exports = ({ templateDir }) => ({
23
+ magentoVersion: '2.4.4-p3',
24
+ isDefault: true,
25
+ configuration: {
26
+ php: php81({
27
+ templateDir,
28
+ extensions: { ...magento24PHPExtensionList, sodium },
29
+ baseImage: `${repo}:php-8.1-magento-2.4`
30
+ }),
31
+ nginx: nginx118({ templateDir }),
32
+ redis: redis62(),
33
+ mysql: {
34
+ version: '8.0'
35
+ },
36
+ mariadb: mariadb104(),
37
+ elasticsearch: elasticsearch717(),
38
+ composer: composer2(),
39
+ varnish: varnish71({ templateDir }),
40
+ sslTerminator: sslTerminator({ templateDir }),
41
+ maildev: maildev()
42
+ },
43
+ magento: defaultMagentoConfig,
44
+ host: 'localhost',
45
+ ssl: {
46
+ enabled: false
47
+ }
48
+ })
@@ -0,0 +1,48 @@
1
+ const { defaultMagentoConfig } = require('../magento-config')
2
+ const sodium = require('../services/php/extensions/sodium')
3
+ const {
4
+ magento24PHPExtensionList
5
+ } = require('../magento/required-php-extensions')
6
+ const { php81 } = require('../services/php/versions')
7
+ const { sslTerminator } = require('../services/ssl-terminator')
8
+ const { varnish71 } = require('../services/varnish')
9
+ const { repo } = require('../services/php/base-repo')
10
+ const { nginx118 } = require('../services/nginx/versions')
11
+ const { composer2 } = require('../services/composer/versions')
12
+ const { maildev } = require('../services/maildev')
13
+ const { redis62 } = require('../services/redis')
14
+ const { mariadb104 } = require('../services/mariadb/versions')
15
+ const { elasticsearch717 } = require('../services/elasticsearch/versions')
16
+
17
+ /**
18
+ * @param {Object} param0
19
+ * @param {string} param0.templateDir
20
+ * @returns {import('../../../typings/index').CMAConfiguration & { magentoVersion: string, isDefault?: boolean }}
21
+ */
22
+ module.exports = ({ templateDir }) => ({
23
+ magentoVersion: '2.4.5-p2',
24
+ isDefault: true,
25
+ configuration: {
26
+ php: php81({
27
+ templateDir,
28
+ extensions: { ...magento24PHPExtensionList, sodium },
29
+ baseImage: `${repo}:php-8.1-magento-2.4`
30
+ }),
31
+ nginx: nginx118({ templateDir }),
32
+ redis: redis62(),
33
+ mysql: {
34
+ version: '8.0'
35
+ },
36
+ mariadb: mariadb104(),
37
+ elasticsearch: elasticsearch717(),
38
+ composer: composer2(),
39
+ varnish: varnish71({ templateDir }),
40
+ sslTerminator: sslTerminator({ templateDir }),
41
+ maildev: maildev()
42
+ },
43
+ magento: defaultMagentoConfig,
44
+ host: 'localhost',
45
+ ssl: {
46
+ enabled: false
47
+ }
48
+ })
@@ -0,0 +1,47 @@
1
+ const { defaultMagentoConfig } = require('../magento-config')
2
+ const sodium = require('../services/php/extensions/sodium')
3
+ const {
4
+ magento24PHPExtensionList
5
+ } = require('../magento/required-php-extensions')
6
+ const { php81 } = require('../services/php/versions')
7
+ const { sslTerminator } = require('../services/ssl-terminator')
8
+ const { varnish71 } = require('../services/varnish')
9
+ const { repo } = require('../services/php/base-repo')
10
+ const { nginx118 } = require('../services/nginx/versions')
11
+ const { composer2 } = require('../services/composer/versions')
12
+ const { maildev } = require('../services/maildev')
13
+ const { redis70 } = require('../services/redis')
14
+ const { mariadb104 } = require('../services/mariadb/versions')
15
+ const { elasticsearch84 } = require('../services/elasticsearch/versions')
16
+ const { mysql80 } = require('../services/mysql/versions')
17
+
18
+ /**
19
+ * @param {Object} param0
20
+ * @param {string} param0.templateDir
21
+ * @returns {import('../../../typings/index').CMAConfiguration & { magentoVersion: string, isDefault?: boolean }}
22
+ */
23
+ module.exports = ({ templateDir }) => ({
24
+ magentoVersion: '2.4.6',
25
+ isDefault: true,
26
+ configuration: {
27
+ php: php81({
28
+ templateDir,
29
+ extensions: { ...magento24PHPExtensionList, sodium },
30
+ baseImage: `${repo}:php-8.1-magento-2.4`
31
+ }),
32
+ nginx: nginx118({ templateDir }),
33
+ redis: redis70(),
34
+ mysql: mysql80(),
35
+ mariadb: mariadb104(),
36
+ elasticsearch: elasticsearch84(),
37
+ composer: composer2(),
38
+ varnish: varnish71({ templateDir }),
39
+ sslTerminator: sslTerminator({ templateDir }),
40
+ maildev: maildev()
41
+ },
42
+ magento: defaultMagentoConfig,
43
+ host: 'localhost',
44
+ ssl: {
45
+ enabled: false
46
+ }
47
+ })
@@ -14,7 +14,6 @@ const { imageApi } = require('./image')
14
14
  const getEnabledExtensionsFromImage = async (imageWithTag) => {
15
15
  const output = await runContainerImage(
16
16
  imageWithTag,
17
-
18
17
  `php -r 'foreach (get_loaded_extensions() as $extension) echo "$extension:" . phpversion($extension) . "\n";'`
19
18
  )
20
19
 
@@ -18,7 +18,14 @@ const createMariaDBConfig = () => ({
18
18
  ctx.config.baseConfig.templateDir,
19
19
  'mariadb.template.cnf'
20
20
  ),
21
- overwrite: true
21
+ overwrite: true,
22
+ templateArgs: {
23
+ config: {
24
+ useOptimizerSwitch:
25
+ ctx.config.overridenConfiguration.configuration
26
+ .mariadb.useOptimizerSwitch
27
+ }
28
+ }
22
29
  })
23
30
  } catch (e) {
24
31
  throw new UnknownError(
@@ -49,10 +49,34 @@ const importDump = () => ({
49
49
 
50
50
  return tableCount !== 0 || !isFsMatching
51
51
  },
52
- task: (subCtx, subTask) =>
53
- subTask.newListr(
52
+ task: async (subCtx, subTask) => {
53
+ const doYouWantToRunSetupOnEmptyDB =
54
+ await subTask.prompt({
55
+ type: 'Select',
56
+ message: `We detected that Magento is not installed in database. Do you want to install Magento in database BEFORE importing database dump?`,
57
+ choices: [
58
+ {
59
+ name: 'try-install',
60
+ message:
61
+ 'Try installing Magento before importing database'
62
+ },
63
+ {
64
+ name: 'skip',
65
+ message:
66
+ 'Skip installing Magento and import database dump right away!'
67
+ }
68
+ ]
69
+ })
70
+
71
+ if (doYouWantToRunSetupOnEmptyDB === 'skip') {
72
+ subTask.skip()
73
+ return
74
+ }
75
+
76
+ return subTask.newListr(
54
77
  setupMagento({ onlyInstallMagento: true })
55
78
  )
79
+ }
56
80
  },
57
81
  dumpThemeConfig(),
58
82
  importDumpToDatabase(),
@@ -9,12 +9,25 @@ module.exports = () => ({
9
9
  task: async (ctx, task) => {
10
10
  const { modules } = await configPhpToJson(ctx)
11
11
 
12
- if (
12
+ const isMagentoTFAEnabled =
13
13
  modules.Magento_TwoFactorAuth !== undefined &&
14
14
  modules.Magento_TwoFactorAuth !== 0
15
- ) {
15
+
16
+ const isMagentoAdminAdobeImsTwoFactorAuthEnabled =
17
+ modules.Magento_AdminAdobeImsTwoFactorAuth !== undefined &&
18
+ modules.Magento_AdminAdobeImsTwoFactorAuth !== 0
19
+
20
+ if (isMagentoAdminAdobeImsTwoFactorAuthEnabled) {
21
+ await runMagentoCommand(
22
+ ctx,
23
+ 'module:disable Magento_AdminAdobeImsTwoFactorAuth'
24
+ )
25
+ }
26
+ if (isMagentoTFAEnabled) {
16
27
  await runMagentoCommand(ctx, 'module:disable Magento_TwoFactorAuth')
28
+ }
17
29
 
30
+ if (isMagentoAdminAdobeImsTwoFactorAuthEnabled || isMagentoTFAEnabled) {
18
31
  return
19
32
  }
20
33
 
@@ -17,7 +17,6 @@ const dockerSettingsJsonPath = path.join(
17
17
  */
18
18
  const checkDockerPerformance = () => ({
19
19
  title: 'Checking Docker Performance',
20
-
21
20
  skip: async (ctx) =>
22
21
  ctx.platform !== 'darwin' ||
23
22
  (ctx.platform === 'darwin' &&
@@ -15,7 +15,8 @@ const getDockerVersion = () => ({
15
15
  ctx.dockerClientData = dockerVersion.Client
16
16
  ctx.dockerVersion = dockerVersion.Server.Version
17
17
  ctx.isDockerDesktop =
18
- dockerVersion.Server.Platform.Name.includes('Desktop')
18
+ dockerVersion.Server.Platform.Name.includes('Desktop') ||
19
+ dockerVersion.Client.Os === 'darwin'
19
20
  } else {
20
21
  throw new UnknownError(
21
22
  `Got unexpected result during Docker version retrieval!\n\n${dockerVersion}`
@@ -108,6 +108,16 @@ const serviceConfigurationSchema = Joi.object({
108
108
  image: Joi.string().optional()
109
109
  })
110
110
 
111
+ /**
112
+ * @type {Joi.ObjectSchema<import('../../typings').MariaDBConfiguration>}
113
+ */
114
+ const mariadbConfigurationSchema = Joi.object({
115
+ image: Joi.string().optional(),
116
+ useOptimizerSwitch: Joi.alternatives()
117
+ .try(Joi.string(), Joi.boolean())
118
+ .optional()
119
+ })
120
+
111
121
  /**
112
122
  * @type {Joi.ObjectSchema<import('../../typings').ElasticSearchConfiguration>}
113
123
  */
@@ -145,7 +155,7 @@ const composerConfigurationSchema = Joi.object({
145
155
  const configurationSchema = Joi.object({
146
156
  php: phpConfigurationSchema.optional(),
147
157
  nginx: nginxConfigurationSchema.optional(),
148
- mariadb: serviceConfigurationSchema.optional(),
158
+ mariadb: mariadbConfigurationSchema.optional(),
149
159
  elasticsearch: elasticsearchConfigurationSchema.optional(),
150
160
  redis: serviceConfigurationSchema.optional(),
151
161
  composer: composerConfigurationSchema.optional(),
@@ -1,12 +1,14 @@
1
1
  const { execAsync } = require('./exec-async')
2
2
 
3
+ // eslint-disable-next-line no-control-regex
4
+ const consoleStyleReplacer = /[\u001b]\[\S+?m/g
3
5
  /**
4
6
  * @param {string} url
5
7
  */
6
8
  const openBrowser = async (url) => {
7
9
  const start = process.platform === 'darwin' ? 'open' : 'xdg-open'
8
10
 
9
- await execAsync(`${start} ${url}`)
11
+ await execAsync(`${start} ${url.replace(consoleStyleReplacer, '')}`)
10
12
  }
11
13
 
12
14
  module.exports = openBrowser
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": "2.0.4",
6
+ "version": "2.1.0-alpha.0",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -58,5 +58,5 @@
58
58
  "devDependencies": {
59
59
  "@types/yargs": "^17.0.13"
60
60
  },
61
- "gitHead": "0938871489021e7a165a42b24d45775107a32870"
61
+ "gitHead": "889405f4c430f5a89f31ddd7bd0caf7beed2ec90"
62
62
  }
@@ -16,6 +16,15 @@ export interface ServiceWithImage {
16
16
  image: string
17
17
  }
18
18
 
19
+ export interface MariaDBConfiguration extends ServiceWithImage {
20
+ /**
21
+ * Use MariaDB [optimizer-switch](https://mariadb.com/kb/en/optimizer-switch/) configuration.
22
+ *
23
+ * Allows to be boolean or custom value that will be set in the template
24
+ */
25
+ useOptimizerSwitch?: boolean | string
26
+ }
27
+
19
28
  export interface SSLTerminatorConfiguration extends ServiceWithImage {
20
29
  /**
21
30
  * Configuration file location
@@ -230,7 +239,7 @@ export interface CMAConfiguration {
230
239
  /**
231
240
  * MariaDB configuration
232
241
  */
233
- mariadb: ServiceWithImage
242
+ mariadb: MariaDBConfiguration
234
243
 
235
244
  /**
236
245
  * ElasticSearch configuration
@@ -265,9 +274,7 @@ export interface CMAConfiguration {
265
274
  /**
266
275
  * @deprecated MySQL configuration
267
276
  */
268
- mysql: {
269
- version: string
270
- }
277
+ mysql: ServiceWithImage
271
278
  }
272
279
  /**
273
280
  * Magento configuration