@scandipwa/magento-scripts 2.4.0-alpha.0 → 2.4.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.
- package/exec.js +2 -2
- package/index.js +1 -0
- package/lib/commands/cli.js +17 -19
- package/lib/commands/execute.js +8 -4
- package/lib/commands/start.js +0 -6
- package/lib/config/docker.js +196 -79
- package/lib/config/get-project-configuration.js +0 -5
- package/lib/config/php-config.js +4 -0
- package/lib/config/port-config.js +47 -10
- package/lib/config/services/composer/versions/composer-2.8.js +1 -1
- package/lib/config/services/elasticsearch/default-es-env.js +1 -1
- package/lib/config/services/elasticsearch/versions/elasticsearch-8.17.js +14 -0
- package/lib/config/services/elasticsearch/versions/index.js +3 -1
- package/lib/config/services/mariadb/versions/index.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.2.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.3.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.4.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.6.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-11.4.js +11 -0
- package/lib/config/services/mariadb/versions/mariadb-11.6.js +11 -0
- package/lib/config/services/opensearch/default-os-env.js +1 -1
- package/lib/config/services/opensearch/versions/index.js +3 -1
- package/lib/config/services/opensearch/versions/opensearch-2.19.js +14 -0
- package/lib/config/services/php/extensions/ftp.js +7 -0
- package/lib/config/services/php/extensions/xdebug.js +1 -0
- package/lib/config/services/php/versions/index.js +2 -1
- package/lib/config/services/php/versions/php-7.2.js +0 -1
- package/lib/config/services/php/versions/php-7.3.js +0 -1
- package/lib/config/services/php/versions/php-7.4.js +0 -1
- package/lib/config/services/php/versions/php-8.1.js +4 -2
- package/lib/config/services/php/versions/php-8.2.js +1 -2
- package/lib/config/services/php/versions/php-8.3.js +32 -0
- package/lib/config/services/redis/index.js +6 -1
- package/lib/config/services/redis/valkey-8.0.js +8 -0
- package/lib/config/services/redis/valkey-8.1.js +8 -0
- package/lib/config/services/varnish/varnish-6-0.js +1 -1
- package/lib/config/services/varnish/varnish-6-6.js +1 -1
- package/lib/config/services/varnish/varnish-7-0.js +1 -1
- package/lib/config/services/varnish/varnish-7-1.js +1 -1
- package/lib/config/services/varnish/varnish-7-3.js +1 -1
- package/lib/config/services/varnish/varnish-7-4.js +1 -1
- package/lib/config/services/varnish/varnish-7-5.js +1 -1
- package/lib/config/services/varnish/varnish-7-6.js +1 -1
- package/lib/config/templates/nginx.template.conf +32 -9
- package/lib/config/templates/php-fpm.template.conf +1 -1
- package/lib/config/templates/ssl-terminator.template.conf +3 -1
- package/lib/config/versions/magento-2.4.4-p13.js +40 -0
- package/lib/config/versions/magento-2.4.5-p12.js +40 -0
- package/lib/config/versions/magento-2.4.6-p10.js +40 -0
- package/lib/config/versions/magento-2.4.7-p4.js +0 -1
- package/lib/config/versions/magento-2.4.7-p5.js +41 -0
- package/lib/config/versions/magento-2.4.8.js +43 -0
- package/lib/tasks/database/create-magento-database.js +6 -4
- package/lib/tasks/database/import-remote-db/ssh/index.js +1 -1
- package/lib/tasks/database/import-remote-db/ssh/readymage.js +1 -1
- package/lib/tasks/database/import-remote-db/ssh/regular-server.js +1 -1
- package/lib/tasks/docker/containers/container-api.d.ts +14 -3
- package/lib/tasks/docker/containers/container-api.js +16 -9
- package/lib/tasks/docker/containers/tasks.js +99 -28
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +14 -22
- package/lib/tasks/docker/project-image-builder.js +153 -91
- package/lib/tasks/docker/system/system-api.d.ts +66 -0
- package/lib/tasks/docker/system/system-api.js +28 -1
- package/lib/tasks/execute.js +10 -10
- package/lib/tasks/file-system/create-nginx-config.js +22 -8
- package/lib/tasks/file-system/create-php-debug-config.js +1 -2
- package/lib/tasks/file-system/create-php-fpm-debug-config.js +33 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +5 -5
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +2 -2
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +4 -3
- package/lib/tasks/file-system/create-ssl-terminator-config.js +46 -7
- package/lib/tasks/file-system/index.js +2 -0
- package/lib/tasks/magento/install-magento-project.js +40 -24
- package/lib/tasks/magento/setup-magento/check-file-permissions.php +32 -0
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/magento/setup-magento/make-magento-binaries-executable.js +44 -0
- package/lib/tasks/magento/setup-magento/setup-file-permissions.js +160 -0
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +0 -1
- package/lib/tasks/php/php-container.d.ts +3 -3
- package/lib/tasks/php/php-container.js +22 -18
- package/lib/tasks/php/update-env-php.js +7 -14
- package/lib/tasks/project-config/index.js +0 -3
- package/lib/tasks/requirements/cgroup-version.js +69 -0
- package/lib/tasks/requirements/elasticsearch-version.js +23 -7
- package/lib/tasks/requirements/index.js +3 -0
- package/lib/tasks/requirements/opensearch-version.js +5 -5
- package/lib/tasks/requirements/searchengine-version.js +1 -2
- package/lib/tasks/start.js +2 -13
- package/lib/util/dockerfile-builder/build-instructions.js +5 -1
- package/lib/util/dockerfile-builder/types.d.ts +1 -1
- package/lib/util/execute-in-container.js +14 -8
- package/lib/util/get-installed-magento-version.js +60 -2
- package/lib/util/portscanner.js +3 -3
- package/lib/util/run-composer.js +1 -1
- package/lib/util/run-magento.js +2 -1
- package/lib/util/run-php.js +2 -1
- package/lib/util/set-config.js +4 -2
- package/package.json +16 -16
- package/typings/context.d.ts +13 -5
- package/typings/index.d.ts +10 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { getPort } = require('../../config/port-config')
|
|
2
|
+
const KnownError = require('../../errors/known-error')
|
|
2
3
|
const UnknownError = require('../../errors/unknown-error')
|
|
3
4
|
const { containerApi } = require('../docker/containers')
|
|
4
5
|
|
|
@@ -26,10 +27,10 @@ const checkElasticSearchVersion = () => ({
|
|
|
26
27
|
elasticSearchContainerRunning.length !== 0 &&
|
|
27
28
|
elasticSearchContainerRunning[0].State === 'running'
|
|
28
29
|
) {
|
|
29
|
-
elasticSearchVersionResponse = await containerApi.exec(
|
|
30
|
-
'elasticsearch --version',
|
|
31
|
-
elasticSearchContainer.name
|
|
32
|
-
)
|
|
30
|
+
elasticSearchVersionResponse = await containerApi.exec({
|
|
31
|
+
command: 'elasticsearch --version',
|
|
32
|
+
container: elasticSearchContainer.name
|
|
33
|
+
})
|
|
33
34
|
} else {
|
|
34
35
|
try {
|
|
35
36
|
const availableElasticSearchPort = await getPort(
|
|
@@ -41,13 +42,29 @@ const checkElasticSearchVersion = () => ({
|
|
|
41
42
|
detach: false,
|
|
42
43
|
rm: true,
|
|
43
44
|
ports: [`127.0.0.1:${availableElasticSearchPort}:9200`],
|
|
44
|
-
memory: '
|
|
45
|
+
memory: '2gb'
|
|
45
46
|
})
|
|
46
47
|
} catch (e) {
|
|
47
48
|
elasticSearchVersionResponse = e.message
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
if (
|
|
53
|
+
ctx.cgroupVersion === 'v2' &&
|
|
54
|
+
elasticSearchVersionResponse.includes(
|
|
55
|
+
'Cannot invoke "jdk.internal.platform.CgroupInfo.getMountPoint()" because "anyController" is null'
|
|
56
|
+
)
|
|
57
|
+
) {
|
|
58
|
+
throw new KnownError(`ElasticSearch failed to start up due to a JVM bug with CGroup version 2.
|
|
59
|
+
Similar issue on StackOverflow: https://stackoverflow.com/q/71532170.
|
|
60
|
+
|
|
61
|
+
Right now is check if OpenSearch works with your version of Magento.
|
|
62
|
+
Follow the documentation: https://docs.create-magento-app.com/getting-started/config-file#searchengine-opensearch-elasticsearch
|
|
63
|
+
|
|
64
|
+
If it will not help, try updating ElasticSearch image version: https://docs.create-magento-app.com/getting-started/config-file#elasticsearch
|
|
65
|
+
`)
|
|
66
|
+
}
|
|
67
|
+
|
|
51
68
|
const elasticSearchVersionResponseResult =
|
|
52
69
|
elasticSearchVersionResponse.match(/Version:\s(\d+\.\d+\.\d+)/i)
|
|
53
70
|
|
|
@@ -64,8 +81,7 @@ const checkElasticSearchVersion = () => ({
|
|
|
64
81
|
`Cannot retrieve ElasticSearch Version!\n\n${elasticSearchVersionResponse}`
|
|
65
82
|
)
|
|
66
83
|
}
|
|
67
|
-
}
|
|
68
|
-
exitOnError: false
|
|
84
|
+
}
|
|
69
85
|
})
|
|
70
86
|
|
|
71
87
|
module.exports = checkElasticSearchVersion
|
|
@@ -4,6 +4,7 @@ const localAuthJson = require('../composer/local-auth-json')
|
|
|
4
4
|
const checkDocker = require('./docker')
|
|
5
5
|
const checkNodeVersion = require('./node-version')
|
|
6
6
|
const checkRosetta = require('./rosetta')
|
|
7
|
+
const checkCGroupVersion = require('./cgroup-version')
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
@@ -19,6 +20,8 @@ const checkRequirements = () => ({
|
|
|
19
20
|
checkPlatform(),
|
|
20
21
|
// check the Docker installation
|
|
21
22
|
checkDocker(),
|
|
23
|
+
// check if cgroup v2 is used
|
|
24
|
+
checkCGroupVersion(),
|
|
22
25
|
// check for Node.js version
|
|
23
26
|
checkNodeVersion(),
|
|
24
27
|
// check for COMPOSER_AUTH or auth.json
|
|
@@ -25,10 +25,10 @@ const checkOpenSearchVersion = () => ({
|
|
|
25
25
|
openSearchContainerRunning.length !== 0 &&
|
|
26
26
|
openSearchContainerRunning[0].State === 'running'
|
|
27
27
|
) {
|
|
28
|
-
openSearchVersionResponse = await containerApi.exec(
|
|
29
|
-
'opensearch --version',
|
|
30
|
-
openSearchContainer.name
|
|
31
|
-
)
|
|
28
|
+
openSearchVersionResponse = await containerApi.exec({
|
|
29
|
+
command: 'opensearch --version',
|
|
30
|
+
container: openSearchContainer.name
|
|
31
|
+
})
|
|
32
32
|
} else {
|
|
33
33
|
try {
|
|
34
34
|
const availableOpenSearchPort = await getPort(
|
|
@@ -40,7 +40,7 @@ const checkOpenSearchVersion = () => ({
|
|
|
40
40
|
detach: false,
|
|
41
41
|
rm: true,
|
|
42
42
|
ports: [`127.0.0.1:${availableOpenSearchPort}:9200`],
|
|
43
|
-
memory: '
|
|
43
|
+
memory: '2gb'
|
|
44
44
|
})
|
|
45
45
|
} catch (e) {
|
|
46
46
|
openSearchVersionResponse = e.message
|
package/lib/tasks/start.js
CHANGED
|
@@ -15,10 +15,7 @@ const { installMagentoProject, setupMagento } = require('./magento')
|
|
|
15
15
|
const { pullImages, stopContainers } = require('./docker/containers')
|
|
16
16
|
const dockerNetwork = require('./docker/network')
|
|
17
17
|
const { connectToDatabase } = require('./database')
|
|
18
|
-
const {
|
|
19
|
-
buildProjectImage,
|
|
20
|
-
buildDebugProjectImage
|
|
21
|
-
} = require('./docker/project-image-builder')
|
|
18
|
+
const { buildProjectImage } = require('./docker/project-image-builder')
|
|
22
19
|
const getProjectConfiguration = require('../config/get-project-configuration')
|
|
23
20
|
const { getSystemConfigTask } = require('../config/system-config')
|
|
24
21
|
const setupThemes = require('./theme/setup-themes')
|
|
@@ -141,15 +138,7 @@ const configureProject = () => ({
|
|
|
141
138
|
}
|
|
142
139
|
)
|
|
143
140
|
},
|
|
144
|
-
|
|
145
|
-
task: (ctx, subTask) =>
|
|
146
|
-
subTask.newListr(
|
|
147
|
-
[buildProjectImage(), buildDebugProjectImage()],
|
|
148
|
-
{
|
|
149
|
-
concurrent: true
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
},
|
|
141
|
+
buildProjectImage(),
|
|
153
142
|
getComposerVersionTask(),
|
|
154
143
|
prepareFileSystem(),
|
|
155
144
|
volumes.createVolumes(),
|
|
@@ -22,7 +22,11 @@ const buildInstructions = (instructions) => {
|
|
|
22
22
|
addInstruction += ` --chown=${instruction.chown}`
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
addInstruction += ` ${
|
|
25
|
+
addInstruction += ` ${
|
|
26
|
+
Array.isArray(instruction.src)
|
|
27
|
+
? instruction.src.join(' ')
|
|
28
|
+
: instruction.src
|
|
29
|
+
}`
|
|
26
30
|
addInstruction += ` ${instruction.dest}`
|
|
27
31
|
|
|
28
32
|
dockerFileInstructions.push(addInstruction)
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
const { spawn } = require('child_process')
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
runCommand,
|
|
4
|
+
execCommand
|
|
5
|
+
} = require('../tasks/docker/containers/container-api')
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
|
-
* @param {{ containerName: string,
|
|
8
|
+
* @param {{ containerName: string, command: string, user?: string }} param0
|
|
6
9
|
* @returns {Promise<never>}
|
|
7
10
|
*/
|
|
8
|
-
const executeInContainer = ({ containerName,
|
|
11
|
+
const executeInContainer = ({ containerName, command, user }) => {
|
|
9
12
|
if (!process.stdin.isTTY) {
|
|
10
13
|
process.stderr.write('This app works only in TTY mode')
|
|
11
14
|
process.exit(1)
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const execArgs = execCommand({
|
|
18
|
+
container: containerName,
|
|
19
|
+
command,
|
|
20
|
+
user,
|
|
21
|
+
tty: true,
|
|
22
|
+
interactive: true
|
|
23
|
+
})
|
|
18
24
|
|
|
19
|
-
spawn('
|
|
25
|
+
spawn('bash', ['-c', execArgs.join(' ')], {
|
|
20
26
|
stdio: [0, 1, 2]
|
|
21
27
|
})
|
|
22
28
|
|
|
@@ -17,6 +17,49 @@ const getComposerData = async (composerPath) => {
|
|
|
17
17
|
return JSON.parse(await fs.promises.readFile(composerPath, 'utf-8'))
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} composerLockPath
|
|
22
|
+
* @returns {Promise<{ packages: Array<{ name: string, version: string }> } | null>}
|
|
23
|
+
*/
|
|
24
|
+
const getComposerLockData = async (composerLockPath) => {
|
|
25
|
+
const composerExists = await pathExists(composerLockPath)
|
|
26
|
+
|
|
27
|
+
if (!composerExists) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return JSON.parse(await fs.promises.readFile(composerLockPath, 'utf-8'))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const getInstalledMagentoVersionFromLock = async (
|
|
35
|
+
projectPath = process.cwd()
|
|
36
|
+
) => {
|
|
37
|
+
const composerLockData = await getComposerLockData(
|
|
38
|
+
path.join(projectPath, 'composer.lock')
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
if (!composerLockData) {
|
|
42
|
+
throw new KnownError('composer.lock not found')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const magentoDependency = composerLockData.packages.find(
|
|
46
|
+
(composerLockPackage) => {
|
|
47
|
+
return [
|
|
48
|
+
'magento/product-community-edition',
|
|
49
|
+
'magento/product-enterprise-edition'
|
|
50
|
+
].some(
|
|
51
|
+
(magentoEdition) => composerLockPackage.name === magentoEdition
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
if (!magentoDependency) {
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return magentoDependency.version
|
|
61
|
+
}
|
|
62
|
+
|
|
20
63
|
const getInstalledMagentoVersion = async (projectPath = process.cwd()) => {
|
|
21
64
|
const composerData = await getComposerData(
|
|
22
65
|
path.join(projectPath, 'composer.json')
|
|
@@ -30,11 +73,26 @@ const getInstalledMagentoVersion = async (projectPath = process.cwd()) => {
|
|
|
30
73
|
'magento/product-enterprise-edition'
|
|
31
74
|
].find((magentoEdition) => composerData.require[magentoEdition])
|
|
32
75
|
|
|
76
|
+
let foundMagentoVersion = ''
|
|
77
|
+
|
|
33
78
|
if (!magentoDependency) {
|
|
34
|
-
|
|
79
|
+
const magentoLockVersion = await getInstalledMagentoVersionFromLock(
|
|
80
|
+
projectPath
|
|
81
|
+
)
|
|
82
|
+
if (!magentoLockVersion) {
|
|
83
|
+
if (!magentoDependency) {
|
|
84
|
+
throw new KnownError(
|
|
85
|
+
'No Magento dependency found in composer.json or composer.lock'
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
foundMagentoVersion = magentoLockVersion
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
foundMagentoVersion = composerData.require[magentoDependency]
|
|
35
93
|
}
|
|
36
94
|
|
|
37
|
-
return
|
|
95
|
+
return foundMagentoVersion.replace(/\^/i, '')
|
|
38
96
|
}
|
|
39
97
|
|
|
40
98
|
module.exports = getInstalledMagentoVersion
|
package/lib/util/portscanner.js
CHANGED
|
@@ -13,7 +13,7 @@ const { Socket } = net
|
|
|
13
13
|
* @param {Object} [options] - Options object.
|
|
14
14
|
* @param {String} [options.host] - Host of where to scan.
|
|
15
15
|
* @param {Number} [options.timeout] - Connection timeout in ms.
|
|
16
|
-
* @returns {Promise<
|
|
16
|
+
* @returns {Promise<'open' | 'closed'>}
|
|
17
17
|
*/
|
|
18
18
|
const checkPortStatus = (port, options = {}) =>
|
|
19
19
|
new Promise((resolve, reject) => {
|
|
@@ -23,7 +23,7 @@ const checkPortStatus = (port, options = {}) =>
|
|
|
23
23
|
|
|
24
24
|
const socket = new Socket()
|
|
25
25
|
/**
|
|
26
|
-
* @type {
|
|
26
|
+
* @type {'open' | 'closed'}
|
|
27
27
|
*/
|
|
28
28
|
let status
|
|
29
29
|
|
|
@@ -80,7 +80,7 @@ const checkPortStatus = (port, options = {}) =>
|
|
|
80
80
|
/**
|
|
81
81
|
* Internal helper function used by {@link findAPortInUse} and {@link findAPortNotInUse}
|
|
82
82
|
* to find a port from a range or a list with a specific status.
|
|
83
|
-
* @param {
|
|
83
|
+
* @param {'open' | 'closed'} status - Status to check.
|
|
84
84
|
* @param {Object} options
|
|
85
85
|
* @param {Number} options.startPort Port to begin status check on (inclusive).
|
|
86
86
|
* @param {Number} options.endPort Last port to check status on (inclusive).
|
package/lib/util/run-composer.js
CHANGED
|
@@ -4,7 +4,7 @@ const { runPHPContainerCommand } = require('../tasks/php/php-container')
|
|
|
4
4
|
* Execute composer command
|
|
5
5
|
* @param {import('../../typings/context').ListrContext} ctx
|
|
6
6
|
* @param {String} command composer command
|
|
7
|
-
* @param {Parameters<import('../tasks/php/php-container')['runPHPContainerCommand']>[2] & { throwNonZeroCode?: boolean }} [options]
|
|
7
|
+
* @param {Parameters<import('../tasks/php/php-container')['runPHPContainerCommand']>[2] & { throwNonZeroCode?: boolean, user?: string, useAutomaticUser?: boolean }} [options]
|
|
8
8
|
*/
|
|
9
9
|
const runComposerCommand = async (ctx, command, options = {}) => {
|
|
10
10
|
const { throwNonZeroCode = true } = options
|
package/lib/util/run-magento.js
CHANGED
|
@@ -5,7 +5,7 @@ const { runPHPContainerCommand } = require('../tasks/php/php-container')
|
|
|
5
5
|
*
|
|
6
6
|
* @param {import('../../typings/context').ListrContext} ctx
|
|
7
7
|
* @param {String} command magento command
|
|
8
|
-
* @param {Parameters<typeof import('../tasks/php/php-container')['runPHPContainerCommand']>[2] & { throwNonZeroCode?: boolean }} options
|
|
8
|
+
* @param {Parameters<typeof import('../tasks/php/php-container')['runPHPContainerCommand']>[2] & { throwNonZeroCode?: boolean, useAutomaticUser?: boolean }} options
|
|
9
9
|
* @returns {Promise<{ code: number, result: string }>}
|
|
10
10
|
*/
|
|
11
11
|
const runMagentoCommand = async (ctx, command, options = {}) => {
|
|
@@ -15,6 +15,7 @@ const runMagentoCommand = async (ctx, command, options = {}) => {
|
|
|
15
15
|
`bin/magento ${command}`,
|
|
16
16
|
{
|
|
17
17
|
...options,
|
|
18
|
+
useAutomaticUser: true,
|
|
18
19
|
withCode: true
|
|
19
20
|
}
|
|
20
21
|
)
|
package/lib/util/run-php.js
CHANGED
|
@@ -4,7 +4,7 @@ const { runPHPContainerCommand } = require('../tasks/php/php-container')
|
|
|
4
4
|
* Execute PHP code
|
|
5
5
|
* @param {import('../../typings/context').ListrContext} ctx
|
|
6
6
|
* @param {String} command php command
|
|
7
|
-
* @param {Parameters<typeof import('../tasks/php/php-container')['runPHPContainerCommand']>[2] & { throwNonZeroCode?: boolean }} [options]
|
|
7
|
+
* @param {Parameters<typeof import('../tasks/php/php-container')['runPHPContainerCommand']>[2] & { throwNonZeroCode?: boolean, useAutomaticUser?: boolean }} [options]
|
|
8
8
|
*/
|
|
9
9
|
const runPhpCode = async (ctx, command, options = {}) => {
|
|
10
10
|
const { throwNonZeroCode = true } = options
|
|
@@ -13,6 +13,7 @@ const runPhpCode = async (ctx, command, options = {}) => {
|
|
|
13
13
|
`php ${command}`,
|
|
14
14
|
{
|
|
15
15
|
...options,
|
|
16
|
+
useAutomaticUser: true,
|
|
16
17
|
withCode: true
|
|
17
18
|
}
|
|
18
19
|
)
|
package/lib/util/set-config.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { Eta } = require('eta')
|
|
2
2
|
const fs = require('fs')
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const pathExists = require('./path-exists')
|
|
5
5
|
|
|
6
|
+
const eta = new Eta()
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* @param {{ configPathname: string, template: string, overwrite?: boolean, templateArgs?: Record<string, unknown> }} param0
|
|
8
10
|
*/
|
|
@@ -19,7 +21,7 @@ const setConfigFile = async ({
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
const configTemplate = await fs.promises.readFile(template, 'utf-8')
|
|
22
|
-
const compliedConfig = await eta.
|
|
24
|
+
const compliedConfig = await eta.renderStringAsync(configTemplate, {
|
|
23
25
|
date: new Date().toUTCString(),
|
|
24
26
|
...templateArgs
|
|
25
27
|
})
|
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.0-alpha.
|
|
6
|
+
"version": "2.4.0-alpha.2",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./typings/index.d.ts",
|
|
9
9
|
"license": "OSL-3.0",
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
"arm64"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scandipwa/scandipwa-dev-utils": "0.1.
|
|
27
|
-
"@tilework/mosaic-dev-utils": "^0.2.
|
|
28
|
-
"conf": "10.
|
|
29
|
-
"enquirer": "2.
|
|
30
|
-
"eta": "
|
|
31
|
-
"fast-xml-parser": "^4.0
|
|
26
|
+
"@scandipwa/scandipwa-dev-utils": "0.1.17",
|
|
27
|
+
"@tilework/mosaic-dev-utils": "^0.2.4",
|
|
28
|
+
"conf": "10.2.0",
|
|
29
|
+
"enquirer": "2.4.1",
|
|
30
|
+
"eta": "3.4.0",
|
|
31
|
+
"fast-xml-parser": "^4.4.0",
|
|
32
32
|
"hjson": "^3.2.2",
|
|
33
33
|
"is-installed-globally": "0.4.0",
|
|
34
|
-
"joi": "17.
|
|
34
|
+
"joi": "17.13.3",
|
|
35
35
|
"listr2": "4.0.5",
|
|
36
36
|
"macos-version": "5.2.1",
|
|
37
37
|
"merge-files": "0.1.2",
|
|
38
|
-
"mysql2": "
|
|
39
|
-
"node-ssh": "
|
|
40
|
-
"semver": "7.3
|
|
38
|
+
"mysql2": "3.10.3",
|
|
39
|
+
"node-ssh-no-cpu-features": "^2.0.0",
|
|
40
|
+
"semver": "7.6.3",
|
|
41
41
|
"smol-request": "^2.1.2",
|
|
42
|
-
"systeminformation": "5.
|
|
43
|
-
"yargs": "17.
|
|
42
|
+
"systeminformation": "5.22.11",
|
|
43
|
+
"yargs": "17.7.2"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"scandipwa"
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^20.
|
|
60
|
-
"@types/yargs": "^17.0.
|
|
59
|
+
"@types/node": "^20.14.11",
|
|
60
|
+
"@types/yargs": "^17.0.32"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "ec855efd799e10f263e82b3bf610d400892db6dc"
|
|
63
63
|
}
|
package/typings/context.d.ts
CHANGED
|
@@ -18,17 +18,18 @@ export interface ListrContext {
|
|
|
18
18
|
throwMagentoVersionMissing: boolean
|
|
19
19
|
projectPath: string
|
|
20
20
|
systemDFData?: systemApi.SystemDFResult
|
|
21
|
-
debug: boolean
|
|
22
21
|
verbose: boolean
|
|
23
22
|
magentoVersion: string
|
|
24
23
|
composerVersion: string
|
|
25
24
|
phpVersion: string
|
|
26
25
|
elasticSearchVersion: string
|
|
27
26
|
openSearchVersion: string
|
|
27
|
+
cgroupVersion: 'v1' | 'v2'
|
|
28
28
|
port?: number
|
|
29
29
|
ports: {
|
|
30
30
|
app: number
|
|
31
31
|
fpm: number
|
|
32
|
+
fpmXdebug: number
|
|
32
33
|
xdebug: number
|
|
33
34
|
mariadb: number
|
|
34
35
|
redis: number
|
|
@@ -42,6 +43,7 @@ export interface ListrContext {
|
|
|
42
43
|
cachedPorts?: {
|
|
43
44
|
app: number
|
|
44
45
|
fpm: number
|
|
46
|
+
fpmXdebug: number
|
|
45
47
|
xdebug: number
|
|
46
48
|
mariadb: number
|
|
47
49
|
redis: number
|
|
@@ -55,8 +57,8 @@ export interface ListrContext {
|
|
|
55
57
|
isArm: boolean
|
|
56
58
|
isWsl: boolean
|
|
57
59
|
isArmMac: boolean
|
|
58
|
-
platform
|
|
59
|
-
platformVersion
|
|
60
|
+
platform: NodeJS.Platform
|
|
61
|
+
platformVersion: string
|
|
60
62
|
/**
|
|
61
63
|
* Magento Edition
|
|
62
64
|
*
|
|
@@ -67,6 +69,11 @@ export interface ListrContext {
|
|
|
67
69
|
php: {
|
|
68
70
|
iniTemplatePath: string
|
|
69
71
|
fpmConfPath: string
|
|
72
|
+
fpmTemplatePath: string
|
|
73
|
+
debugIniPath: string
|
|
74
|
+
debugTemplatePath: string
|
|
75
|
+
debugFpmConfPath: string
|
|
76
|
+
debugFpmTemplatePath: string
|
|
70
77
|
extensions: PHPExtensions
|
|
71
78
|
version: string
|
|
72
79
|
}
|
|
@@ -91,7 +98,7 @@ export interface ListrContext {
|
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
>
|
|
94
|
-
getContainers(ports?: ListrContext['ports']): Record<'php' | 'sslTerminator' | 'nginx' | 'redis' | 'mariadb' | 'elasticsearch' | 'maildev' | 'varnish',
|
|
101
|
+
getContainers(ports?: ListrContext['ports']): Record<'php' | 'phpWithXdebug' | 'sslTerminator' | 'nginx' | 'redis' | 'mariadb' | 'elasticsearch' | 'maildev' | 'varnish',
|
|
95
102
|
{
|
|
96
103
|
_: string
|
|
97
104
|
ports: string[]
|
|
@@ -100,16 +107,17 @@ export interface ListrContext {
|
|
|
100
107
|
}
|
|
101
108
|
env: Record<string, string>
|
|
102
109
|
mountVolumes: string[]
|
|
110
|
+
pullImage?: boolean
|
|
103
111
|
mounts: string[]
|
|
104
112
|
restart: string
|
|
105
113
|
securityOptions: string[]
|
|
106
114
|
network: string
|
|
107
115
|
image: string
|
|
108
|
-
debugImage?: string
|
|
109
116
|
remoteImages?: string[]
|
|
110
117
|
name: string
|
|
111
118
|
command: string
|
|
112
119
|
connectCommand: string[]
|
|
120
|
+
dependsOn?: string[]
|
|
113
121
|
}
|
|
114
122
|
>
|
|
115
123
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -30,6 +30,16 @@ export interface MariaDBConfiguration extends ServiceWithImage {
|
|
|
30
30
|
* Allows to be boolean or custom value that will be set in the template
|
|
31
31
|
*/
|
|
32
32
|
useOptimizerSwitch?: boolean | string
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* `mariadb` file name to be used in the shell
|
|
36
|
+
*/
|
|
37
|
+
binFileName?: string
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* `mariadb-admin` file name to be used in the shell, for heathcheck
|
|
41
|
+
*/
|
|
42
|
+
binAdminFileName?: string
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
export interface SSLTerminatorConfiguration extends ServiceWithImage {
|
|
@@ -189,11 +199,6 @@ export interface PHPConfiguration {
|
|
|
189
199
|
*/
|
|
190
200
|
baseImage: string
|
|
191
201
|
|
|
192
|
-
/**
|
|
193
|
-
* Image with XDebug enabled
|
|
194
|
-
*/
|
|
195
|
-
debugImage: string
|
|
196
|
-
|
|
197
202
|
/**
|
|
198
203
|
* Configuration file template location
|
|
199
204
|
*
|