@scandipwa/magento-scripts 2.4.10-alpha.0 → 2.4.10
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/cli.js +25 -9
- package/lib/config/docker.js +17 -12
- package/lib/config/magento/required-php-extensions/magento-2.4.js +1 -0
- package/lib/config/php-config.js +2 -1
- package/lib/config/services/composer/versions/composer-1.js +1 -1
- package/lib/config/services/composer/versions/composer-2.9.js +8 -0
- package/lib/config/services/composer/versions/index.js +2 -1
- package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +4 -4
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.6.js +2 -1
- package/lib/config/services/nginx/versions/nginx-1.18.js +2 -1
- package/lib/config/services/nginx/versions/nginx-1.22.js +2 -1
- package/lib/config/services/nginx/versions/nginx-1.24.js +2 -1
- package/lib/config/services/nginx/versions/nginx-1.26.js +2 -1
- package/lib/config/services/nginx/versions/nginx-1.28.js +3 -2
- package/lib/config/services/php/versions/php-8.1.js +1 -1
- package/lib/config/services/php/versions/php-8.2.js +1 -1
- package/lib/config/services/php/versions/php-8.3.js +1 -1
- package/lib/config/services/php/versions/php-8.4.js +1 -1
- package/lib/config/services/php/versions/php-8.5.js +32 -0
- package/lib/config/templates/magentorc.template +1 -0
- package/lib/config/templates/nginx.template.conf +1 -1
- package/lib/config/versions/magento-2.4.4-p16.js +1 -1
- package/lib/config/versions/magento-2.4.4-p17.js +41 -0
- package/lib/config/versions/magento-2.4.5-p16.js +41 -0
- package/lib/config/versions/magento-2.4.6-p14.js +41 -0
- package/lib/config/versions/magento-2.4.7-p1.js +2 -2
- package/lib/config/versions/magento-2.4.7-p2.js +2 -2
- package/lib/config/versions/magento-2.4.7-p3.js +2 -2
- package/lib/config/versions/magento-2.4.7-p4.js +2 -2
- package/lib/config/versions/magento-2.4.7-p5.js +2 -2
- package/lib/config/versions/magento-2.4.7-p6.js +2 -2
- package/lib/config/versions/magento-2.4.7-p7.js +2 -2
- package/lib/config/versions/magento-2.4.7-p8.js +2 -2
- package/lib/config/versions/magento-2.4.7-p9.js +41 -0
- package/lib/config/versions/magento-2.4.7.js +2 -2
- package/lib/config/versions/magento-2.4.8-p1.js +2 -2
- package/lib/config/versions/magento-2.4.8-p2.js +2 -2
- package/lib/config/versions/magento-2.4.8-p3.js +2 -3
- package/lib/config/versions/magento-2.4.8-p4.js +43 -0
- package/lib/config/versions/magento-2.4.8.js +2 -2
- package/lib/config/versions/magento-2.4.9-beta1.js +41 -0
- package/lib/tasks/docker/containers/container-api.js +2 -2
- package/lib/tasks/docker/containers/tasks.js +31 -18
- package/lib/tasks/docker/image/image-api.d.ts +12 -0
- package/lib/tasks/docker/image/image-api.js +22 -1
- package/lib/tasks/docker/project-image-builder.js +21 -11
- package/lib/tasks/execute.js +2 -1
- package/lib/tasks/magento/setup-magento/clear-logs.js +31 -0
- package/lib/tasks/magento/setup-magento/disable-2fa.js +13 -0
- package/lib/tasks/magento/setup-magento/set-base-url.js +42 -15
- package/lib/tasks/magento/setup-magento/urn-highlighter.js +84 -2
- package/lib/tasks/requirements/searchengine-version.js +25 -30
- package/lib/tasks/start.js +9 -5
- package/lib/util/config-file-validator.js +15 -7
- package/lib/util/execute-in-container.js +4 -3
- package/lib/util/instance-metadata.js +15 -9
- package/lib/util/open-browser.js +7 -0
- package/lib/util/wait-for-logs.js +5 -2
- package/package.json +2 -2
- package/typings/context.d.ts +4 -2
- package/typings/index.d.ts +22 -0
- package/lib/config/services/elasticsearch/base-repo.js +0 -3
|
@@ -5,9 +5,10 @@ const KnownError = require('../../../errors/known-error')
|
|
|
5
5
|
* @param {number} scopeId
|
|
6
6
|
* @param {string} code
|
|
7
7
|
* @param {string} host
|
|
8
|
+
* @param {'websites' | 'stores'} scopeType
|
|
8
9
|
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
9
10
|
*/
|
|
10
|
-
const setBaseUrlForScope = (scopeId, code, host) => ({
|
|
11
|
+
const setBaseUrlForScope = (scopeId, code, host, scopeType) => ({
|
|
11
12
|
title: `store code ${code} at ${host}`,
|
|
12
13
|
task: async (ctx, task) => {
|
|
13
14
|
const {
|
|
@@ -31,7 +32,7 @@ const setBaseUrlForScope = (scopeId, code, host) => ({
|
|
|
31
32
|
const secureLocation = `${host}/` // SSL will work only on port 443, so you cannot run multiple projects with SSL at the same time.
|
|
32
33
|
const httpUrl = `http://${location}`
|
|
33
34
|
const httpsUrl = `https://${secureLocation}`
|
|
34
|
-
const scope = scopeId === 0 ? 'default' :
|
|
35
|
+
const scope = scopeId === 0 ? 'default' : scopeType
|
|
35
36
|
const table = 'core_config_data'
|
|
36
37
|
const values = [
|
|
37
38
|
{
|
|
@@ -83,11 +84,13 @@ const setBaseUrl = () => ({
|
|
|
83
84
|
task: async (ctx, task) => {
|
|
84
85
|
const {
|
|
85
86
|
config: {
|
|
86
|
-
overridenConfiguration: { ssl, storeDomains }
|
|
87
|
+
overridenConfiguration: { ssl, storeDomains, configuration }
|
|
87
88
|
},
|
|
88
89
|
databaseConnection
|
|
89
90
|
} = ctx
|
|
90
91
|
|
|
92
|
+
const runType = configuration?.nginx?.runType || 'website'
|
|
93
|
+
|
|
91
94
|
const enableSecureFrontend = ssl.enabled ? '1' : '0'
|
|
92
95
|
|
|
93
96
|
await updateTableValues(
|
|
@@ -110,27 +113,33 @@ const setBaseUrl = () => ({
|
|
|
110
113
|
{ databaseConnection, task }
|
|
111
114
|
)
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
+
const scopeType = runType === 'store' ? 'stores' : 'websites'
|
|
117
|
+
const tableName = runType === 'store' ? 'store' : 'store_website'
|
|
118
|
+
const idField = runType === 'store' ? 'store_id' : 'website_id'
|
|
119
|
+
|
|
120
|
+
const [entities] = await databaseConnection.query(
|
|
121
|
+
`select * from ${tableName};`
|
|
116
122
|
)
|
|
117
123
|
|
|
118
|
-
if (!
|
|
124
|
+
if (!entities || entities.length === 0) {
|
|
119
125
|
throw new KnownError(
|
|
120
|
-
`No
|
|
126
|
+
`No ${
|
|
127
|
+
runType === 'store' ? 'stores' : 'store websites'
|
|
128
|
+
} found in database, ${tableName} table is empty or does not exist`
|
|
121
129
|
)
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
const storeDomainsWithMapping = Object.entries(storeDomains).reduce(
|
|
125
133
|
(acc, [key, val]) => {
|
|
126
|
-
const
|
|
127
|
-
|
|
134
|
+
const entity = entities.find(
|
|
135
|
+
/** @param {{ code: string }} entity */
|
|
136
|
+
(entity) => entity.code === key
|
|
128
137
|
)
|
|
129
|
-
if (
|
|
138
|
+
if (entity) {
|
|
130
139
|
return {
|
|
131
140
|
...acc,
|
|
132
|
-
[
|
|
133
|
-
|
|
141
|
+
[entity.code]: {
|
|
142
|
+
scopeId: entity[idField],
|
|
134
143
|
domain: val
|
|
135
144
|
}
|
|
136
145
|
}
|
|
@@ -141,10 +150,28 @@ const setBaseUrl = () => ({
|
|
|
141
150
|
{}
|
|
142
151
|
)
|
|
143
152
|
|
|
153
|
+
// Check for missing store codes when runType is 'store'
|
|
154
|
+
if (runType === 'store') {
|
|
155
|
+
const missingCodes = Object.keys(storeDomains).filter(
|
|
156
|
+
(code) =>
|
|
157
|
+
!entities.some(
|
|
158
|
+
/** @param {{ code: string }} entity */
|
|
159
|
+
(entity) => entity.code === code
|
|
160
|
+
)
|
|
161
|
+
)
|
|
162
|
+
if (missingCodes.length > 0) {
|
|
163
|
+
throw new KnownError(
|
|
164
|
+
`Store codes not found in database: ${missingCodes.join(
|
|
165
|
+
', '
|
|
166
|
+
)}. Please check your storeDomains configuration in cma.js matches the store codes in the store table.`
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
144
171
|
return task.newListr(
|
|
145
172
|
Object.entries(storeDomainsWithMapping).map(
|
|
146
|
-
([storeCode, {
|
|
147
|
-
setBaseUrlForScope(
|
|
173
|
+
([storeCode, { scopeId, domain }]) =>
|
|
174
|
+
setBaseUrlForScope(scopeId, storeCode, domain, scopeType)
|
|
148
175
|
),
|
|
149
176
|
{
|
|
150
177
|
concurrent: true,
|
|
@@ -8,8 +8,8 @@ const pathExists = require('../../../util/path-exists')
|
|
|
8
8
|
*
|
|
9
9
|
* @reference https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-urn.html
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
12
|
-
title: 'Generating URN highlighter',
|
|
11
|
+
const urnHighlighterForPHPStorm = () => ({
|
|
12
|
+
title: 'Generating URN highlighter for PHPStorm',
|
|
13
13
|
task: async (ctx, task) => {
|
|
14
14
|
if (!(await pathExists(path.join(process.cwd(), './.idea')))) {
|
|
15
15
|
await fs.promises.mkdir(path.join(process.cwd(), './.idea'))
|
|
@@ -26,4 +26,86 @@ const urnHighlighter = () => ({
|
|
|
26
26
|
}
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
31
|
+
*/
|
|
32
|
+
const vscodeSettingsXmlCatalogs = () => ({
|
|
33
|
+
task: async (ctx, task) => {
|
|
34
|
+
const settingsPath = path.join(process.cwd(), './.vscode/settings.json')
|
|
35
|
+
const catalogEntry = './.vscode/catalog.xml'
|
|
36
|
+
|
|
37
|
+
let settings = {}
|
|
38
|
+
if (await pathExists(settingsPath)) {
|
|
39
|
+
try {
|
|
40
|
+
const content = await fs.promises.readFile(settingsPath, 'utf8')
|
|
41
|
+
settings = JSON.parse(content)
|
|
42
|
+
} catch {
|
|
43
|
+
// If the file is not valid JSON, we'll overwrite the xml.catalogs key only
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const existing = settings['xml.catalogs']
|
|
48
|
+
/** @type {string[]} */
|
|
49
|
+
const catalogs = Array.isArray(existing) ? existing : []
|
|
50
|
+
|
|
51
|
+
if (catalogs.includes(catalogEntry)) {
|
|
52
|
+
task.skip()
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
settings['xml.catalogs'] = [...catalogs, catalogEntry]
|
|
57
|
+
await fs.promises.writeFile(
|
|
58
|
+
settingsPath,
|
|
59
|
+
JSON.stringify(settings, null, 4),
|
|
60
|
+
'utf8'
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
67
|
+
*
|
|
68
|
+
* @reference https://www.thebeardeddeveloper.co.uk/resources/articles/vscode-xml-autocomplete-for-magento
|
|
69
|
+
*/
|
|
70
|
+
const urnHighlighterForVSCode = () => ({
|
|
71
|
+
title: 'Generating URN highlighter for VSCode',
|
|
72
|
+
task: async (ctx, task) => {
|
|
73
|
+
if (!(await pathExists(path.join(process.cwd(), './.vscode')))) {
|
|
74
|
+
await fs.promises.mkdir(path.join(process.cwd(), './.vscode'))
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const subtasks = []
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
!(await pathExists(
|
|
81
|
+
path.join(process.cwd(), './.vscode/catalog.xml')
|
|
82
|
+
))
|
|
83
|
+
) {
|
|
84
|
+
subtasks.push(
|
|
85
|
+
magentoTask(
|
|
86
|
+
'dev:urn-catalog:generate --ide=vscode ./.vscode/catalog.xml'
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
subtasks.push(vscodeSettingsXmlCatalogs())
|
|
92
|
+
|
|
93
|
+
return task.newListr(subtasks)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
99
|
+
*/
|
|
100
|
+
const urnHighlighter = () => ({
|
|
101
|
+
title: 'Generating URN highlighter',
|
|
102
|
+
task: (ctx, task) =>
|
|
103
|
+
task.newListr(
|
|
104
|
+
[urnHighlighterForPHPStorm(), urnHighlighterForVSCode()],
|
|
105
|
+
{
|
|
106
|
+
concurrent: true
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
})
|
|
110
|
+
|
|
29
111
|
module.exports = urnHighlighter
|
|
@@ -92,38 +92,33 @@ const checkSearchEngineVersion = () => ({
|
|
|
92
92
|
}
|
|
93
93
|
)
|
|
94
94
|
} else {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
/** @param {string} line */
|
|
96
|
+
const legacyMatcher = (line) => {
|
|
97
|
+
if (!line.startsWith('[')) {
|
|
98
|
+
return false
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const message = line.replaceAll(/\[[\s\S]+\]/g, '').trim()
|
|
102
|
+
|
|
103
|
+
return message.startsWith('started')
|
|
104
|
+
} catch {
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
}
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
: {
|
|
110
|
-
containerName: elasticsearch.name,
|
|
111
|
-
customLineParser: (line) => {
|
|
112
|
-
if (!line.startsWith('[')) {
|
|
113
|
-
return false
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
const message = line
|
|
117
|
-
.replaceAll(/\[[\s\S]+\]/g, '')
|
|
118
|
-
.trim()
|
|
109
|
+
await waitForLogs({
|
|
110
|
+
containerName: elasticsearch.name,
|
|
111
|
+
customLineParser: (line) => {
|
|
112
|
+
try {
|
|
113
|
+
const logObject = JSON.parse(line)
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)
|
|
115
|
+
return logObject.message.startsWith('started')
|
|
116
|
+
} catch {
|
|
117
|
+
return legacyMatcher(line)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
successOnTimeout: true
|
|
121
|
+
})
|
|
127
122
|
|
|
128
123
|
try {
|
|
129
124
|
const response = await request(
|
package/lib/tasks/start.js
CHANGED
|
@@ -27,7 +27,7 @@ const getIsWsl = require('../util/is-wsl')
|
|
|
27
27
|
const checkForXDGOpen = require('../util/xdg-open-exists')
|
|
28
28
|
const {
|
|
29
29
|
getInstanceMetadata,
|
|
30
|
-
constants: {
|
|
30
|
+
constants: { WEB_ADMIN_LOCATION_TITLE }
|
|
31
31
|
} = require('../util/instance-metadata')
|
|
32
32
|
const waitingForVarnish = require('./magento/setup-magento/waiting-for-varnish')
|
|
33
33
|
const checkPHPVersion = require('./requirements/php-version')
|
|
@@ -38,6 +38,7 @@ const { setProjectConfigTask } = require('./project-config')
|
|
|
38
38
|
const {
|
|
39
39
|
convertComposerHomeToComposerCacheVolume
|
|
40
40
|
} = require('./docker/convert-composer-home-to-composer-cache-volume')
|
|
41
|
+
const clearLogs = require('./magento/setup-magento/clear-logs')
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* @returns {import('listr2').ListrTask<import('../../typings/context').ListrContext>}
|
|
@@ -148,7 +149,7 @@ const finishProjectConfiguration = () => ({
|
|
|
148
149
|
title: 'Finishing project configuration',
|
|
149
150
|
skip: ({ skipSetup }) => Boolean(skipSetup),
|
|
150
151
|
task: (ctx, task) =>
|
|
151
|
-
task.newListr([setupThemes(), waitingForVarnish()], {
|
|
152
|
+
task.newListr([setupThemes(), waitingForVarnish(), clearLogs()], {
|
|
152
153
|
rendererOptions: {
|
|
153
154
|
collapse: false
|
|
154
155
|
}
|
|
@@ -191,9 +192,12 @@ const start = () => ({
|
|
|
191
192
|
},
|
|
192
193
|
task: (ctx) => {
|
|
193
194
|
const instanceMetadata = getInstanceMetadata(ctx)
|
|
194
|
-
const locationOnTheWeb =
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
const locationOnTheWeb =
|
|
196
|
+
instanceMetadata.frontend[0] ||
|
|
197
|
+
instanceMetadata.admin.find(
|
|
198
|
+
(u) => u.title === WEB_ADMIN_LOCATION_TITLE
|
|
199
|
+
)
|
|
200
|
+
|
|
197
201
|
if (locationOnTheWeb) {
|
|
198
202
|
openBrowser(locationOnTheWeb.text)
|
|
199
203
|
}
|
|
@@ -101,7 +101,8 @@ const phpConfigurationSchema = Joi.object({
|
|
|
101
101
|
extensions: phpExtensionConfiguration.optional(),
|
|
102
102
|
env: Joi.object()
|
|
103
103
|
.pattern(Joi.string(), [Joi.string(), Joi.number()])
|
|
104
|
-
.optional()
|
|
104
|
+
.optional(),
|
|
105
|
+
platform: Joi.string().optional()
|
|
105
106
|
})
|
|
106
107
|
|
|
107
108
|
/**
|
|
@@ -109,7 +110,9 @@ const phpConfigurationSchema = Joi.object({
|
|
|
109
110
|
*/
|
|
110
111
|
const nginxConfigurationSchema = Joi.object({
|
|
111
112
|
image: Joi.string().optional(),
|
|
112
|
-
configTemplate: Joi.string().optional().custom(fileExistsValidator)
|
|
113
|
+
configTemplate: Joi.string().optional().custom(fileExistsValidator),
|
|
114
|
+
platform: Joi.string().optional(),
|
|
115
|
+
runType: Joi.string().valid('website', 'store').optional()
|
|
113
116
|
})
|
|
114
117
|
|
|
115
118
|
/**
|
|
@@ -119,14 +122,16 @@ const varnishConfigurationSchema = Joi.object({
|
|
|
119
122
|
enabled: Joi.boolean().optional(),
|
|
120
123
|
healthCheck: Joi.boolean().optional(),
|
|
121
124
|
image: Joi.string().optional(),
|
|
122
|
-
configTemplate: Joi.string().optional().custom(fileExistsValidator)
|
|
125
|
+
configTemplate: Joi.string().optional().custom(fileExistsValidator),
|
|
126
|
+
platform: Joi.string().optional()
|
|
123
127
|
})
|
|
124
128
|
|
|
125
129
|
/**
|
|
126
130
|
* @type {Joi.ObjectSchema<import('../../typings').ServiceWithImage>}
|
|
127
131
|
*/
|
|
128
132
|
const serviceConfigurationSchema = Joi.object({
|
|
129
|
-
image: Joi.string().optional()
|
|
133
|
+
image: Joi.string().optional(),
|
|
134
|
+
platform: Joi.string().optional()
|
|
130
135
|
})
|
|
131
136
|
|
|
132
137
|
/**
|
|
@@ -136,7 +141,8 @@ const mariadbConfigurationSchema = Joi.object({
|
|
|
136
141
|
image: Joi.string().optional(),
|
|
137
142
|
useOptimizerSwitch: Joi.alternatives()
|
|
138
143
|
.try(Joi.string(), Joi.boolean())
|
|
139
|
-
.optional()
|
|
144
|
+
.optional(),
|
|
145
|
+
platform: Joi.string().optional()
|
|
140
146
|
})
|
|
141
147
|
|
|
142
148
|
/**
|
|
@@ -144,12 +150,14 @@ const mariadbConfigurationSchema = Joi.object({
|
|
|
144
150
|
*/
|
|
145
151
|
const elasticsearchConfigurationSchema = Joi.object({
|
|
146
152
|
image: Joi.string().optional(),
|
|
147
|
-
env: Joi.object().optional()
|
|
153
|
+
env: Joi.object().optional(),
|
|
154
|
+
platform: Joi.string().optional()
|
|
148
155
|
})
|
|
149
156
|
|
|
150
157
|
const opensearchConfigurationSchema = Joi.object({
|
|
151
158
|
image: Joi.string().optional(),
|
|
152
|
-
env: Joi.object().optional()
|
|
159
|
+
env: Joi.object().optional(),
|
|
160
|
+
platform: Joi.string().optional()
|
|
153
161
|
})
|
|
154
162
|
|
|
155
163
|
const searchEngineConfiguration = Joi.string().valid(
|
|
@@ -2,9 +2,9 @@ const { spawn } = require('child_process')
|
|
|
2
2
|
const { execCommand, run } = require('../tasks/docker/containers/container-api')
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @param {{ containerName: string, commands: string[], user?: string }} param0
|
|
5
|
+
* @param {{ containerName: string, commands: string[], user?: string, env?: Record<string, string> }} param0
|
|
6
6
|
*/
|
|
7
|
-
const executeInContainer = ({ containerName, commands, user }) => {
|
|
7
|
+
const executeInContainer = ({ containerName, commands, user, env }) => {
|
|
8
8
|
if (!process.stdin.isTTY) {
|
|
9
9
|
process.stderr.write('This app works only in TTY mode')
|
|
10
10
|
process.exit(1)
|
|
@@ -16,7 +16,8 @@ const executeInContainer = ({ containerName, commands, user }) => {
|
|
|
16
16
|
command: commandBin,
|
|
17
17
|
user,
|
|
18
18
|
tty: true,
|
|
19
|
-
interactive: true
|
|
19
|
+
interactive: true,
|
|
20
|
+
env: env || {}
|
|
20
21
|
})
|
|
21
22
|
const [command, ...args] = execArgs
|
|
22
23
|
|
|
@@ -24,7 +24,11 @@ const getInstanceMetadata = (ctx) => {
|
|
|
24
24
|
ports,
|
|
25
25
|
config: {
|
|
26
26
|
magentoConfiguration,
|
|
27
|
-
overridenConfiguration: {
|
|
27
|
+
overridenConfiguration: {
|
|
28
|
+
ssl,
|
|
29
|
+
storeDomains,
|
|
30
|
+
magento: { adminuri }
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
} = ctx
|
|
30
34
|
|
|
@@ -66,14 +70,16 @@ const getInstanceMetadata = (ctx) => {
|
|
|
66
70
|
})
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
admin.push({
|
|
74
|
+
title: WEB_ADMIN_LOCATION_TITLE,
|
|
75
|
+
text: logger.style.link(
|
|
76
|
+
`${ssl.enabled ? 'https' : 'http'}://${storeDomains.admin}${
|
|
77
|
+
ssl.enabled || ports.sslTerminator === 80
|
|
78
|
+
? ''
|
|
79
|
+
: `:${ports.sslTerminator}`
|
|
80
|
+
}/${adminuri}/`
|
|
81
|
+
)
|
|
82
|
+
})
|
|
77
83
|
|
|
78
84
|
admin.push({
|
|
79
85
|
title: WEB_ADMIN_CREDENTIALS_TITLE,
|
package/lib/util/open-browser.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
const { execAsync } = require('./exec-async')
|
|
2
2
|
|
|
3
|
+
const isCMANoOpen =
|
|
4
|
+
process.env.CMA_NO_OPEN === '1' || process.env.CMA_NO_OPEN === 'true'
|
|
5
|
+
|
|
3
6
|
// eslint-disable-next-line no-control-regex
|
|
4
7
|
const consoleStyleReplacer = /[\u001b]\[\S+?m/g
|
|
5
8
|
/**
|
|
6
9
|
* @param {string} url
|
|
7
10
|
*/
|
|
8
11
|
const openBrowser = async (url) => {
|
|
12
|
+
if (isCMANoOpen) {
|
|
13
|
+
return
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
const start = process.platform === 'darwin' ? 'open' : 'xdg-open'
|
|
10
17
|
|
|
11
18
|
await execAsync(`${start} ${url.replace(consoleStyleReplacer, '')}`)
|
|
@@ -2,12 +2,13 @@ const { execAsyncSpawn } = require('./exec-async-command')
|
|
|
2
2
|
const sleep = require('./sleep')
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @param {{ containerName: string, timeout?: number, matchText?: string | string[], customLineParser?: (line: string) => boolean }} param0
|
|
5
|
+
* @param {{ containerName: string, timeout?: number, matchText?: string | string[], customLineParser?: (line: string) => boolean, successOnTimeout?: boolean }} param0
|
|
6
6
|
* @returns {Promise<void>}
|
|
7
7
|
*/
|
|
8
8
|
const waitForLogs = ({
|
|
9
9
|
containerName,
|
|
10
10
|
timeout = 30 * 1000,
|
|
11
|
+
successOnTimeout = false,
|
|
11
12
|
matchText,
|
|
12
13
|
customLineParser
|
|
13
14
|
}) =>
|
|
@@ -58,8 +59,10 @@ const waitForLogs = ({
|
|
|
58
59
|
})
|
|
59
60
|
])
|
|
60
61
|
|
|
61
|
-
if (timeoutExceeded) {
|
|
62
|
+
if (timeoutExceeded && !successOnTimeout) {
|
|
62
63
|
reject(new Error('Timeout exception'))
|
|
64
|
+
} else {
|
|
65
|
+
resolve()
|
|
63
66
|
}
|
|
64
67
|
})
|
|
65
68
|
|
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.10
|
|
6
|
+
"version": "2.4.10",
|
|
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": "c901bd4d25f0e127f9fc286ba979e49d2a145757"
|
|
63
63
|
}
|
package/typings/context.d.ts
CHANGED
|
@@ -67,15 +67,16 @@ export interface ListrContext {
|
|
|
67
67
|
edition?: 'community' | 'enterprise'
|
|
68
68
|
config: {
|
|
69
69
|
php: {
|
|
70
|
+
iniPath: string
|
|
70
71
|
iniTemplatePath: string
|
|
71
72
|
fpmConfPath: string
|
|
72
73
|
fpmTemplatePath: string
|
|
73
74
|
debugIniPath: string
|
|
74
75
|
debugTemplatePath: string
|
|
75
76
|
debugFpmConfPath: string
|
|
76
|
-
debugFpmTemplatePath: string
|
|
77
77
|
extensions: PHPExtensions
|
|
78
|
-
|
|
78
|
+
env: Record<string, unknown>
|
|
79
|
+
platform?: 'linux/amd64' | 'linux/arm64' | (string & {})
|
|
79
80
|
}
|
|
80
81
|
composer: {
|
|
81
82
|
dirPath: string
|
|
@@ -120,6 +121,7 @@ export interface ListrContext {
|
|
|
120
121
|
dependsOn?: string[]
|
|
121
122
|
serviceReadyLog?: string
|
|
122
123
|
platform?: string
|
|
124
|
+
execCommandEnv?: Record<string, string>
|
|
123
125
|
}
|
|
124
126
|
>
|
|
125
127
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface ServiceWithImage {
|
|
|
14
14
|
* Service Docker image
|
|
15
15
|
*/
|
|
16
16
|
image: string
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Service platform
|
|
20
|
+
*/
|
|
21
|
+
platform?: 'linux/amd64' | 'linux/arm64' | (string & {})
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export interface ServiceWithoutImage {
|
|
@@ -21,6 +26,11 @@ export interface ServiceWithoutImage {
|
|
|
21
26
|
* Service Docker image
|
|
22
27
|
*/
|
|
23
28
|
image: string
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Service platform
|
|
32
|
+
*/
|
|
33
|
+
platform?: 'linux/amd64' | 'linux/arm64' | (string & {})
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
export interface MariaDBConfiguration extends ServiceWithImage {
|
|
@@ -58,6 +68,13 @@ export interface NginxConfiguration extends ServiceWithImage {
|
|
|
58
68
|
* @example ./my-nginx-config.conf
|
|
59
69
|
*/
|
|
60
70
|
configTemplate: string
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Magento run type for nginx configuration
|
|
74
|
+
*
|
|
75
|
+
* @default 'website'
|
|
76
|
+
*/
|
|
77
|
+
runType?: 'website' | 'store' | (string & {})
|
|
61
78
|
}
|
|
62
79
|
|
|
63
80
|
export interface ElasticSearchConfiguration extends ServiceWithImage {
|
|
@@ -228,6 +245,11 @@ export interface PHPConfiguration {
|
|
|
228
245
|
* Environmental variables used for PHP container
|
|
229
246
|
*/
|
|
230
247
|
env: Record<string, unknown>
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Service platform
|
|
251
|
+
*/
|
|
252
|
+
platform?: 'linux/amd64' | 'linux/arm64' | (string & {})
|
|
231
253
|
}
|
|
232
254
|
export interface SSLConfiguration {
|
|
233
255
|
/**
|