@scandipwa/magento-scripts 1.15.2 → 1.15.3
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/templates/magentorc.template +5 -0
- package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +37 -33
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/index.js +41 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +3 -11
- package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +39 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +0 -10
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +3 -11
- package/lib/tasks/magento/setup-magento/install-magento.js +48 -0
- package/lib/tasks/mysql/connect-to-mysql.js +61 -17
- package/lib/tasks/mysql/create-magento-database.js +18 -0
- package/lib/tasks/requirements/phpbrew/install.js +1 -1
- package/lib/util/env-php-json.js +6 -1
- package/package.json +2 -2
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
RED='\033[0;31m'
|
|
2
|
+
GREEN='\033[0;32m'
|
|
3
|
+
NC='\033[0m' # No Color
|
|
4
|
+
|
|
1
5
|
alias php="$HOME/.phpbrew/php/php-<%= it.php.version %>/bin/php -c $PWD/node_modules/.create-magento-app-cache/php.ini"
|
|
2
6
|
alias magento="php $PWD/bin/magento"
|
|
7
|
+
alias magneto="echo -e 'Not ${RED}magneto${NC} but ${GREEN}magento${NC} please! or at least ${GREEN}m${NC}!' && magento"
|
|
3
8
|
alias m="magento"
|
|
4
9
|
alias composer="php $PWD/node_modules/.create-magento-app-cache/composer/composer.phar"
|
|
5
10
|
alias c="composer"
|
|
@@ -86,33 +86,35 @@ const setupExcludedFolders = (excludedFoldersConfig) => {
|
|
|
86
86
|
return hasChanges;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
const
|
|
89
|
+
const getIMLFilePath = async () => {
|
|
90
90
|
const filePath = path.join(process.cwd(), '.idea', `${path.parse(process.cwd()).base}.iml`);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
'
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
91
|
+
if (!await pathExists(pathToModulesConfig)) {
|
|
92
|
+
const fileFormattedPath = formatPathForPHPStormConfig(filePath);
|
|
93
|
+
const fileFormattedUrl = `file://${fileFormattedPath}`;
|
|
94
|
+
|
|
95
|
+
const modulesConfig = {
|
|
96
|
+
'?xml': {
|
|
97
|
+
'@_version': '1.0',
|
|
98
|
+
'@_encoding': 'UTF-8'
|
|
99
|
+
},
|
|
100
|
+
project: {
|
|
101
|
+
'@_version': '4',
|
|
102
|
+
component: {
|
|
103
|
+
'@_name': 'ProjectModuleManager',
|
|
104
|
+
modules: [
|
|
105
|
+
{
|
|
106
|
+
module: {
|
|
107
|
+
'@_fileurl': fileFormattedUrl,
|
|
108
|
+
'@_filepath': fileFormattedPath
|
|
109
|
+
}
|
|
108
110
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
]
|
|
112
|
+
}
|
|
111
113
|
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
+
};
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
await buildXmlFile(pathToModulesConfig, modulesConfig);
|
|
117
|
+
}
|
|
116
118
|
|
|
117
119
|
return filePath;
|
|
118
120
|
};
|
|
@@ -125,19 +127,21 @@ const setupExcludedFoldersConfig = () => ({
|
|
|
125
127
|
task: async (ctx, task) => {
|
|
126
128
|
if (await pathExists(pathToModulesConfig)) {
|
|
127
129
|
const projectFilePath = await getProjectConfigFilePath();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
if (await pathExists(projectFilePath)) {
|
|
131
|
+
const projectConfigData = await loadXmlFile(projectFilePath);
|
|
132
|
+
const excludedFoldersConfig = getExcludedFoldersConfig(projectConfigData);
|
|
133
|
+
const hasChanges = setupExcludedFolders(excludedFoldersConfig);
|
|
134
|
+
if (hasChanges) {
|
|
135
|
+
await buildXmlFile(projectFilePath, projectConfigData);
|
|
136
|
+
} else {
|
|
137
|
+
task.skip();
|
|
138
|
+
}
|
|
136
139
|
|
|
137
|
-
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
const projectFilePath = await
|
|
144
|
+
const projectFilePath = await getIMLFilePath();
|
|
141
145
|
const projectConfigData = {
|
|
142
146
|
'?xml': {
|
|
143
147
|
'@_version': '1.0',
|
|
@@ -11,6 +11,27 @@ const setupPhpCSFixerValidationInspection = require('./php-cs-fixer-validation-i
|
|
|
11
11
|
const setupPhpCSValidationInspection = require('./php-cs-validation-inspection-config');
|
|
12
12
|
const setupStyleLintInspection = require('./stylelint-inspection-config');
|
|
13
13
|
|
|
14
|
+
const inspectionProfileDefaults = {
|
|
15
|
+
component: {
|
|
16
|
+
[nameKey]: 'InspectionProjectProfileManager',
|
|
17
|
+
profile: {
|
|
18
|
+
'@_version': '1.0',
|
|
19
|
+
option: {
|
|
20
|
+
[nameKey]: 'myName',
|
|
21
|
+
[valueKey]: 'Project Default'
|
|
22
|
+
},
|
|
23
|
+
inspection_tool: [
|
|
24
|
+
{
|
|
25
|
+
[classKey]: 'PhpStanGlobal',
|
|
26
|
+
'@_enabled': 'true',
|
|
27
|
+
'@_level': 'ERROR',
|
|
28
|
+
'@_enabled_by_default': 'true'
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
14
35
|
/**
|
|
15
36
|
* @type {() => import('listr2').ListrTask<import('../../../../../typings/context').ListrContext>}
|
|
16
37
|
*/
|
|
@@ -25,6 +46,26 @@ const setupInspectionToolsConfig = () => ({
|
|
|
25
46
|
|
|
26
47
|
if (await pathExists(phpStorm.inspectionTools.path)) {
|
|
27
48
|
const inspectionToolsData = await loadXmlFile(phpStorm.inspectionTools.path);
|
|
49
|
+
|
|
50
|
+
if (!inspectionToolsData.component) {
|
|
51
|
+
inspectionToolsData.component = inspectionProfileDefaults.component;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!inspectionToolsData.component.profile) {
|
|
55
|
+
inspectionToolsData.component.profile = inspectionProfileDefaults.component.profile;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!inspectionToolsData.component.profile.inspection_tool) {
|
|
59
|
+
inspectionToolsData.component.profile.inspection_tool = [];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// eslint-disable-next-line max-len
|
|
63
|
+
if (!Array.isArray(inspectionToolsData.component.profile.inspection_tool) && Boolean(inspectionToolsData.component.profile.inspection_tool)) {
|
|
64
|
+
inspectionToolsData.component.profile.inspection_tool = [
|
|
65
|
+
inspectionToolsData.component.profile.inspection_tool
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
|
|
28
69
|
const inspectionTools = inspectionToolsData.component.profile.inspection_tool;
|
|
29
70
|
const hasChanges = await Promise.all([
|
|
30
71
|
setupPhpCSFixerValidationInspection(inspectionTools),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { loadXmlFile, buildXmlFile } = require('../../../../config/xml-parser');
|
|
2
2
|
const pathExists = require('../../../../util/path-exists');
|
|
3
|
+
const { setupXMLStructure } = require('../setup-xml-structure');
|
|
3
4
|
const setupMessDetector = require('./mess-detector-config');
|
|
4
5
|
const setupPHPCodeSniffer = require('./php-code-sniffer-config');
|
|
5
6
|
const setupPHPCSFixer = require('./php-cs-fixer-config');
|
|
@@ -23,7 +24,7 @@ const setupPhpConfig = () => ({
|
|
|
23
24
|
} = ctx;
|
|
24
25
|
|
|
25
26
|
if (await pathExists(phpStorm.php.path)) {
|
|
26
|
-
const phpConfigContent = await loadXmlFile(phpStorm.php.path);
|
|
27
|
+
const phpConfigContent = setupXMLStructure(await loadXmlFile(phpStorm.php.path));
|
|
27
28
|
const phpConfigs = phpConfigContent.project.component;
|
|
28
29
|
const hasChanges = await Promise.all([
|
|
29
30
|
setupMessDetector(phpConfigs),
|
|
@@ -41,16 +42,7 @@ const setupPhpConfig = () => ({
|
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
const phpConfigContent =
|
|
45
|
-
'?xml': {
|
|
46
|
-
'@_version': '1.0',
|
|
47
|
-
'@_encoding': 'UTF-8'
|
|
48
|
-
},
|
|
49
|
-
project: {
|
|
50
|
-
'@_version': '4',
|
|
51
|
-
component: []
|
|
52
|
-
}
|
|
53
|
-
};
|
|
45
|
+
const phpConfigContent = setupXMLStructure();
|
|
54
46
|
const phpConfigs = phpConfigContent.project.component;
|
|
55
47
|
|
|
56
48
|
await Promise.all([
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const xmlConfiguration = {
|
|
2
|
+
'?xml': {
|
|
3
|
+
'@_version': '1.0',
|
|
4
|
+
'@_encoding': 'UTF-8'
|
|
5
|
+
},
|
|
6
|
+
project: {
|
|
7
|
+
'@_version': '4',
|
|
8
|
+
component: []
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const setupXMLStructure = (data = {}) => {
|
|
13
|
+
if (!data) {
|
|
14
|
+
data = xmlConfiguration;
|
|
15
|
+
}
|
|
16
|
+
if (!('?xml' in data['?xml'])) {
|
|
17
|
+
data['?xml'] = xmlConfiguration['?xml'];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!('project' in data)) {
|
|
21
|
+
data.project = xmlConfiguration.project;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!('component' in data.project)) {
|
|
25
|
+
data.project.component = xmlConfiguration.project.component;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!Array.isArray(data.project.component) && Boolean(data.project.component)) {
|
|
29
|
+
data.project.component = [
|
|
30
|
+
data.project.component
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
setupXMLStructure
|
|
39
|
+
};
|
package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js
CHANGED
|
@@ -67,16 +67,6 @@ const setupComposerSettings = async (workspaceConfigs) => {
|
|
|
67
67
|
[pharPathKey]: composerPharFormattedPath
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
const composerSettingsMissingProperties = Object.entries(defaultComposerSettingsProperties)
|
|
72
|
-
.filter(([key]) => !(key in composerSettingsComponent));
|
|
73
|
-
|
|
74
|
-
if (composerSettingsMissingProperties.length > 0) {
|
|
75
|
-
hasChanges = true;
|
|
76
|
-
composerSettingsMissingProperties.forEach(([key, value]) => {
|
|
77
|
-
composerSettingsComponent[key] = value;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
70
|
} else {
|
|
81
71
|
hasChanges = true;
|
|
82
72
|
workspaceConfigs.push({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { loadXmlFile, buildXmlFile } = require('../../../../config/xml-parser');
|
|
2
2
|
const pathExists = require('../../../../util/path-exists');
|
|
3
|
+
const { setupXMLStructure } = require('../setup-xml-structure');
|
|
3
4
|
const setupComposerSettings = require('./composer-settings-config');
|
|
4
5
|
const setupFormatOnSave = require('./format-setting-config');
|
|
5
6
|
const setupPHPDebugGeneral = require('./php-debug-general-config');
|
|
@@ -20,7 +21,7 @@ const setupWorkspaceConfig = () => ({
|
|
|
20
21
|
} = ctx;
|
|
21
22
|
|
|
22
23
|
if (await pathExists(phpStorm.xdebug.path)) {
|
|
23
|
-
const workspaceConfiguration = await loadXmlFile(phpStorm.xdebug.path);
|
|
24
|
+
const workspaceConfiguration = setupXMLStructure(await loadXmlFile(phpStorm.xdebug.path));
|
|
24
25
|
const workspaceConfigs = workspaceConfiguration.project.component;
|
|
25
26
|
const hasChanges = await Promise.all([
|
|
26
27
|
setupPHPDebugGeneral(workspaceConfigs, phpStorm),
|
|
@@ -38,16 +39,7 @@ const setupWorkspaceConfig = () => ({
|
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const workspaceConfiguration =
|
|
42
|
-
'?xml': {
|
|
43
|
-
'@_version': '1.0',
|
|
44
|
-
'@_encoding': 'UTF-8'
|
|
45
|
-
},
|
|
46
|
-
project: {
|
|
47
|
-
'@_version': '4',
|
|
48
|
-
component: []
|
|
49
|
-
}
|
|
50
|
-
};
|
|
42
|
+
const workspaceConfiguration = setupXMLStructure();
|
|
51
43
|
const workspaceConfigs = workspaceConfiguration.project.component;
|
|
52
44
|
|
|
53
45
|
await Promise.all([
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
1
3
|
const semver = require('semver');
|
|
2
4
|
const UnknownError = require('../../../errors/unknown-error');
|
|
3
5
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
6
|
+
const envPhpToJson = require('../../../util/env-php-json');
|
|
7
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* @type {({ isDbEmpty }: { isDbEmpty: boolean }) => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
@@ -20,6 +24,21 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
20
24
|
ports
|
|
21
25
|
} = ctx;
|
|
22
26
|
const { mysql: { env } } = docker.getContainers(ports);
|
|
27
|
+
const envPhpData = await envPhpToJson(process.cwd(), {
|
|
28
|
+
magentoVersion: ctx.magentoVersion
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const envPhpHaveEncryptionKey = envPhpData && envPhpData.crypt && envPhpData.crypt.key && envPhpData.crypt.key;
|
|
32
|
+
|
|
33
|
+
let encryptionKeyOption = null;
|
|
34
|
+
|
|
35
|
+
if (ctx.encryptionKey) {
|
|
36
|
+
encryptionKeyOption = `--key='${ctx.encryptionKey}'`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (envPhpHaveEncryptionKey && !encryptionKeyOption) {
|
|
40
|
+
encryptionKeyOption = `--key='${envPhpData.crypt.key}'`;
|
|
41
|
+
}
|
|
23
42
|
|
|
24
43
|
let installed = false;
|
|
25
44
|
|
|
@@ -46,6 +65,7 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
46
65
|
--admin-user='${ magentoConfiguration.user }' \
|
|
47
66
|
--admin-password='${ magentoConfiguration.password }' \
|
|
48
67
|
${ !isMagento23 ? elasticsearchConfiguration : '' } \
|
|
68
|
+
${encryptionKeyOption || ''} \
|
|
49
69
|
--session-save=redis \
|
|
50
70
|
--session-save-redis-host='127.0.0.1' \
|
|
51
71
|
--session-save-redis-port='${ ports.redis }' \
|
|
@@ -85,6 +105,34 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
85
105
|
}
|
|
86
106
|
}
|
|
87
107
|
|
|
108
|
+
if (errors.length > 0) {
|
|
109
|
+
if (envPhpHaveEncryptionKey && errors.some(
|
|
110
|
+
(e) => e.message.includes('The default website isn\'t defined. Set the website and try again.')
|
|
111
|
+
)
|
|
112
|
+
) {
|
|
113
|
+
const confirmToWipeEnvPhp = await task.prompt({
|
|
114
|
+
type: 'Confirm',
|
|
115
|
+
message: `We detected that your encryption key in ${logger.style.file('app/etc/env.php')} file is not accepted by Magento installer.
|
|
116
|
+
To fix this issue we will need to ${logger.style.misc('DELETE')} ${logger.style.file('app/etc/env.php')} file. It will be recreated but existing encryption key but if you any custom configuration in it will be lost.
|
|
117
|
+
|
|
118
|
+
Without this you will not be able to install Magento at this moment.
|
|
119
|
+
|
|
120
|
+
Do you want to continue?`
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (confirmToWipeEnvPhp) {
|
|
124
|
+
try {
|
|
125
|
+
await fs.promises.unlink(path.join(process.cwd(), 'app', 'etc', 'env.php'));
|
|
126
|
+
} catch (e) {
|
|
127
|
+
throw new UnknownError(`Unexpected error occurred during deleting of app/etc/env.php file!\n\n${e}`);
|
|
128
|
+
}
|
|
129
|
+
ctx.encryptionKey = envPhpData.crypt.key;
|
|
130
|
+
|
|
131
|
+
return task.run(ctx);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
88
136
|
if (!installed) {
|
|
89
137
|
const errorMessages = errors.map((e) => e.message).join('\n\n');
|
|
90
138
|
throw new UnknownError(`Unable to install Magento!\n${errorMessages}`);
|
|
@@ -2,31 +2,57 @@ const mysql = require('mysql2/promise');
|
|
|
2
2
|
const UnknownError = require('../../errors/unknown-error');
|
|
3
3
|
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
4
4
|
const sleep = require('../../util/sleep');
|
|
5
|
+
const { createMagentoDatabase } = require('./create-magento-database');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* @
|
|
8
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
8
9
|
*/
|
|
9
|
-
const
|
|
10
|
-
title: '
|
|
11
|
-
|
|
10
|
+
const waitForMySQLInitialization = () => ({
|
|
11
|
+
title: 'Waiting for MySQL to initialize',
|
|
12
|
+
task: async (ctx, task) => {
|
|
13
|
+
const { mysql: { name } } = ctx.config.docker.getContainers();
|
|
14
|
+
let mysqlReadyForConnections = false;
|
|
15
|
+
while (!mysqlReadyForConnections) {
|
|
16
|
+
const mysqlOutput = await execAsyncSpawn(`docker logs ${name}`);
|
|
17
|
+
if (mysqlOutput.includes('ready for connections')) {
|
|
18
|
+
mysqlReadyForConnections = true;
|
|
19
|
+
break;
|
|
20
|
+
} else if (mysqlOutput.includes('Initializing database files')) {
|
|
21
|
+
task.output = `MySQL is initializing database files!
|
|
22
|
+
Please wait, this will take some time and do not restart the MySQL container until initialization is finished!`;
|
|
23
|
+
|
|
24
|
+
let mysqlFinishedInitialization = false;
|
|
25
|
+
while (!mysqlFinishedInitialization) {
|
|
26
|
+
const mysqlOutput = await execAsyncSpawn(`docker logs ${name}`);
|
|
27
|
+
if (mysqlOutput.includes('MySQL init process done.') && !mysqlFinishedInitialization) {
|
|
28
|
+
mysqlFinishedInitialization = true;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
await sleep(2000);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await sleep(2000);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
options: {
|
|
39
|
+
bottomBar: 10
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
45
|
+
*/
|
|
46
|
+
const gettingMySQLConnection = () => ({
|
|
47
|
+
title: 'Getting MySQL connection',
|
|
12
48
|
task: async (ctx, task) => {
|
|
13
49
|
const { config: { docker }, ports } = ctx;
|
|
14
|
-
const { mysql: { env
|
|
50
|
+
const { mysql: { env } } = docker.getContainers();
|
|
15
51
|
let tries = 0;
|
|
16
|
-
|
|
52
|
+
const maxTries = 20;
|
|
17
53
|
const errors = [];
|
|
18
54
|
while (tries < maxTries) {
|
|
19
55
|
tries++;
|
|
20
|
-
|
|
21
|
-
if (maxTries !== 120) {
|
|
22
|
-
const mysqlOutput = await execAsyncSpawn(`docker logs ${name}`);
|
|
23
|
-
if (mysqlOutput.includes('Initializing database files')) {
|
|
24
|
-
maxTries = 120;
|
|
25
|
-
task.output = `MySQL is initializing database files!
|
|
26
|
-
Please wait, this will take some time and do not restart the MySQL container until initialization is finished!`;
|
|
27
|
-
}
|
|
28
|
-
await sleep(2000);
|
|
29
|
-
}
|
|
30
56
|
try {
|
|
31
57
|
const connection = await mysql.createConnection({
|
|
32
58
|
host: '127.0.0.1',
|
|
@@ -49,7 +75,25 @@ Please wait, this will take some time and do not restart the MySQL container unt
|
|
|
49
75
|
}
|
|
50
76
|
|
|
51
77
|
task.title = 'MySQL server connected!';
|
|
52
|
-
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
83
|
+
*/
|
|
84
|
+
const connectToMySQL = () => ({
|
|
85
|
+
title: 'Connecting to MySQL server',
|
|
86
|
+
skip: (ctx) => ctx.skipSetup,
|
|
87
|
+
task: (ctx, task) => task.newListr([
|
|
88
|
+
waitForMySQLInitialization(),
|
|
89
|
+
createMagentoDatabase(),
|
|
90
|
+
gettingMySQLConnection()
|
|
91
|
+
], {
|
|
92
|
+
concurrent: false,
|
|
93
|
+
rendererOptions: {
|
|
94
|
+
collapse: true
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
53
97
|
options: {
|
|
54
98
|
bottomBar: 10
|
|
55
99
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Will create database 'magento' in MySQL if it does not exist for some reason
|
|
5
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
6
|
+
*/
|
|
7
|
+
const createMagentoDatabase = () => ({
|
|
8
|
+
title: 'Creating Magento database in MySQL',
|
|
9
|
+
task: async (ctx) => {
|
|
10
|
+
const { mysql } = ctx.config.docker.getContainers();
|
|
11
|
+
|
|
12
|
+
await execAsyncSpawn(`docker exec ${mysql.name} mysql -umagento -pmagento -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
createMagentoDatabase
|
|
18
|
+
};
|
|
@@ -17,7 +17,7 @@ const installPHPBrewDependencies = () => ({
|
|
|
17
17
|
if (process.platform === 'darwin') {
|
|
18
18
|
const installedDependencies = (await execAsyncSpawn(`${await getBrewCommand({ native: true })} list`)).split('\n');
|
|
19
19
|
|
|
20
|
-
const dependenciesToInstall = ['php', 'autoconf', 'pkg-config'].filter((dep) => !installedDependencies.includes(dep));
|
|
20
|
+
const dependenciesToInstall = ['php', 'autoconf', 'pkg-config', 'gd'].filter((dep) => !installedDependencies.includes(dep));
|
|
21
21
|
|
|
22
22
|
if (dependenciesToInstall.length === 0) {
|
|
23
23
|
task.skip();
|
package/lib/util/env-php-json.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const UnknownError = require('../errors/unknown-error');
|
|
3
|
+
const pathExists = require('./path-exists');
|
|
3
4
|
const runPhpCode = require('./run-php');
|
|
4
5
|
|
|
5
6
|
const envPhpToJson = async (projectPath = process.cwd(), { magentoVersion }) => {
|
|
6
|
-
const
|
|
7
|
+
const envPhpPath = path.join(projectPath, 'app', 'etc', 'env.php');
|
|
8
|
+
if (!await pathExists(envPhpPath)) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const { code, result } = await runPhpCode(`-r "echo json_encode(require '${envPhpPath}');"`, {
|
|
7
12
|
magentoVersion
|
|
8
13
|
});
|
|
9
14
|
|
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": "1.15.
|
|
6
|
+
"version": "1.15.3",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./typings/index.d.ts",
|
|
9
9
|
"license": "OSL-3.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"mysql",
|
|
54
54
|
"scandipwa"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b3a98d7f1ad13d8566f07cf3896a0ba0d64eb005"
|
|
57
57
|
}
|