@scandipwa/magento-scripts 2.4.10 → 2.4.12-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/index.js +11 -0
- package/lib/commands/cleanup.js +5 -1
- package/lib/commands/cli.js +6 -2
- package/lib/commands/execute.js +18 -4
- package/lib/commands/import-db.js +13 -0
- package/lib/commands/link.js +12 -6
- package/lib/commands/logs.js +7 -1
- package/lib/commands/start.js +7 -2
- package/lib/commands/status.js +4 -1
- package/lib/commands/stop.js +9 -5
- package/lib/config/check-configuration-file.js +7 -5
- package/lib/config/docker.js +2 -1
- package/lib/config/get-magento-version-config.js +2 -0
- package/lib/config/services/composer/versions/composer-2.9.js +1 -1
- package/lib/config/services/mariadb/versions/index.js +2 -1
- package/lib/config/services/mariadb/versions/mariadb-11.8.js +11 -0
- package/lib/config/services/redis/index.js +3 -1
- package/lib/config/services/redis/valkey-9.0.js +8 -0
- package/lib/config/services/varnish/index.js +2 -1
- package/lib/config/services/varnish/varnish-8-0.js +15 -0
- package/lib/config/versions/magento-2.4.4-p18.js +43 -0
- package/lib/config/versions/magento-2.4.5-p17.js +43 -0
- package/lib/config/versions/magento-2.4.6-p15.js +43 -0
- package/lib/config/versions/magento-2.4.7-p10.js +42 -0
- package/lib/config/versions/magento-2.4.8-p4.js +0 -1
- package/lib/config/versions/magento-2.4.8-p5.js +42 -0
- package/lib/config/versions/magento-2.4.9.js +44 -0
- package/lib/tasks/database/create-magento-user.js +26 -6
- package/lib/tasks/database/fix-db.js +6 -4
- package/lib/tasks/database/import-dump-to-database.js +55 -48
- package/lib/tasks/database/import-remote-db/ssh/index.js +22 -16
- package/lib/tasks/database/import-remote-db/ssh/regular-server.js +7 -5
- package/lib/tasks/docker/containers/container-api.d.ts +4 -4
- package/lib/tasks/docker/project-image-builder.js +4 -2
- package/lib/tasks/execute.js +46 -6
- package/lib/tasks/import-dump.js +18 -16
- package/lib/tasks/magento/enable-magento-composer-plugins.js +7 -5
- package/lib/tasks/magento/setup-magento/index-products.js +17 -15
- package/lib/tasks/magento/setup-magento/index.js +29 -1
- package/lib/tasks/magento/setup-magento/install-magento.js +35 -31
- package/lib/tasks/requirements/composer-credentials.js +41 -24
- package/lib/tasks/requirements/docker/context.js +24 -22
- package/lib/tasks/requirements/docker/permissions.js +12 -10
- package/lib/tasks/requirements/docker/running-status.js +31 -21
- package/lib/tasks/start.js +1 -1
- package/lib/util/ensure-agents-md.js +79 -0
- package/lib/util/execute-in-container.js +90 -15
- package/package.json +2 -2
- package/typings/context.d.ts +11 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const mysql2 = require('mysql2/promise')
|
|
2
|
+
const sleep = require('../../util/sleep')
|
|
2
3
|
const defaultMagentoUser = require('./default-magento-user')
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -8,12 +9,31 @@ const createMagentoUser = () => ({
|
|
|
8
9
|
title: 'Creating Magento user',
|
|
9
10
|
task: async (ctx, task) => {
|
|
10
11
|
const { mariadb } = ctx.config.docker.getContainers()
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
|
|
13
|
+
/** @type {import('mysql2/promise').Connection | undefined} */
|
|
14
|
+
let connection
|
|
15
|
+
const maxTries = 20
|
|
16
|
+
|
|
17
|
+
for (let tries = 1; tries <= maxTries; tries++) {
|
|
18
|
+
try {
|
|
19
|
+
connection = await mysql2.createConnection({
|
|
20
|
+
host: '127.0.0.1',
|
|
21
|
+
port: ctx.ports.mariadb,
|
|
22
|
+
user: 'root',
|
|
23
|
+
password: mariadb.env.MARIADB_ROOT_PASSWORD
|
|
24
|
+
})
|
|
25
|
+
break
|
|
26
|
+
} catch (e) {
|
|
27
|
+
if (tries === maxTries) {
|
|
28
|
+
throw e
|
|
29
|
+
}
|
|
30
|
+
await sleep(1000)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!connection) {
|
|
35
|
+
throw new Error('Failed to connect to MariaDB')
|
|
36
|
+
}
|
|
17
37
|
|
|
18
38
|
const result = await connection.query(
|
|
19
39
|
'select Host, User from mysql.user;'
|
|
@@ -36,11 +36,13 @@ const fixDB = () => ({
|
|
|
36
36
|
title: 'Deleting customers data',
|
|
37
37
|
skip: ({ withCustomersData }) => withCustomersData,
|
|
38
38
|
task: async (ctx, subTask) => {
|
|
39
|
-
const deleteCustomerData =
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const deleteCustomerData = ctx.nonInteractive
|
|
40
|
+
? false
|
|
41
|
+
: await subTask.prompt({
|
|
42
|
+
type: 'Confirm',
|
|
43
|
+
message: `Do you want to delete customers data (orders, customers and admin users) from this dump?
|
|
42
44
|
This will reduce database size and remove possible interference for your setup.`
|
|
43
|
-
|
|
45
|
+
})
|
|
44
46
|
|
|
45
47
|
if (!deleteCustomerData) {
|
|
46
48
|
subTask.skip()
|
|
@@ -60,25 +60,27 @@ const runSetGlobalLogBinTrustFunctionCreatorsCommand = () => ({
|
|
|
60
60
|
const deleteDatabaseBeforeImportingDumpPrompt = () => ({
|
|
61
61
|
title: 'Deleting magento database before importing dump',
|
|
62
62
|
task: async (ctx, task) => {
|
|
63
|
-
const deleteDatabaseMagentoChoice =
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const deleteDatabaseMagentoChoice = ctx.nonInteractive
|
|
64
|
+
? 'delete'
|
|
65
|
+
: await task.prompt({
|
|
66
|
+
type: 'Select',
|
|
67
|
+
message: `Before importing database dump, would you like to delete existing database?
|
|
66
68
|
|
|
67
69
|
It is possible that dump might interfere with existing data in database.
|
|
68
70
|
|
|
69
71
|
Note that you will lose your existing database!`,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
choices: [
|
|
73
|
+
{
|
|
74
|
+
name: 'delete',
|
|
75
|
+
message: 'YES I WANT TO DELETE magento DATABASE!'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'skip',
|
|
79
|
+
message:
|
|
80
|
+
"NO I DON'T WANT TO DELETE magento DATABASE! (Skip this step)"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
})
|
|
82
84
|
|
|
83
85
|
if (deleteDatabaseMagentoChoice === 'delete') {
|
|
84
86
|
await ctx.databaseConnection.query(
|
|
@@ -103,22 +105,24 @@ const executeImportDumpSQL = () => ({
|
|
|
103
105
|
const { mariadb } = docker.getContainers(ports)
|
|
104
106
|
const { binFileName } = overridenConfiguration.configuration.mariadb
|
|
105
107
|
|
|
106
|
-
const userCredentialsForMariaDBCLI =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
108
|
+
const userCredentialsForMariaDBCLI = ctx.nonInteractive
|
|
109
|
+
? `--user=root --password=${mariadb.env.MARIADB_ROOT_PASSWORD}`
|
|
110
|
+
: await task.prompt({
|
|
111
|
+
type: 'Select',
|
|
112
|
+
message: `Which user do you want to use to import db in ${mariadb._} client?`,
|
|
113
|
+
choices: [
|
|
114
|
+
{
|
|
115
|
+
name: `--user=root --password=${mariadb.env.MARIADB_ROOT_PASSWORD}`,
|
|
116
|
+
message: `root (${logger.style.command(
|
|
117
|
+
'Probably safest option'
|
|
118
|
+
)})`
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: `--user=${defaultMagentoUser.user} --password=${defaultMagentoUser.password}`,
|
|
122
|
+
message: `${defaultMagentoUser.user}`
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
})
|
|
122
126
|
|
|
123
127
|
const importCommand = `docker exec ${mariadb.name} bash -c "${binFileName} ${userCredentialsForMariaDBCLI} magento < ./dump.sql"`
|
|
124
128
|
|
|
@@ -137,11 +141,13 @@ const executeImportDumpSQL = () => ({
|
|
|
137
141
|
})
|
|
138
142
|
} catch (e) {
|
|
139
143
|
if (e.message.includes("Unknown collation: 'utf8mb4_0900_ai_ci'")) {
|
|
140
|
-
const confirmFixingCollation =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
const confirmFixingCollation = ctx.nonInteractive
|
|
145
|
+
? 'yes'
|
|
146
|
+
: await task.prompt({
|
|
147
|
+
type: 'Select',
|
|
148
|
+
message: `We got the following error while trying to import ${logger.style.file(
|
|
149
|
+
'dump.sql'
|
|
150
|
+
)}!
|
|
145
151
|
|
|
146
152
|
${e.message}
|
|
147
153
|
|
|
@@ -150,18 +156,19 @@ ${logger.style.command(
|
|
|
150
156
|
"sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' dump.sql"
|
|
151
157
|
)}
|
|
152
158
|
`,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
choices: [
|
|
160
|
+
{
|
|
161
|
+
name: 'yes',
|
|
162
|
+
message:
|
|
163
|
+
'Yes, run the following commands, I reaaaalllyy want dump to work! (this will not edit original dump.sql)'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'no',
|
|
167
|
+
message:
|
|
168
|
+
'Okay, I got it. Will try to fix myself'
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
})
|
|
165
172
|
|
|
166
173
|
if (confirmFixingCollation === 'yes') {
|
|
167
174
|
task.output = 'Running fix command...'
|
|
@@ -19,11 +19,13 @@ const sshDb = () => ({
|
|
|
19
19
|
ctx.ssh = ssh
|
|
20
20
|
|
|
21
21
|
if (!password) {
|
|
22
|
-
const privateKey =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const privateKey = ctx.nonInteractive
|
|
23
|
+
? `${os.homedir()}/.ssh/id_rsa`
|
|
24
|
+
: await task.prompt({
|
|
25
|
+
type: 'Input',
|
|
26
|
+
message: `Please enter your private key location to connect to ${hostname}\n`,
|
|
27
|
+
initial: `${os.homedir()}/.ssh/id_rsa`
|
|
28
|
+
})
|
|
27
29
|
|
|
28
30
|
if (!(await pathExists(privateKey))) {
|
|
29
31
|
throw new KnownError(`Private key not found: ${privateKey}`)
|
|
@@ -31,11 +33,13 @@ const sshDb = () => ({
|
|
|
31
33
|
|
|
32
34
|
ctx.privateKey = privateKey
|
|
33
35
|
|
|
34
|
-
const passphrase =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const passphrase = ctx.nonInteractive
|
|
37
|
+
? undefined
|
|
38
|
+
: await task.prompt({
|
|
39
|
+
type: 'Input',
|
|
40
|
+
message:
|
|
41
|
+
'Please enter your private key passphrase (if you have it)'
|
|
42
|
+
})
|
|
39
43
|
|
|
40
44
|
ctx.passphrase = passphrase || undefined
|
|
41
45
|
|
|
@@ -67,14 +71,16 @@ const sshDb = () => ({
|
|
|
67
71
|
const remoteFiles = remoteFilesOutput.split('\n')
|
|
68
72
|
|
|
69
73
|
if (dumpFileNames.every((dumpFile) => remoteFiles.includes(dumpFile))) {
|
|
70
|
-
ctx.makeRemoteDumps =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
ctx.makeRemoteDumps = ctx.nonInteractive
|
|
75
|
+
? true
|
|
76
|
+
: await task.prompt({
|
|
77
|
+
type: 'Toggle',
|
|
78
|
+
enabled: 'Yes!',
|
|
79
|
+
disabled: 'No, just download and import them.',
|
|
80
|
+
message: `We found dump files on remote server.
|
|
75
81
|
Do you want to replace them with new dump files or use existing ones?
|
|
76
82
|
`
|
|
77
|
-
|
|
83
|
+
})
|
|
78
84
|
} else {
|
|
79
85
|
ctx.makeRemoteDumps = true
|
|
80
86
|
}
|
|
@@ -20,15 +20,17 @@ const regularSSHServer = () => ({
|
|
|
20
20
|
/**
|
|
21
21
|
* @type {string}
|
|
22
22
|
*/
|
|
23
|
-
const dumpCommand =
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const dumpCommand = ctx.nonInteractive
|
|
24
|
+
? databaseDumpCommandWithOptions.join(' ')
|
|
25
|
+
: await task.prompt({
|
|
26
|
+
type: 'Input',
|
|
27
|
+
message: `Edit (if needed) command to connect to remote mysql server and create dump files.
|
|
26
28
|
Do not enter "--result-file" option, we need to control that part.
|
|
27
29
|
|
|
28
30
|
(documentation reference available here: https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)
|
|
29
31
|
`,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
initial: databaseDumpCommandWithOptions.join(' ')
|
|
33
|
+
})
|
|
32
34
|
|
|
33
35
|
if (dumpCommand.includes('--result-file')) {
|
|
34
36
|
throw new KnownError(
|
|
@@ -70,10 +70,10 @@ export interface ContainerExecOptions {
|
|
|
70
70
|
interactive?: boolean
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export function exec<T>(
|
|
73
|
+
export function exec<T extends boolean = false>(
|
|
74
74
|
options: ContainerExecOptions,
|
|
75
75
|
execOptions?: ExecAsyncSpawnOptions<T>
|
|
76
|
-
): Promise<string>
|
|
76
|
+
): Promise<T extends true ? { code: number; result: string } : string>
|
|
77
77
|
|
|
78
78
|
export function execCommand(options: ContainerExecOptions): string[]
|
|
79
79
|
|
|
@@ -168,10 +168,10 @@ export interface ContainerRunOptions {
|
|
|
168
168
|
platform?: string
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export function run<T>(
|
|
171
|
+
export function run<T extends boolean = false>(
|
|
172
172
|
containerOptions: ContainerRunOptions,
|
|
173
173
|
execOptions?: ExecAsyncSpawnOptions<T>
|
|
174
|
-
): Promise<string>
|
|
174
|
+
): Promise<T extends true ? { code: number; result: string } : string>
|
|
175
175
|
|
|
176
176
|
export function runCommand(options: ContainerRunOptions): string[]
|
|
177
177
|
|
|
@@ -223,11 +223,13 @@ const buildDockerFileInstructions = async (
|
|
|
223
223
|
const { agentVersion, licenseKey } = newRelic
|
|
224
224
|
|
|
225
225
|
// eslint-disable-next-line max-len
|
|
226
|
+
// Use linux-musl archive for Alpine-based images.
|
|
227
|
+
const newRelicArchive = `newrelic-php5-${agentVersion}-linux-musl`
|
|
226
228
|
dockerFileInstructions.run('apk add --no-cache gcompat')
|
|
227
|
-
.run(`curl -L https://download.newrelic.com/php_agent/archive/${agentVersion}
|
|
229
|
+
.run(`curl -L https://download.newrelic.com/php_agent/archive/${agentVersion}/${newRelicArchive}.tar.gz | tar -C /tmp -zx \
|
|
228
230
|
&& export NR_INSTALL_USE_CP_NOT_LN=1 \
|
|
229
231
|
&& export NR_INSTALL_SILENT=1 \
|
|
230
|
-
&& /tmp
|
|
232
|
+
&& /tmp/${newRelicArchive}/newrelic-install install \
|
|
231
233
|
&& rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*`)
|
|
232
234
|
.run(`sed -i -e "s/REPLACE_WITH_REAL_KEY/${licenseKey}/" \
|
|
233
235
|
-e "s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\\"${
|
package/lib/tasks/execute.js
CHANGED
|
@@ -8,7 +8,9 @@ const { getCachedPorts } = require('../config/get-port-config')
|
|
|
8
8
|
const checkPHPVersion = require('./requirements/php-version')
|
|
9
9
|
const {
|
|
10
10
|
executeInContainer,
|
|
11
|
-
|
|
11
|
+
executeInContainerNonInteractive,
|
|
12
|
+
runInContainer,
|
|
13
|
+
runInContainerNonInteractive
|
|
12
14
|
} = require('../util/execute-in-container')
|
|
13
15
|
const { containerApi } = require('./docker/containers')
|
|
14
16
|
const dockerNetwork = require('./docker/network')
|
|
@@ -17,10 +19,11 @@ const { prepareFileSystem } = require('./file-system')
|
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
*
|
|
20
|
-
* @param {{ containerName: string, commands: string[] }} argv
|
|
22
|
+
* @param {{ containerName: string, commands: string[], nonInteractive?: boolean }} argv
|
|
21
23
|
* @returns
|
|
22
24
|
*/
|
|
23
25
|
const executeTask = async (argv) => {
|
|
26
|
+
const { nonInteractive = false } = argv
|
|
24
27
|
const tasks = new Listr(
|
|
25
28
|
[
|
|
26
29
|
checkRequirements(),
|
|
@@ -35,8 +38,9 @@ const executeTask = async (argv) => {
|
|
|
35
38
|
{
|
|
36
39
|
concurrent: false,
|
|
37
40
|
exitOnError: true,
|
|
38
|
-
ctx: { throwMagentoVersionMissing: true },
|
|
39
|
-
renderer:
|
|
41
|
+
ctx: { throwMagentoVersionMissing: true, nonInteractive },
|
|
42
|
+
renderer:
|
|
43
|
+
nonInteractive || !process.stdout.isTTY ? 'silent' : 'default',
|
|
40
44
|
rendererOptions: { collapse: false, clearOutput: true }
|
|
41
45
|
}
|
|
42
46
|
)
|
|
@@ -45,10 +49,12 @@ const executeTask = async (argv) => {
|
|
|
45
49
|
try {
|
|
46
50
|
ctx = await tasks.run()
|
|
47
51
|
} catch (e) {
|
|
48
|
-
logger.error(e.message
|
|
52
|
+
logger.error(e instanceof Error ? e.message : String(e))
|
|
49
53
|
process.exit(1)
|
|
50
54
|
}
|
|
51
|
-
const containers =
|
|
55
|
+
const containers = /** @type {Record<string, any>} */ (
|
|
56
|
+
ctx.config.docker.getContainers(ctx.ports)
|
|
57
|
+
)
|
|
52
58
|
const services = Object.keys(containers)
|
|
53
59
|
|
|
54
60
|
if (
|
|
@@ -71,6 +77,11 @@ const executeTask = async (argv) => {
|
|
|
71
77
|
? containerResult[1]
|
|
72
78
|
: containerResult
|
|
73
79
|
|
|
80
|
+
if (nonInteractive && argv.commands.length === 0) {
|
|
81
|
+
logger.error('Non-interactive mode requires a command to execute')
|
|
82
|
+
process.exit(1)
|
|
83
|
+
}
|
|
84
|
+
|
|
74
85
|
if (argv.commands.length === 0) {
|
|
75
86
|
// if we have default connect command then use it
|
|
76
87
|
if (container.connectCommand) {
|
|
@@ -88,6 +99,20 @@ const executeTask = async (argv) => {
|
|
|
88
99
|
})
|
|
89
100
|
|
|
90
101
|
if (containerList.length > 0) {
|
|
102
|
+
if (nonInteractive) {
|
|
103
|
+
const result = await executeInContainerNonInteractive({
|
|
104
|
+
containerName: container.name,
|
|
105
|
+
commands: argv.commands,
|
|
106
|
+
user: container.user,
|
|
107
|
+
env: container.execCommandEnv
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
if (result.result) {
|
|
111
|
+
process.stdout.write(`${result.result}\n`)
|
|
112
|
+
}
|
|
113
|
+
process.exit(result.code)
|
|
114
|
+
}
|
|
115
|
+
|
|
91
116
|
if (process.stdout.isTTY) {
|
|
92
117
|
logger.logN(
|
|
93
118
|
`Executing container ${logger.style.misc(
|
|
@@ -109,6 +134,21 @@ const executeTask = async (argv) => {
|
|
|
109
134
|
}
|
|
110
135
|
|
|
111
136
|
if (container.name.includes('php')) {
|
|
137
|
+
if (nonInteractive) {
|
|
138
|
+
const result = await runInContainerNonInteractive(
|
|
139
|
+
{
|
|
140
|
+
...container,
|
|
141
|
+
name: `${container.name}_exec-${Date.now()}`
|
|
142
|
+
},
|
|
143
|
+
argv.commands
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
if (result.result) {
|
|
147
|
+
process.stdout.write(`${result.result}\n`)
|
|
148
|
+
}
|
|
149
|
+
process.exit(result.code)
|
|
150
|
+
}
|
|
151
|
+
|
|
112
152
|
if (process.stdout.isTTY) {
|
|
113
153
|
logger.logN(
|
|
114
154
|
`Starting container ${logger.style.misc(
|
package/lib/tasks/import-dump.js
CHANGED
|
@@ -51,22 +51,24 @@ const importDump = () => ({
|
|
|
51
51
|
},
|
|
52
52
|
task: async (subCtx, subTask) => {
|
|
53
53
|
const doYouWantToRunSetupOnEmptyDB =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
subCtx.nonInteractive
|
|
55
|
+
? 'skip'
|
|
56
|
+
: await subTask.prompt({
|
|
57
|
+
type: 'Select',
|
|
58
|
+
message: `We detected that Magento is not installed in database. Do you want to install Magento in database BEFORE importing database dump?`,
|
|
59
|
+
choices: [
|
|
60
|
+
{
|
|
61
|
+
name: 'try-install',
|
|
62
|
+
message:
|
|
63
|
+
'Try installing Magento before importing database'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'skip',
|
|
67
|
+
message:
|
|
68
|
+
'Skip installing Magento and import database dump right away!'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
})
|
|
70
72
|
|
|
71
73
|
if (doYouWantToRunSetupOnEmptyDB === 'skip') {
|
|
72
74
|
subTask.skip()
|
|
@@ -180,16 +180,18 @@ const enableMagentoComposerPlugins = () => ({
|
|
|
180
180
|
})
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
const answerForEnablingPlugins =
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
const answerForEnablingPlugins = ctx.nonInteractive
|
|
184
|
+
? 'all-individual'
|
|
185
|
+
: await task.prompt({
|
|
186
|
+
type: 'Select',
|
|
187
|
+
message: `Composer 2.2 requires manually allowing composer-plugins to run.
|
|
186
188
|
Magento requires the following plugins to correctly operate:
|
|
187
189
|
|
|
188
190
|
${missingPluginsFromAllowPlugins.map((p) => logger.style.code(p)).join('\n')}
|
|
189
191
|
|
|
190
192
|
Do you want to enable them all or disable some of them?`,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
choices: pluginOptions
|
|
194
|
+
})
|
|
193
195
|
|
|
194
196
|
switch (answerForEnablingPlugins.toLowerCase()) {
|
|
195
197
|
case 'all': {
|
|
@@ -22,21 +22,23 @@ const indexProducts = () => ({
|
|
|
22
22
|
({ status }) => status !== 'valid'
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
const doYouWantToSkipIndexingPart =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
const doYouWantToSkipIndexingPart = ctx.nonInteractive
|
|
26
|
+
? 'index'
|
|
27
|
+
: await task.prompt({
|
|
28
|
+
type: 'Select',
|
|
29
|
+
message: `Do you want to index the products? (There are ${invalidIndexers.length} invalid indexers, total indexers: ${data[0].length})\n`,
|
|
30
|
+
choices: [
|
|
31
|
+
{
|
|
32
|
+
name: 'index',
|
|
33
|
+
message: 'Yes, index them please'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'skip',
|
|
37
|
+
message:
|
|
38
|
+
'Skip, do not index them. I will do it later myself'
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
})
|
|
40
42
|
|
|
41
43
|
if (doYouWantToSkipIndexingPart === 'skip') {
|
|
42
44
|
task.skip()
|
|
@@ -26,7 +26,21 @@ const setupMagento = (options = {}) => ({
|
|
|
26
26
|
if (options.onlyInstallMagento) {
|
|
27
27
|
return task.newListr([
|
|
28
28
|
flushRedisConfig(),
|
|
29
|
-
migrateDatabase({ onlyInstallMagento: true })
|
|
29
|
+
migrateDatabase({ onlyInstallMagento: true }),
|
|
30
|
+
{
|
|
31
|
+
title: 'Disabling Magento caches',
|
|
32
|
+
task: (ctx, task) => {
|
|
33
|
+
const { varnish } =
|
|
34
|
+
ctx.config.overridenConfiguration.configuration
|
|
35
|
+
return task.newListr(
|
|
36
|
+
magentoTask(
|
|
37
|
+
`cache:disable block_html layout${
|
|
38
|
+
!varnish.enabled ? ' full_page' : ''
|
|
39
|
+
}`
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
30
44
|
])
|
|
31
45
|
}
|
|
32
46
|
|
|
@@ -35,6 +49,20 @@ const setupMagento = (options = {}) => ({
|
|
|
35
49
|
setupMagentoFilePermissions(),
|
|
36
50
|
updateEnvPHP(),
|
|
37
51
|
migrateDatabase(),
|
|
52
|
+
{
|
|
53
|
+
title: 'Disabling Magento caches',
|
|
54
|
+
task: (ctx, task) => {
|
|
55
|
+
const { varnish } =
|
|
56
|
+
ctx.config.overridenConfiguration.configuration
|
|
57
|
+
return task.newListr(
|
|
58
|
+
magentoTask(
|
|
59
|
+
`cache:disable block_html layout${
|
|
60
|
+
!varnish.enabled ? ' full_page' : ''
|
|
61
|
+
}`
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
38
66
|
flushRedisConfig(),
|
|
39
67
|
{
|
|
40
68
|
title: 'Configuring Magento settings',
|