@scandipwa/magento-scripts 2.4.2-alpha.2 → 2.4.3-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.
- package/lib/commands/execute.js +6 -3
- package/lib/commands/logs.js +6 -3
- package/lib/config/docker.js +2 -7
- package/lib/config/services/composer/versions/composer-2.8.js +1 -1
- package/lib/config/services/mariadb/versions/index.js +1 -0
- package/lib/config/services/mariadb/versions/mariadb-10.11.js +11 -0
- package/lib/config/services/mysql/versions/index.js +3 -1
- package/lib/config/services/mysql/versions/mysql-8.4.js +8 -0
- package/lib/config/services/varnish/index.js +2 -1
- package/lib/config/services/varnish/varnish-7-7.js +15 -0
- package/lib/config/versions/magento-2.4.5-p13.js +40 -0
- package/lib/config/versions/magento-2.4.6-p11.js +40 -0
- package/lib/config/versions/magento-2.4.7-p6.js +41 -0
- package/lib/config/versions/magento-2.4.8-p1.js +43 -0
- package/lib/config/versions/magento-2.4.8.js +0 -1
- package/lib/config/versions/magento-2.4.9-alpha1.js +41 -0
- package/lib/tasks/docker/containers/container-api.js +8 -2
- package/lib/tasks/docker/project-image-builder.js +6 -0
- package/lib/tasks/execute.js +4 -3
- package/lib/tasks/magento/install-magento-project.js +3 -3
- package/lib/tasks/magento/setup-magento/disable-2fa.js +48 -17
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/requirements/searchengine-version.js +105 -33
- package/lib/util/composer-task.js +35 -0
- package/lib/util/execute-in-container.js +19 -14
- package/package.json +2 -2
package/lib/commands/execute.js
CHANGED
|
@@ -11,12 +11,15 @@ module.exports = (yargs) => {
|
|
|
11
11
|
yargs.usage(`Usage: npm run exec <container name> [command...]
|
|
12
12
|
|
|
13
13
|
Available containers:
|
|
14
|
-
-
|
|
14
|
+
- php
|
|
15
|
+
- phpWithXdebug
|
|
16
|
+
- sslTerminator
|
|
15
17
|
- nginx
|
|
16
18
|
- redis
|
|
19
|
+
- mariadb
|
|
17
20
|
- elasticsearch
|
|
18
|
-
-
|
|
19
|
-
-
|
|
21
|
+
- maildev
|
|
22
|
+
- varnish (if enabled)`)
|
|
20
23
|
},
|
|
21
24
|
async () => {
|
|
22
25
|
const [containerName, ...commands] = process.argv.slice(3)
|
package/lib/commands/logs.js
CHANGED
|
@@ -20,12 +20,15 @@ module.exports = (yargs) => {
|
|
|
20
20
|
|
|
21
21
|
Available scopes:
|
|
22
22
|
- magento
|
|
23
|
-
-
|
|
24
|
-
-
|
|
23
|
+
- php
|
|
24
|
+
- phpWithXdebug
|
|
25
|
+
- sslTerminator
|
|
25
26
|
- nginx
|
|
27
|
+
- redis
|
|
28
|
+
- mariadb
|
|
26
29
|
- elasticsearch
|
|
30
|
+
- maildev
|
|
27
31
|
- varnish (if enabled)
|
|
28
|
-
- sslTerminator
|
|
29
32
|
|
|
30
33
|
And you can use name matching:
|
|
31
34
|
npm run logs ma (will match magento)
|
package/lib/config/docker.js
CHANGED
|
@@ -137,13 +137,11 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
137
137
|
containerVolume({
|
|
138
138
|
source: isDockerDesktop ? volumes.php.name : magentoDir,
|
|
139
139
|
target: containerMagentoDir,
|
|
140
|
-
rw: true,
|
|
141
140
|
cached: isDockerDesktop
|
|
142
141
|
}),
|
|
143
142
|
containerVolume({
|
|
144
143
|
source: volumes.composer_cache.name,
|
|
145
|
-
target: '/composer/home/cache'
|
|
146
|
-
rw: true
|
|
144
|
+
target: '/composer/home/cache'
|
|
147
145
|
}),
|
|
148
146
|
containerVolume({
|
|
149
147
|
source: php.iniPath,
|
|
@@ -191,13 +189,11 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
191
189
|
containerVolume({
|
|
192
190
|
source: isDockerDesktop ? volumes.php.name : magentoDir,
|
|
193
191
|
target: containerMagentoDir,
|
|
194
|
-
rw: true,
|
|
195
192
|
cached: isDockerDesktop
|
|
196
193
|
}),
|
|
197
194
|
containerVolume({
|
|
198
195
|
source: volumes.composer_cache.name,
|
|
199
|
-
target: '/composer/home/cache'
|
|
200
|
-
rw: true
|
|
196
|
+
target: '/composer/home/cache'
|
|
201
197
|
}),
|
|
202
198
|
containerVolume({
|
|
203
199
|
source: php.iniPath,
|
|
@@ -303,7 +299,6 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
303
299
|
containerVolume({
|
|
304
300
|
source: isDockerDesktop ? volumes.php.name : magentoDir,
|
|
305
301
|
target: containerMagentoDir,
|
|
306
|
-
rw: true,
|
|
307
302
|
cached: isDockerDesktop
|
|
308
303
|
}),
|
|
309
304
|
containerVolume({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns {import('../../../../../typings/index').MariaDBConfiguration}
|
|
3
|
+
*/
|
|
4
|
+
const mariadb106 = () => ({
|
|
5
|
+
image: 'mariadb:10.11',
|
|
6
|
+
useOptimizerSwitch: true,
|
|
7
|
+
binFileName: 'mysql',
|
|
8
|
+
binAdminFileName: 'mysqladmin'
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
module.exports = mariadb106
|
|
@@ -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 varnish77 = ({ templateDir }) => ({
|
|
9
|
+
enabled: false,
|
|
10
|
+
healthCheck: false,
|
|
11
|
+
image: 'varnish:7.7',
|
|
12
|
+
configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
module.exports = varnish77
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php81 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish77 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer22 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb106 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.5-p13',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php81({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.1-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb106(),
|
|
33
|
+
elasticsearch: elasticsearch717(),
|
|
34
|
+
composer: composer22(),
|
|
35
|
+
varnish: varnish77({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219()
|
|
39
|
+
}
|
|
40
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php81 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish77 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer22 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb1011 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.6-p11',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php81({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.1-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb1011(),
|
|
33
|
+
elasticsearch: elasticsearch717(),
|
|
34
|
+
composer: composer22(),
|
|
35
|
+
varnish: varnish77({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219()
|
|
39
|
+
}
|
|
40
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php82 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish76 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer28 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb1011 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch817 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.7-p6',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php82({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.2-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb1011(),
|
|
33
|
+
elasticsearch: elasticsearch817(),
|
|
34
|
+
composer: composer28(),
|
|
35
|
+
varnish: varnish76({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219(),
|
|
39
|
+
searchengine: 'opensearch'
|
|
40
|
+
}
|
|
41
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const ftp = require('../services/php/extensions/ftp')
|
|
3
|
+
const {
|
|
4
|
+
magento24PHPExtensionList
|
|
5
|
+
} = require('../magento/required-php-extensions')
|
|
6
|
+
const { php83 } = require('../services/php/versions')
|
|
7
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
8
|
+
const { varnish76 } = require('../services/varnish')
|
|
9
|
+
const { repo } = require('../services/php/base-repo')
|
|
10
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
11
|
+
const { composer28 } = require('../services/composer/versions')
|
|
12
|
+
const { maildev } = require('../services/maildev')
|
|
13
|
+
const { valkey80 } = require('../services/redis')
|
|
14
|
+
const { mariadb114 } = require('../services/mariadb/versions')
|
|
15
|
+
const { elasticsearch817 } = require('../services/elasticsearch/versions')
|
|
16
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
17
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
21
|
+
*/
|
|
22
|
+
module.exports = ({ templateDir }) => ({
|
|
23
|
+
magentoVersion: '2.4.8-p1',
|
|
24
|
+
isDefault: true,
|
|
25
|
+
configuration: {
|
|
26
|
+
php: php83({
|
|
27
|
+
templateDir,
|
|
28
|
+
extensions: { ...magento24PHPExtensionList, sodium, ftp },
|
|
29
|
+
baseImage: `${repo}:php-8.3-magento-2.4`
|
|
30
|
+
}),
|
|
31
|
+
nginx: nginx126({ templateDir }),
|
|
32
|
+
redis: valkey80(),
|
|
33
|
+
mysql: mysql80(),
|
|
34
|
+
mariadb: mariadb114(),
|
|
35
|
+
elasticsearch: elasticsearch817(),
|
|
36
|
+
composer: composer28(),
|
|
37
|
+
varnish: varnish76({ templateDir }),
|
|
38
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
39
|
+
maildev: maildev(),
|
|
40
|
+
opensearch: opensearch219(),
|
|
41
|
+
searchengine: 'opensearch'
|
|
42
|
+
}
|
|
43
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php83 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish77 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer28 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { valkey80 } = require('../services/redis')
|
|
13
|
+
const { mariadb114 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch87 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql84 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.9-alpha1',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php83({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.3-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: valkey80(),
|
|
31
|
+
mysql: mysql84(),
|
|
32
|
+
mariadb: mariadb114(),
|
|
33
|
+
elasticsearch: elasticsearch87(),
|
|
34
|
+
composer: composer28(),
|
|
35
|
+
varnish: varnish77({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219(),
|
|
39
|
+
searchengine: 'opensearch'
|
|
40
|
+
}
|
|
41
|
+
})
|
|
@@ -38,9 +38,15 @@ const runCommand = (options) => {
|
|
|
38
38
|
const portsArgs =
|
|
39
39
|
(ports && ports.length > 0 && ports.map((port) => `-p=${port}`)) || ''
|
|
40
40
|
const mountsArgs =
|
|
41
|
-
(mounts &&
|
|
41
|
+
(mounts &&
|
|
42
|
+
mounts.map((mount) => `--mount=${mount.replaceAll(' ', '\\ ')}`)) ||
|
|
43
|
+
''
|
|
42
44
|
const mountVolumesArgs =
|
|
43
|
-
(mountVolumes &&
|
|
45
|
+
(mountVolumes &&
|
|
46
|
+
mountVolumes.map(
|
|
47
|
+
(mount) => `-v=${mount.replaceAll(' ', '\\ ')}`
|
|
48
|
+
)) ||
|
|
49
|
+
''
|
|
44
50
|
const envArgs = !env
|
|
45
51
|
? ''
|
|
46
52
|
: Object.entries(env).map(([key, value]) => `--env=${key}='${value}'`)
|
|
@@ -142,6 +142,12 @@ const buildDockerFileInstructions = async (
|
|
|
142
142
|
COMPOSER_HOME: '/composer/home',
|
|
143
143
|
COMPOSER_CACHE_DIR: '/composer/home/cache'
|
|
144
144
|
})
|
|
145
|
+
.run(
|
|
146
|
+
`curl https://composer.github.io/snapshots.pub > /composer/home/keys.dev.pub`
|
|
147
|
+
)
|
|
148
|
+
.run(
|
|
149
|
+
`curl https://composer.github.io/releases.pub > /composer/home/keys.tags.pub`
|
|
150
|
+
)
|
|
145
151
|
|
|
146
152
|
if (composer.plugins && Object.values(composer.plugins).length > 0) {
|
|
147
153
|
for (const [pluginName, pluginOptions] of Object.entries(
|
package/lib/tasks/execute.js
CHANGED
|
@@ -32,6 +32,7 @@ const executeTask = async (argv) => {
|
|
|
32
32
|
concurrent: false,
|
|
33
33
|
exitOnError: true,
|
|
34
34
|
ctx: { throwMagentoVersionMissing: true },
|
|
35
|
+
renderer: process.stdout.isTTY ? 'default' : 'silent',
|
|
35
36
|
rendererOptions: { collapse: false, clearOutput: true }
|
|
36
37
|
}
|
|
37
38
|
)
|
|
@@ -93,9 +94,9 @@ const executeTask = async (argv) => {
|
|
|
93
94
|
)
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
const result =
|
|
97
|
+
const result = executeInContainer({
|
|
97
98
|
containerName: container.name,
|
|
98
|
-
|
|
99
|
+
commands: argv.commands,
|
|
99
100
|
user: container.user
|
|
100
101
|
})
|
|
101
102
|
|
|
@@ -113,7 +114,7 @@ const executeTask = async (argv) => {
|
|
|
113
114
|
)
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
const result =
|
|
117
|
+
const result = runInContainer(
|
|
117
118
|
{
|
|
118
119
|
...container,
|
|
119
120
|
name: `${container.name}_exec-${Date.now()}`
|
|
@@ -154,9 +154,9 @@ const createMagentoProject = async (
|
|
|
154
154
|
ctx,
|
|
155
155
|
`bash -c 'mkdir ${tempDir} && \
|
|
156
156
|
composer ${installCommand.join(' ')} && \
|
|
157
|
-
mv ${tempDir
|
|
158
|
-
ctx.config.baseConfig.containerMagentoDir
|
|
159
|
-
|
|
157
|
+
mv ${path.join(tempDir, 'composer.json')} ${path
|
|
158
|
+
.join(ctx.config.baseConfig.containerMagentoDir, 'composer.json')
|
|
159
|
+
.replaceAll(' ', '\\ ')}'`
|
|
160
160
|
)
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -1,36 +1,67 @@
|
|
|
1
1
|
const configPhpToJson = require('../../../util/config-php-json')
|
|
2
|
-
const
|
|
2
|
+
const getJsonfileData = require('../../../util/get-jsonfile-data')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const composerTask = require('../../../util/composer-task')
|
|
5
|
+
const magentoTask = require('../../../util/magento-task')
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
6
9
|
*/
|
|
7
10
|
module.exports = () => ({
|
|
8
|
-
title: 'Disabling
|
|
11
|
+
title: 'Disabling 2FA module',
|
|
9
12
|
task: async (ctx, task) => {
|
|
10
|
-
|
|
13
|
+
// Check if MarkShust module is already installed via composer.lock
|
|
14
|
+
const composerLockPath = path.join(
|
|
15
|
+
ctx.config.baseConfig.magentoDir,
|
|
16
|
+
'composer.lock'
|
|
17
|
+
)
|
|
18
|
+
const composerLockData = await getJsonfileData(composerLockPath)
|
|
11
19
|
|
|
12
|
-
const
|
|
13
|
-
modules.Magento_TwoFactorAuth !== undefined &&
|
|
14
|
-
modules.Magento_TwoFactorAuth !== 0
|
|
20
|
+
const tasks = []
|
|
15
21
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
const isModuleInstalled =
|
|
23
|
+
composerLockData &&
|
|
24
|
+
composerLockData.packages &&
|
|
25
|
+
composerLockData.packages.some(
|
|
26
|
+
/** @param {{ name: string }} pkg */ (pkg) =>
|
|
27
|
+
pkg.name ===
|
|
28
|
+
'markshust/magento2-module-disabletwofactorauth'
|
|
29
|
+
)
|
|
19
30
|
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
if (!isModuleInstalled) {
|
|
32
|
+
tasks.push(
|
|
33
|
+
composerTask(
|
|
34
|
+
'require --dev markshust/magento2-module-disabletwofactorauth'
|
|
35
|
+
)
|
|
24
36
|
)
|
|
25
37
|
}
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
|
|
39
|
+
const getIsModuleEnabled = async () => {
|
|
40
|
+
const configData = await configPhpToJson(ctx)
|
|
41
|
+
return (
|
|
42
|
+
configData &&
|
|
43
|
+
configData.modules &&
|
|
44
|
+
configData.modules.MarkShust_DisableTwoFactorAuth !==
|
|
45
|
+
undefined &&
|
|
46
|
+
configData.modules.MarkShust_DisableTwoFactorAuth !== 0
|
|
47
|
+
)
|
|
28
48
|
}
|
|
29
49
|
|
|
30
|
-
if
|
|
50
|
+
// Check if module is enabled in Magento
|
|
51
|
+
const isModuleEnabled =
|
|
52
|
+
isModuleInstalled || (await getIsModuleEnabled())
|
|
53
|
+
|
|
54
|
+
if (!isModuleEnabled) {
|
|
55
|
+
tasks.push(
|
|
56
|
+
magentoTask('module:enable MarkShust_DisableTwoFactorAuth'),
|
|
57
|
+
magentoTask('setup:upgrade')
|
|
58
|
+
)
|
|
59
|
+
} else {
|
|
60
|
+
task.skip()
|
|
61
|
+
|
|
31
62
|
return
|
|
32
63
|
}
|
|
33
64
|
|
|
34
|
-
task.
|
|
65
|
+
return task.newListr(tasks)
|
|
35
66
|
}
|
|
36
67
|
})
|
|
@@ -4,6 +4,7 @@ const createAdmin = require('./create-admin')
|
|
|
4
4
|
const setDeploymentMode = require('./set-deployment-mode')
|
|
5
5
|
const setBaseUrl = require('./set-base-url')
|
|
6
6
|
const disableMaintenanceMode = require('./disable-maintenance-mode')
|
|
7
|
+
const disable2fa = require('./disable-2fa')
|
|
7
8
|
const setUrlRewrite = require('./set-url-rewrite')
|
|
8
9
|
const increaseAdminSessionLifetime = require('./increase-admin-session-lifetime')
|
|
9
10
|
const magentoTask = require('../../../util/magento-task')
|
|
@@ -56,6 +57,7 @@ const setupMagento = (options = {}) => ({
|
|
|
56
57
|
createAdmin(),
|
|
57
58
|
setDeploymentMode(),
|
|
58
59
|
disableMaintenanceMode(),
|
|
60
|
+
disable2fa(),
|
|
59
61
|
urnHighlighter(),
|
|
60
62
|
enableFullPageCacheWithVarnish(),
|
|
61
63
|
magentoTask('cache:flush')
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
const { request } = require('smol-request')
|
|
2
2
|
const UnknownError = require('../../errors/unknown-error')
|
|
3
3
|
const waitForLogs = require('../../util/wait-for-logs')
|
|
4
|
+
const { containerApi } = require('../docker/containers')
|
|
5
|
+
const { getPort } = require('../../config/port-config')
|
|
6
|
+
const { createNetwork } = require('../docker/network/tasks')
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
7
10
|
*/
|
|
8
11
|
const checkSearchEngineVersion = () => ({
|
|
12
|
+
title: 'Retrieving search engine version',
|
|
9
13
|
task: async (ctx, task) => {
|
|
10
14
|
const {
|
|
11
15
|
ports,
|
|
@@ -18,52 +22,120 @@ const checkSearchEngineVersion = () => ({
|
|
|
18
22
|
|
|
19
23
|
const { elasticsearch } = ctx.config.docker.getContainers(ports)
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
// check if container is running
|
|
26
|
+
// if not running, start temporary container to extract version
|
|
27
|
+
const containers = await containerApi.ls({
|
|
28
|
+
filter: `name=${elasticsearch.name}`,
|
|
29
|
+
formatToJSON: true
|
|
25
30
|
})
|
|
31
|
+
if (containers.length === 0) {
|
|
32
|
+
return task.newListr(
|
|
33
|
+
[
|
|
34
|
+
createNetwork(),
|
|
35
|
+
{
|
|
36
|
+
title: 'Starting temporary container',
|
|
37
|
+
task: async (subCtx, subTask) => {
|
|
38
|
+
try {
|
|
39
|
+
const availablePort = await getPort(
|
|
40
|
+
ports.elasticsearch
|
|
41
|
+
)
|
|
42
|
+
const searchEngineVersionResponse =
|
|
43
|
+
await containerApi.run({
|
|
44
|
+
...elasticsearch,
|
|
45
|
+
command:
|
|
46
|
+
searchengine === 'elasticsearch'
|
|
47
|
+
? 'elasticsearch --version'
|
|
48
|
+
: 'opensearch --version',
|
|
49
|
+
detach: false,
|
|
50
|
+
rm: true,
|
|
51
|
+
ports: [
|
|
52
|
+
`127.0.0.1:${availablePort}:9200`
|
|
53
|
+
],
|
|
54
|
+
memory: '2gb'
|
|
55
|
+
})
|
|
56
|
+
const searchEngineVersionResponseResult =
|
|
57
|
+
searchEngineVersionResponse.match(
|
|
58
|
+
/Version:\s(\d+\.\d+\.\d+)/i
|
|
59
|
+
)
|
|
26
60
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
61
|
+
if (
|
|
62
|
+
searchEngineVersionResponseResult &&
|
|
63
|
+
searchEngineVersionResponseResult.length > 0
|
|
64
|
+
) {
|
|
65
|
+
const searchEngineVersion =
|
|
66
|
+
searchEngineVersionResponseResult[1]
|
|
67
|
+
|
|
68
|
+
if (searchengine === 'elasticsearch') {
|
|
69
|
+
ctx.elasticSearchVersion =
|
|
70
|
+
searchEngineVersion
|
|
71
|
+
} else {
|
|
72
|
+
ctx.openSearchVersion =
|
|
73
|
+
searchEngineVersion
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
task.title = `Using ${
|
|
77
|
+
searchengine === 'elasticsearch'
|
|
78
|
+
? 'ElasticSearch'
|
|
79
|
+
: 'OpenSearch'
|
|
80
|
+
} version ${searchEngineVersion} in container`
|
|
81
|
+
}
|
|
82
|
+
} catch (e) {
|
|
83
|
+
subTask.skip()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
],
|
|
30
88
|
{
|
|
31
|
-
|
|
32
|
-
|
|
89
|
+
rendererOptions: {
|
|
90
|
+
collapse: true
|
|
91
|
+
}
|
|
33
92
|
}
|
|
34
93
|
)
|
|
94
|
+
} else {
|
|
95
|
+
await waitForLogs({
|
|
96
|
+
containerName: elasticsearch.name,
|
|
97
|
+
matchText:
|
|
98
|
+
searchengine === 'elasticsearch' ? '"started"' : '] started'
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const response = await request(
|
|
103
|
+
`http://localhost:${ports.elasticsearch}/`,
|
|
104
|
+
{
|
|
105
|
+
method: 'GET',
|
|
106
|
+
responseType: 'json'
|
|
107
|
+
}
|
|
108
|
+
)
|
|
35
109
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
110
|
+
if (response.status !== 200) {
|
|
111
|
+
if (searchengine === 'opensearch') {
|
|
112
|
+
throw new UnknownError(
|
|
113
|
+
`OpenSearch container is not running!\n\nStatus code: ${response.status}, Response: ${response.data.message}`
|
|
114
|
+
)
|
|
115
|
+
} else {
|
|
116
|
+
throw new UnknownError(
|
|
117
|
+
`ElasticSearch container is not running!\n\nStatus code: ${response.status}, Response: ${response.data.message}`
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const searchEngineVersion = response.data.version.number
|
|
123
|
+
if (searchengine === 'elasticsearch') {
|
|
124
|
+
ctx.elasticSearchVersion = searchEngineVersion
|
|
125
|
+
} else {
|
|
126
|
+
ctx.openSearchVersion = searchEngineVersion
|
|
127
|
+
}
|
|
128
|
+
} catch (e) {
|
|
129
|
+
if (searchengine === 'opensearch') {
|
|
41
130
|
throw new UnknownError(
|
|
42
|
-
`
|
|
131
|
+
`Cannot connect to OpenSearch container!\n\n${e.message}`
|
|
43
132
|
)
|
|
44
133
|
} else {
|
|
45
134
|
throw new UnknownError(
|
|
46
|
-
`
|
|
135
|
+
`Cannot connect to ElasticSearch container!\n\n${e.message}`
|
|
47
136
|
)
|
|
48
137
|
}
|
|
49
138
|
}
|
|
50
|
-
|
|
51
|
-
const searchEngineVersion = response.data.version.number
|
|
52
|
-
if (searchengine === 'elasticsearch') {
|
|
53
|
-
ctx.elasticSearchVersion = searchEngineVersion
|
|
54
|
-
} else {
|
|
55
|
-
ctx.openSearchVersion = searchEngineVersion
|
|
56
|
-
}
|
|
57
|
-
} catch (e) {
|
|
58
|
-
if (searchengine === 'opensearch') {
|
|
59
|
-
throw new UnknownError(
|
|
60
|
-
`Cannot connect to OpenSearch container!\n\n${e.message}`
|
|
61
|
-
)
|
|
62
|
-
} else {
|
|
63
|
-
throw new UnknownError(
|
|
64
|
-
`Cannot connect to ElasticSearch container!\n\n${e.message}`
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
139
|
}
|
|
68
140
|
}
|
|
69
141
|
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const UnknownError = require('../errors/unknown-error')
|
|
2
|
+
const runComposerCommand = require('./run-composer')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {String} command
|
|
6
|
+
* @param {Object} [options]
|
|
7
|
+
* @param {(e: Error) => void} [options.onError]
|
|
8
|
+
* @returns {import('listr2').ListrTask<import('../../typings/context').ListrContext>}
|
|
9
|
+
*/
|
|
10
|
+
const composerTask = (command, options = {}) => ({
|
|
11
|
+
title: `Running command 'composer ${command}'`,
|
|
12
|
+
task: async (ctx, task) => {
|
|
13
|
+
try {
|
|
14
|
+
await runComposerCommand(ctx, command, {
|
|
15
|
+
callback: !ctx.verbose
|
|
16
|
+
? undefined
|
|
17
|
+
: (t) => {
|
|
18
|
+
task.output = t
|
|
19
|
+
},
|
|
20
|
+
throwNonZeroCode: true
|
|
21
|
+
})
|
|
22
|
+
} catch (e) {
|
|
23
|
+
if (e instanceof UnknownError && options.onError) {
|
|
24
|
+
options.onError(e)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
throw e
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
options: {
|
|
31
|
+
bottomBar: 10
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
module.exports = composerTask
|
|
@@ -5,36 +5,36 @@ const {
|
|
|
5
5
|
} = require('../tasks/docker/containers/container-api')
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @param {{ containerName: string,
|
|
9
|
-
* @returns {Promise<never>}
|
|
8
|
+
* @param {{ containerName: string, commands: string[], user?: string }} param0
|
|
10
9
|
*/
|
|
11
|
-
const executeInContainer = ({ containerName,
|
|
10
|
+
const executeInContainer = ({ containerName, commands, user }) => {
|
|
12
11
|
if (!process.stdin.isTTY) {
|
|
13
12
|
process.stderr.write('This app works only in TTY mode')
|
|
14
13
|
process.exit(1)
|
|
15
14
|
}
|
|
15
|
+
const [commandBin, ...commandsArgs] = commands
|
|
16
16
|
|
|
17
17
|
const execArgs = execCommand({
|
|
18
18
|
container: containerName,
|
|
19
|
-
command,
|
|
19
|
+
command: commandBin,
|
|
20
20
|
user,
|
|
21
21
|
tty: true,
|
|
22
22
|
interactive: true
|
|
23
23
|
})
|
|
24
|
+
const [command, ...args] = execArgs
|
|
24
25
|
|
|
25
|
-
spawn(
|
|
26
|
-
stdio:
|
|
26
|
+
const child = spawn(command, [...args, ...commandsArgs], {
|
|
27
|
+
stdio: 'inherit'
|
|
27
28
|
})
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
child.on('close', (code) => {
|
|
31
|
+
process.exit(code)
|
|
31
32
|
})
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* @param {import('../tasks/docker/containers/container-api').ContainerRunOptions} options
|
|
36
37
|
* @param {string[]} commands
|
|
37
|
-
* @returns {Promise<never>}
|
|
38
38
|
*/
|
|
39
39
|
const runInContainer = (options, commands) => {
|
|
40
40
|
if (!process.stdin.isTTY) {
|
|
@@ -46,14 +46,19 @@ const runInContainer = (options, commands) => {
|
|
|
46
46
|
...options,
|
|
47
47
|
tty: true,
|
|
48
48
|
detach: false,
|
|
49
|
-
rm: true
|
|
50
|
-
command: commands.join(' ')
|
|
49
|
+
rm: true
|
|
51
50
|
})
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
const [commandBin, ...commandsArgs] = commands
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const [command, ...args] = runArgs
|
|
55
|
+
|
|
56
|
+
const child = spawn(command, [...args, commandBin, ...commandsArgs], {
|
|
57
|
+
stdio: 'inherit'
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
child.on('close', (code) => {
|
|
61
|
+
process.exit(code)
|
|
57
62
|
})
|
|
58
63
|
}
|
|
59
64
|
|
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.
|
|
6
|
+
"version": "2.4.3-alpha.0",
|
|
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": "
|
|
62
|
+
"gitHead": "022a9b630c7a2e226ee10ee3291f547b9545716b"
|
|
63
63
|
}
|