@scandipwa/magento-scripts 2.4.1 → 2.4.2-alpha.1

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.
@@ -115,7 +115,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
115
115
  : {}
116
116
 
117
117
  /**
118
- * @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions & { _?: string, forwardedPorts?: string[], remoteImages?: string[], connectCommand?: string[], description?: string, pullImage?: boolean, dependsOn?: string[] }>}
118
+ * @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions & { _?: string, forwardedPorts?: string[], remoteImages?: string[], connectCommand?: string[], description?: string, pullImage?: boolean, dependsOn?: string[], serviceReadyLog?: string }>}
119
119
  */
120
120
  const dockerConfig = {
121
121
  php: {
@@ -169,7 +169,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
169
169
  (ctx.platform === 'linux' && isDockerDesktop) ||
170
170
  !isDockerDesktop
171
171
  ? `${os.userInfo().uid}:${os.userInfo().gid}`
172
- : ''
172
+ : '',
173
+ serviceReadyLog: 'ready to handle connections'
173
174
  },
174
175
  phpWithXdebug: {
175
176
  _: 'PHP with Xdebug',
@@ -228,7 +229,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
228
229
  (ctx.platform === 'linux' && isDockerDesktop) ||
229
230
  !isDockerDesktop
230
231
  ? `${os.userInfo().uid}:${os.userInfo().gid}`
231
- : ''
232
+ : '',
233
+ serviceReadyLog: 'ready to handle connections'
232
234
  },
233
235
  sslTerminator: {
234
236
  _: 'SSL Terminator (Nginx)',
@@ -337,7 +339,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
337
339
  redis.version ? `redis:${redis.version}` : redis.image
338
340
  }`,
339
341
  name: `${prefix}_redis`,
340
- connectCommand: ['redis-cli']
342
+ connectCommand: ['redis-cli'],
343
+ serviceReadyLog: 'Ready to accept connections'
341
344
  },
342
345
  mariadb: {
343
346
  _: 'MariaDB',
@@ -423,7 +426,9 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
423
426
  : elasticsearch.image
424
427
  : opensearch.image
425
428
  }`,
426
- name: `${prefix}_${searchengine}`
429
+ name: `${prefix}_${searchengine}`,
430
+ serviceReadyLog:
431
+ searchengine === 'elasticsearch' ? '"started"' : '] started'
427
432
  },
428
433
  maildev: {
429
434
  _: 'MailDev',
@@ -5,6 +5,7 @@ const KnownError = require('../../../errors/known-error')
5
5
  const containerApi = require('./container-api')
6
6
  const { imageApi } = require('../image')
7
7
  const { execAsyncSpawn } = require('../../../util/exec-async-command')
8
+ const waitForLogs = require('../../../util/wait-for-logs')
8
9
 
9
10
  /**
10
11
  * @param {string[]} containers
@@ -154,7 +155,9 @@ const startContainers = () => ({
154
155
  all: true
155
156
  })
156
157
 
157
- const missingContainers = Object.entries(docker.getContainers(ports))
158
+ const containers = docker.getContainers(ports)
159
+
160
+ const missingContainers = Object.entries(containers)
158
161
  .filter(
159
162
  ([nameWithoutPrefix, { name }]) =>
160
163
  !containerList.some((c) => c.Names === name)
@@ -189,7 +192,9 @@ const startContainers = () => ({
189
192
  const startedContainers = []
190
193
  subTask.title = `Container ${
191
194
  container._
192
- } is waiting for ${dependsOn.join(', ')} to start...`
195
+ } is waiting for ${dependsOn
196
+ .map((a) => containers[a]._)
197
+ .join(', ')} to start...`
193
198
  await Promise.all(
194
199
  dependsOn.map(
195
200
  async (name) =>
@@ -217,6 +222,7 @@ const startContainers = () => ({
217
222
  d
218
223
  )
219
224
  )
225
+ .map((d) => containers[d]._)
220
226
  .join(', ')} to start...`
221
227
  clearTimeout(timeout)
222
228
  resolve()
@@ -231,6 +237,13 @@ const startContainers = () => ({
231
237
 
232
238
  await containerApi.run(container)
233
239
 
240
+ if (container.serviceReadyLog) {
241
+ await waitForLogs({
242
+ containerName: container.name,
243
+ matchText: container.serviceReadyLog
244
+ })
245
+ }
246
+
234
247
  containerStatuses[
235
248
  container.nameWithoutPrefix
236
249
  ].started = true
@@ -240,7 +253,7 @@ const startContainers = () => ({
240
253
  cb()
241
254
  })
242
255
 
243
- subTask.output = `${container._} container started`
256
+ subTask.title = `${container._} container started`
244
257
  }
245
258
  })),
246
259
  {
@@ -28,13 +28,16 @@ const createNginxConfig = () => ({
28
28
  }
29
29
 
30
30
  if (isDockerDesktop) {
31
- const containers = docker.getContainers(ports)
31
+ // const containers = docker.getContainers(ports)
32
32
 
33
- networkSettings.phpNetwork = containers.php.name
34
- networkSettings.phpWithXdebugNetwork = containers.phpWithXdebug.name
33
+ // networkSettings.phpNetwork = containers.php.name
34
+ // networkSettings.phpWithXdebugNetwork = containers.phpWithXdebug.name
35
35
 
36
- networkSettings.fpmPort = 9000
37
- networkSettings.fpmXdebugPort = 9000
36
+ networkSettings.phpNetwork = 'host.docker.internal'
37
+ networkSettings.phpWithXdebugNetwork = 'host.docker.internal'
38
+
39
+ // networkSettings.fpmPort = 9000
40
+ // networkSettings.fpmXdebugPort = 9000
38
41
 
39
42
  networkSettings.hostPort = 80
40
43
  }
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.4.1",
6
+ "version": "2.4.2-alpha.1",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -59,5 +59,5 @@
59
59
  "@types/node": "^20.14.11",
60
60
  "@types/yargs": "^17.0.32"
61
61
  },
62
- "gitHead": "54272cb4f12f8684d032dd611027ec4fe3877cab"
62
+ "gitHead": "96732295d12ac0fc5cf37a70aaeec93fb85503d7"
63
63
  }
@@ -118,6 +118,7 @@ export interface ListrContext {
118
118
  command: string
119
119
  connectCommand: string[]
120
120
  dependsOn?: string[]
121
+ serviceReadyLog?: string
121
122
  }
122
123
  >
123
124
  }
@@ -154,4 +155,5 @@ export interface ListrContext {
154
155
  dockerServerData?: DockerVersionResult['Server']
155
156
  dockerClientData?: DockerVersionResult['Client']
156
157
  dockerVersion?: DockerVersionResult['Server']['Version']
158
+ dockerMemoryLimit: number
157
159
  }