@scandipwa/magento-scripts 2.4.9-alpha.0 → 2.4.9-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.
@@ -15,9 +15,9 @@ const transformEnvValue = (value) => {
15
15
  const envArguments = []
16
16
 
17
17
  for (const [key, val] of Object.entries(value)) {
18
- if (typeof val === 'string') {
18
+ if (typeof val === 'string' && val) {
19
19
  envArguments.push(`--env ${key}='${val.replaceAll("'", "\\'")}'`)
20
- } else {
20
+ } else if (String(val)) {
21
21
  envArguments.push(`--env ${key}=${val}`)
22
22
  }
23
23
  }
@@ -189,11 +189,9 @@ const buildDockerFileInstructions = async (
189
189
  addgroup www-data ${username}`
190
190
  )
191
191
 
192
- if (ctx.isDockerDesktop) {
193
- dockerFileInstructions.run(
194
- `chown -R ${username}:${username} /composer/home/cache`
195
- )
196
- }
192
+ dockerFileInstructions.run(
193
+ `chown -R ${username}:${username} /composer/home/cache`
194
+ )
197
195
  }
198
196
 
199
197
  dockerFileInstructions.workDir(ctx.config.baseConfig.containerMagentoDir)
@@ -6,6 +6,7 @@ import { ListrContext } from '../../typings/context'
6
6
  interface ExecAsyncSpawnOptions<T extends boolean> {
7
7
  callback?: (result: string) => void
8
8
  pipeInput?: boolean
9
+ pipeOutput?: boolean
9
10
  logOutput?: boolean
10
11
  cwd?: string
11
12
  withCode?: T
@@ -12,6 +12,7 @@ const execAsyncSpawn = (
12
12
  {
13
13
  callback,
14
14
  pipeInput,
15
+ pipeOutput,
15
16
  logOutput = false,
16
17
  cwd,
17
18
  withCode = false,
@@ -23,7 +24,11 @@ const execAsyncSpawn = (
23
24
  * @type {import('child_process').SpawnOptionsWithoutStdio}
24
25
  */
25
26
  const spawnOptions = {
26
- stdio: pipeInput ? ['inherit', 'pipe', 'pipe'] : 'pipe',
27
+ stdio: pipeInput
28
+ ? ['inherit', 'pipe', 'pipe']
29
+ : pipeOutput
30
+ ? 'inherit'
31
+ : 'pipe',
27
32
  cwd,
28
33
  env
29
34
  }
@@ -74,8 +79,10 @@ const execAsyncSpawn = (
74
79
  }
75
80
  }
76
81
 
77
- childProcess.stdout.on('data', addChunk)
78
- childProcess.stderr.on('data', addChunk)
82
+ if (!pipeOutput) {
83
+ childProcess.stdout.on('data', addChunk)
84
+ childProcess.stderr.on('data', addChunk)
85
+ }
79
86
 
80
87
  childProcess.on('error', (error) => {
81
88
  reject(error)
@@ -1,8 +1,5 @@
1
1
  const { spawn } = require('child_process')
2
- const {
3
- runCommand,
4
- execCommand
5
- } = require('../tasks/docker/containers/container-api')
2
+ const { execCommand, run } = require('../tasks/docker/containers/container-api')
6
3
 
7
4
  /**
8
5
  * @param {{ containerName: string, commands: string[], user?: string }} param0
@@ -36,30 +33,29 @@ const executeInContainer = ({ containerName, commands, user }) => {
36
33
  * @param {import('../tasks/docker/containers/container-api').ContainerRunOptions} options
37
34
  * @param {string[]} commands
38
35
  */
39
- const runInContainer = (options, commands) => {
36
+ const runInContainer = async (options, commands) => {
40
37
  if (!process.stdin.isTTY) {
41
38
  process.stderr.write('This app works only in TTY mode')
42
39
  process.exit(1)
43
40
  }
44
41
 
45
- const runArgs = runCommand({
46
- ...options,
47
- tty: true,
48
- detach: false,
49
- rm: true
50
- })
51
-
52
42
  const [commandBin, ...commandsArgs] = commands
53
43
 
54
- const [command, ...args] = runArgs
44
+ const runResult = await run(
45
+ {
46
+ ...options,
47
+ command: `${commandBin} ${commandsArgs.join(' ')}`,
48
+ tty: true,
49
+ detach: false,
50
+ rm: true
51
+ },
52
+ {
53
+ withCode: true,
54
+ pipeOutput: true
55
+ }
56
+ )
55
57
 
56
- const child = spawn(command, [...args, commandBin, ...commandsArgs], {
57
- stdio: 'inherit'
58
- })
59
-
60
- child.on('close', (code) => {
61
- process.exit(code)
62
- })
58
+ process.exit(runResult.code)
63
59
  }
64
60
 
65
61
  module.exports = {
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.9-alpha.0",
6
+ "version": "2.4.9-alpha.2",
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": "70cc10b1dbc83ddd0917ae02fef3b09e8bcaba52"
62
+ "gitHead": "d65444c5a20dab91d6b66534e8e997133aafd0f1"
63
63
  }