@scandipwa/magento-scripts 2.0.4 → 2.0.5

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.
@@ -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
 
@@ -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
@@ -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/
@@ -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(
@@ -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.0.5",
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": "d12aab28f4ee25c341951dd1df962aa84ddf2782"
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