@scandipwa/magento-scripts 2.3.2 → 2.3.4-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/config/docker.js +3 -2
- 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/project-image-builder.js +8 -10
- package/lib/tasks/requirements/elasticsearch-version.js +33 -11
- package/lib/tasks/requirements/opensearch-version.js +33 -11
- package/lib/tasks/status/index.js +7 -2
- package/lib/util/set-config.js +4 -2
- package/package.json +16 -16
- package/typings/context.d.ts +1 -1
package/lib/config/docker.js
CHANGED
|
@@ -365,6 +365,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
365
365
|
env:
|
|
366
366
|
searchengine === 'elasticsearch'
|
|
367
367
|
? deepmerge(
|
|
368
|
+
defaultEsEnv,
|
|
368
369
|
{
|
|
369
370
|
// https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-settings.html
|
|
370
371
|
'xpack.ml.enabled': ['sse4.2', 'sse4_2'].some(
|
|
@@ -372,9 +373,9 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
372
373
|
cpuSupportedFlags.includes(sse42Flag)
|
|
373
374
|
)
|
|
374
375
|
},
|
|
375
|
-
elasticsearch.env ||
|
|
376
|
+
elasticsearch.env || {}
|
|
376
377
|
)
|
|
377
|
-
: deepmerge(
|
|
378
|
+
: deepmerge(defaultOsEnv, opensearch.env || {}),
|
|
378
379
|
network: network.name,
|
|
379
380
|
image: `${
|
|
380
381
|
searchengine === 'elasticsearch'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const os = require('os')
|
|
2
|
-
const { NodeSSH } = require('node-ssh')
|
|
2
|
+
const { NodeSSH } = require('node-ssh-no-cpu-features')
|
|
3
3
|
const pathExists = require('../../../../util/path-exists')
|
|
4
4
|
const regularSSHServer = require('./regular-server')
|
|
5
5
|
const readymageSSH = require('./readymage')
|
|
@@ -4,7 +4,7 @@ const { execAsyncSpawn } = require('../../../../util/exec-async-command')
|
|
|
4
4
|
const databaseDumpCommandWithOptions = require('./database-dump-command')
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh').NodeSSH }>}
|
|
7
|
+
* @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh-no-cpu-features').NodeSSH }>}
|
|
8
8
|
*/
|
|
9
9
|
const readymageSSH = () => ({
|
|
10
10
|
task: async (ctx, task) => {
|
|
@@ -4,7 +4,7 @@ const { execAsyncSpawn } = require('../../../../util/exec-async-command')
|
|
|
4
4
|
const databaseDumpCommandWithOptions = require('./database-dump-command')
|
|
5
5
|
const KnownError = require('../../../../errors/known-error')
|
|
6
6
|
/**
|
|
7
|
-
* @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh').NodeSSH }>}
|
|
7
|
+
* @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh-no-cpu-features').NodeSSH }>}
|
|
8
8
|
*/
|
|
9
9
|
const regularSSHServer = () => ({
|
|
10
10
|
task: async (ctx, task) => {
|
|
@@ -45,15 +45,10 @@ const addExtensionToBuilder =
|
|
|
45
45
|
let runCommand = ''
|
|
46
46
|
if (typeof command === 'string') {
|
|
47
47
|
runCommand += ` ${command}`
|
|
48
|
-
} else if (command
|
|
48
|
+
} else if (typeof command === 'function') {
|
|
49
49
|
runCommand += ` ${await Promise.resolve(
|
|
50
50
|
command({ ...extensionInstructionsWithoutCommand, ctx })
|
|
51
51
|
)}`
|
|
52
|
-
} else if (typeof command === 'function') {
|
|
53
|
-
runCommand += ` ${command({
|
|
54
|
-
...extensionInstructionsWithoutCommand,
|
|
55
|
-
ctx
|
|
56
|
-
})}`
|
|
57
52
|
} else {
|
|
58
53
|
runCommand += ` docker-php-ext-install ${
|
|
59
54
|
extensionInstructionsWithoutCommand.name || extensionName
|
|
@@ -146,14 +141,17 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
146
141
|
composer.plugins
|
|
147
142
|
)) {
|
|
148
143
|
if (pluginOptions.enabled) {
|
|
144
|
+
const pluginVersion = pluginOptions.version
|
|
149
145
|
dockerFileInstructions
|
|
150
|
-
.comment(
|
|
146
|
+
.comment(
|
|
147
|
+
`install ${pluginName}${
|
|
148
|
+
pluginVersion ? ` (version ${pluginVersion})` : ''
|
|
149
|
+
} composer global package`
|
|
150
|
+
)
|
|
151
151
|
|
|
152
152
|
.run(
|
|
153
153
|
`composer global require ${pluginName}${
|
|
154
|
-
|
|
155
|
-
? ` ${pluginOptions.options}`
|
|
156
|
-
: ''
|
|
154
|
+
pluginVersion ? `:${pluginVersion}` : ''
|
|
157
155
|
}${
|
|
158
156
|
pluginOptions.options
|
|
159
157
|
? ` ${pluginOptions.options}`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { getPort } = require('../../config/port-config')
|
|
1
2
|
const UnknownError = require('../../errors/unknown-error')
|
|
2
3
|
const { containerApi } = require('../docker/containers')
|
|
3
4
|
|
|
@@ -11,19 +12,40 @@ const checkElasticSearchVersion = () => ({
|
|
|
11
12
|
ctx.config.overridenConfiguration.configuration
|
|
12
13
|
const { ports } = ctx
|
|
13
14
|
|
|
15
|
+
const { elasticsearch: elasticSearchContainer } =
|
|
16
|
+
ctx.config.docker.getContainers(ports)
|
|
17
|
+
|
|
14
18
|
let elasticSearchVersionResponse
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const elasticSearchContainerRunning = await containerApi.ls({
|
|
21
|
+
filter: `name=${elasticSearchContainer.name}`,
|
|
22
|
+
formatToJSON: true
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
if (
|
|
26
|
+
elasticSearchContainerRunning.length !== 0 &&
|
|
27
|
+
elasticSearchContainerRunning[0].State === 'running'
|
|
28
|
+
) {
|
|
29
|
+
elasticSearchVersionResponse = await containerApi.exec(
|
|
30
|
+
'elasticsearch --version',
|
|
31
|
+
elasticSearchContainer.name
|
|
32
|
+
)
|
|
33
|
+
} else {
|
|
34
|
+
try {
|
|
35
|
+
const availableElasticSearchPort = await getPort(
|
|
36
|
+
ports.elasticsearch
|
|
37
|
+
)
|
|
38
|
+
elasticSearchVersionResponse = await containerApi.run({
|
|
39
|
+
...elasticsearch,
|
|
40
|
+
command: 'elasticsearch --version',
|
|
41
|
+
detach: false,
|
|
42
|
+
rm: true,
|
|
43
|
+
ports: [`127.0.0.1:${availableElasticSearchPort}:9200`],
|
|
44
|
+
memory: '512mb'
|
|
45
|
+
})
|
|
46
|
+
} catch (e) {
|
|
47
|
+
elasticSearchVersionResponse = e.message
|
|
48
|
+
}
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
const elasticSearchVersionResponseResult =
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { getPort } = require('../../config/port-config')
|
|
1
2
|
const UnknownError = require('../../errors/unknown-error')
|
|
2
3
|
const { containerApi } = require('../docker/containers')
|
|
3
4
|
|
|
@@ -10,19 +11,40 @@ const checkOpenSearchVersion = () => ({
|
|
|
10
11
|
const { opensearch } = ctx.config.overridenConfiguration.configuration
|
|
11
12
|
const { ports } = ctx
|
|
12
13
|
|
|
14
|
+
const { elasticsearch: openSearchContainer } =
|
|
15
|
+
ctx.config.docker.getContainers(ports)
|
|
16
|
+
|
|
13
17
|
let openSearchVersionResponse
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const openSearchContainerRunning = await containerApi.ls({
|
|
20
|
+
filter: `name=${openSearchContainer.name}`,
|
|
21
|
+
formatToJSON: true
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if (
|
|
25
|
+
openSearchContainerRunning.length !== 0 &&
|
|
26
|
+
openSearchContainerRunning[0].State === 'running'
|
|
27
|
+
) {
|
|
28
|
+
openSearchVersionResponse = await containerApi.exec(
|
|
29
|
+
'opensearch --version',
|
|
30
|
+
openSearchContainer.name
|
|
31
|
+
)
|
|
32
|
+
} else {
|
|
33
|
+
try {
|
|
34
|
+
const availableOpenSearchPort = await getPort(
|
|
35
|
+
ports.elasticsearch
|
|
36
|
+
)
|
|
37
|
+
openSearchVersionResponse = await containerApi.run({
|
|
38
|
+
...opensearch,
|
|
39
|
+
command: 'opensearch --version',
|
|
40
|
+
detach: false,
|
|
41
|
+
rm: true,
|
|
42
|
+
ports: [`127.0.0.1:${availableOpenSearchPort}:9200`],
|
|
43
|
+
memory: '512mb'
|
|
44
|
+
})
|
|
45
|
+
} catch (e) {
|
|
46
|
+
openSearchVersionResponse = e.message
|
|
47
|
+
}
|
|
26
48
|
}
|
|
27
49
|
|
|
28
50
|
const openSearchVersionResponseResult = openSearchVersionResponse.match(
|
|
@@ -105,12 +105,17 @@ const prettyStatus = async (ctx) => {
|
|
|
105
105
|
if (
|
|
106
106
|
container.status &&
|
|
107
107
|
container.status.State &&
|
|
108
|
-
container.status.State.Health
|
|
108
|
+
container.status.State.Health &&
|
|
109
|
+
container.status.State.Status === 'running'
|
|
109
110
|
) {
|
|
110
111
|
containerStatus = `✓ ${logger.style.file(
|
|
111
112
|
container.status.State.Health.Status
|
|
112
113
|
)} and ${logger.style.file('running')}`
|
|
113
|
-
} else if (
|
|
114
|
+
} else if (
|
|
115
|
+
container.status &&
|
|
116
|
+
container.status.State &&
|
|
117
|
+
container.status.State.Status !== 'exited'
|
|
118
|
+
) {
|
|
114
119
|
containerStatus = logger.style.file(container.status.State.Status)
|
|
115
120
|
} else {
|
|
116
121
|
containerStatus = '✖ Not running'
|
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.3.
|
|
6
|
+
"version": "2.3.4-alpha.0",
|
|
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": "dc6b868bdfd7c4d063a8e755f050c77b5265cab9"
|
|
63
63
|
}
|
package/typings/context.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export interface ListrContext {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
>
|
|
94
|
-
getContainers(ports?:
|
|
94
|
+
getContainers(ports?: ListrContext['ports']): Record<'php' | 'sslTerminator' | 'nginx' | 'redis' | 'mariadb' | 'elasticsearch' | 'maildev' | 'varnish',
|
|
95
95
|
{
|
|
96
96
|
_: string
|
|
97
97
|
ports: string[]
|