@scandipwa/magento-scripts 1.15.3 → 1.15.4
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/index.js +1 -3
- package/lib/config/templates/dataSources.local.template.xml +1 -1
- package/lib/config/templates/dataSources.template.xml +1 -1
- package/lib/tasks/file-system/create-phpstorm-config/database-config.js +31 -34
- package/lib/tasks/file-system/create-phpstorm-config/eslint-config.js +39 -20
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/default-properties-config.js +3 -3
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/index.js +8 -12
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/inspection-tools-config.js +11 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +8 -16
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +20 -0
- package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +5 -4
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +1 -1
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +14 -16
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +6 -7
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +5 -6
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/run-manager-config.js +7 -7
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +20 -0
- package/lib/tasks/magento/setup-magento/upgrade-magento.js +1 -1
- package/lib/tasks/php/install-sodium.js +1 -1
- package/lib/util/exec-async-command.d.ts +0 -10
- package/lib/util/exec-async.d.ts +10 -0
- package/lib/util/open-browser.js +1 -1
- package/package.json +2 -2
- package/lib/config/phpstorm/debug-config.js +0 -46
package/lib/config/index.js
CHANGED
|
@@ -7,7 +7,6 @@ const {
|
|
|
7
7
|
const getPhpConfig = require('./php-config');
|
|
8
8
|
const getComposerConfig = require('./composer');
|
|
9
9
|
const { getMagentoConfig } = require('./magento-config');
|
|
10
|
-
const { getPhpStormConfig } = require('./phpstorm/debug-config');
|
|
11
10
|
const resolveConfigurationWithOverrides = require('../util/resolve-configuration-with-overrides');
|
|
12
11
|
const { getPrefix, folderName } = require('../util/prefix');
|
|
13
12
|
const UnknownError = require('../errors/unknown-error');
|
|
@@ -59,8 +58,7 @@ module.exports = {
|
|
|
59
58
|
baseConfig: newBaseConfig,
|
|
60
59
|
overridenConfiguration,
|
|
61
60
|
userConfiguration,
|
|
62
|
-
nonOverridenConfiguration: configurations[magentoVersion]
|
|
63
|
-
phpStorm: getPhpStormConfig(overridenConfiguration, newBaseConfig)
|
|
61
|
+
nonOverridenConfiguration: configurations[magentoVersion]
|
|
64
62
|
};
|
|
65
63
|
},
|
|
66
64
|
baseConfig,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="dataSourceStorageLocal" created-in="PS-212.5284.49">
|
|
4
|
-
<data-source name="<%~ it.
|
|
4
|
+
<data-source name="<%~ it.databaseConfiguration.dataSourceManagerName %>" uuid="a2eadb3c-6fc9-4d85-b5f4-d8114906ce2f">
|
|
5
5
|
<database-info product="" version="" jdbc-version="" driver-name="" driver-version="" dbms="MYSQL" exact-version="0" />
|
|
6
6
|
<secret-storage>master_key</secret-storage>
|
|
7
7
|
<user-name>magento</user-name>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
|
4
|
-
<data-source source="LOCAL" name="<%~ it.
|
|
4
|
+
<data-source source="LOCAL" name="<%~ it.databaseConfiguration.dataSourceManagerName %>" uuid="a2eadb3c-6fc9-4d85-b5f4-d8114906ce2f">
|
|
5
5
|
<driver-ref>mysql.8</driver-ref>
|
|
6
6
|
<synchronize>true</synchronize>
|
|
7
7
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { baseConfig } = require('../../../config');
|
|
2
4
|
const { loadXmlFile, buildXmlFile } = require('../../../config/xml-parser');
|
|
3
5
|
const UnknownError = require('../../../errors/unknown-error');
|
|
4
6
|
const pathExists = require('../../../util/path-exists');
|
|
5
7
|
const setConfigFile = require('../../../util/set-config');
|
|
6
8
|
|
|
9
|
+
const databaseConfiguration = {
|
|
10
|
+
driver: 'mysql',
|
|
11
|
+
dataSourceManagerName: 'mysql 8.0',
|
|
12
|
+
dataSourcesLocal: {
|
|
13
|
+
path: path.join(process.cwd(), '.idea', 'dataSources.local.xml'),
|
|
14
|
+
templatePath: path.join(baseConfig.templateDir, 'dataSources.local.template.xml')
|
|
15
|
+
},
|
|
16
|
+
dataSources: {
|
|
17
|
+
path: path.join(process.cwd(), '.idea', 'dataSources.xml'),
|
|
18
|
+
templatePath: path.join(baseConfig.templateDir, 'dataSources.template.xml')
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
7
22
|
/**
|
|
8
23
|
* Get link to data-source field, create fields if necessary
|
|
9
24
|
*
|
|
@@ -32,18 +47,9 @@ const getToDataSource = (data, defaultData) => {
|
|
|
32
47
|
const setupDataSourceLocalConfig = () => ({
|
|
33
48
|
title: 'Set up datasource local configuration',
|
|
34
49
|
task: async (ctx, task) => {
|
|
35
|
-
|
|
36
|
-
config: {
|
|
37
|
-
phpStorm,
|
|
38
|
-
phpStorm: {
|
|
39
|
-
database
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
} = ctx;
|
|
43
|
-
|
|
44
|
-
if (await pathExists(database.dataSourcesLocal.path)) {
|
|
50
|
+
if (await pathExists(databaseConfiguration.dataSourcesLocal.path)) {
|
|
45
51
|
let hasChanges = false;
|
|
46
|
-
const dataSourcesLocalData = await loadXmlFile(
|
|
52
|
+
const dataSourcesLocalData = await loadXmlFile(databaseConfiguration.dataSourcesLocal.path);
|
|
47
53
|
const dataSource = getToDataSource(
|
|
48
54
|
dataSourcesLocalData,
|
|
49
55
|
{
|
|
@@ -62,7 +68,7 @@ const setupDataSourceLocalConfig = () => ({
|
|
|
62
68
|
|
|
63
69
|
if (!dataSource['@_name']) {
|
|
64
70
|
hasChanges = true;
|
|
65
|
-
dataSource['@_name'] =
|
|
71
|
+
dataSource['@_name'] = databaseConfiguration.dataSourceManagerName;
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
if (!dataSource['@_uuid']) {
|
|
@@ -115,24 +121,24 @@ const setupDataSourceLocalConfig = () => ({
|
|
|
115
121
|
});
|
|
116
122
|
}
|
|
117
123
|
|
|
118
|
-
if (
|
|
124
|
+
if (dataSource && dataSource['schema-mapping'] === undefined) {
|
|
119
125
|
hasChanges = true;
|
|
120
126
|
dataSource['schema-mapping'] = '';
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
if (hasChanges) {
|
|
124
|
-
await buildXmlFile(
|
|
130
|
+
await buildXmlFile(databaseConfiguration.dataSourcesLocal.path, dataSourcesLocalData);
|
|
125
131
|
} else {
|
|
126
132
|
task.skip();
|
|
127
133
|
}
|
|
128
134
|
} else {
|
|
129
135
|
try {
|
|
130
136
|
await setConfigFile({
|
|
131
|
-
configPathname:
|
|
132
|
-
template:
|
|
137
|
+
configPathname: databaseConfiguration.dataSourcesLocal.path,
|
|
138
|
+
template: databaseConfiguration.dataSourcesLocal.templatePath,
|
|
133
139
|
overwrite: true,
|
|
134
140
|
templateArgs: {
|
|
135
|
-
|
|
141
|
+
databaseConfiguration
|
|
136
142
|
}
|
|
137
143
|
});
|
|
138
144
|
} catch (e) {
|
|
@@ -147,20 +153,11 @@ const setupDataSourceLocalConfig = () => ({
|
|
|
147
153
|
*/
|
|
148
154
|
const setupDataSourceConfig = () => ({
|
|
149
155
|
task: async (ctx, task) => {
|
|
150
|
-
const {
|
|
151
|
-
config: {
|
|
152
|
-
phpStorm,
|
|
153
|
-
phpStorm: {
|
|
154
|
-
database
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
ports
|
|
158
|
-
} = ctx;
|
|
159
|
-
const jdbcUrl = `jdbc:mysql://localhost:${ports.mysql}/magento`;
|
|
156
|
+
const jdbcUrl = `jdbc:mysql://localhost:${ctx.ports.mysql}/magento`;
|
|
160
157
|
|
|
161
|
-
if (await pathExists(
|
|
158
|
+
if (await pathExists(databaseConfiguration.dataSources.path)) {
|
|
162
159
|
let hasChanges = false;
|
|
163
|
-
const dataSourcesData = await loadXmlFile(
|
|
160
|
+
const dataSourcesData = await loadXmlFile(databaseConfiguration.dataSources.path);
|
|
164
161
|
const dataSource = getToDataSource(
|
|
165
162
|
dataSourcesData,
|
|
166
163
|
{
|
|
@@ -185,7 +182,7 @@ const setupDataSourceConfig = () => ({
|
|
|
185
182
|
}
|
|
186
183
|
|
|
187
184
|
const expectedDataSourceData = {
|
|
188
|
-
'@_name':
|
|
185
|
+
'@_name': databaseConfiguration.dataSourceManagerName,
|
|
189
186
|
'driver-ref': 'mysql.8',
|
|
190
187
|
synchronize: true,
|
|
191
188
|
'jdbc-driver': 'com.mysql.cj.jdbc.Driver',
|
|
@@ -213,18 +210,18 @@ const setupDataSourceConfig = () => ({
|
|
|
213
210
|
}
|
|
214
211
|
|
|
215
212
|
if (hasChanges) {
|
|
216
|
-
await buildXmlFile(
|
|
213
|
+
await buildXmlFile(databaseConfiguration.dataSources.path, dataSourcesData);
|
|
217
214
|
} else {
|
|
218
215
|
task.skip();
|
|
219
216
|
}
|
|
220
217
|
} else {
|
|
221
218
|
try {
|
|
222
219
|
await setConfigFile({
|
|
223
|
-
configPathname:
|
|
224
|
-
template:
|
|
220
|
+
configPathname: databaseConfiguration.dataSources.path,
|
|
221
|
+
template: databaseConfiguration.dataSources.templatePath,
|
|
225
222
|
overwrite: true,
|
|
226
223
|
templateArgs: {
|
|
227
|
-
|
|
224
|
+
databaseConfiguration,
|
|
228
225
|
jdbcUrl
|
|
229
226
|
}
|
|
230
227
|
});
|
|
@@ -17,10 +17,39 @@ const defaultESLintComponentConfiguration = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const setupESlintConfig = async (esLintConfigurationData) => {
|
|
21
|
+
let hasChanges = false;
|
|
22
|
+
const themes = await getCSAThemes();
|
|
23
|
+
|
|
24
|
+
if (themes.length > 0) {
|
|
25
|
+
const theme = themes[0];
|
|
26
|
+
if (await pathExists(theme.themePath)) {
|
|
27
|
+
if (esLintConfigurationData['work-dir-pattern'] === undefined) {
|
|
28
|
+
hasChanges = true;
|
|
29
|
+
esLintConfigurationData['work-dir-pattern'] = {
|
|
30
|
+
[valueKey]: formatPathForPHPStormConfig(theme.themePath)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const packageJsonPath = path.join(process.cwd(), theme.themePath, 'package.json');
|
|
34
|
+
if (await pathExists(packageJsonPath)) {
|
|
35
|
+
if (esLintConfigurationData['custom-configuration-file'] === undefined) {
|
|
36
|
+
hasChanges = true;
|
|
37
|
+
esLintConfigurationData['custom-configuration-file'] = {
|
|
38
|
+
'@_used': 'true',
|
|
39
|
+
'@_path': formatPathForPHPStormConfig(packageJsonPath)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return hasChanges;
|
|
47
|
+
};
|
|
48
|
+
|
|
20
49
|
/**
|
|
21
50
|
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
22
51
|
*/
|
|
23
|
-
const
|
|
52
|
+
const setupESLintConfigTask = () => ({
|
|
24
53
|
title: 'Set up ESLint configuration',
|
|
25
54
|
task: async (ctx, task) => {
|
|
26
55
|
if (await pathExists(pathToESLintConfig)) {
|
|
@@ -41,6 +70,11 @@ const setupESLintConfig = () => ({
|
|
|
41
70
|
esLintConfigurationData.project.component.push(defaultESLintComponentConfiguration);
|
|
42
71
|
}
|
|
43
72
|
|
|
73
|
+
const hasThemeEslintChanges = await setupESlintConfig(esLintConfigurationComponent);
|
|
74
|
+
if (hasThemeEslintChanges) {
|
|
75
|
+
hasChanges = hasThemeEslintChanges;
|
|
76
|
+
}
|
|
77
|
+
|
|
44
78
|
if (hasChanges) {
|
|
45
79
|
await buildXmlFile(pathToESLintConfig, esLintConfigurationData);
|
|
46
80
|
} else {
|
|
@@ -50,7 +84,7 @@ const setupESLintConfig = () => ({
|
|
|
50
84
|
return;
|
|
51
85
|
}
|
|
52
86
|
|
|
53
|
-
const
|
|
87
|
+
const esLintConfigurationData = {
|
|
54
88
|
'?xml': {
|
|
55
89
|
'@_version': '1.0',
|
|
56
90
|
'@_encoding': 'UTF-8'
|
|
@@ -60,26 +94,11 @@ const setupESLintConfig = () => ({
|
|
|
60
94
|
component: defaultESLintComponentConfiguration
|
|
61
95
|
}
|
|
62
96
|
};
|
|
63
|
-
const themes = await getCSAThemes();
|
|
64
97
|
|
|
65
|
-
|
|
66
|
-
const theme = themes[0];
|
|
67
|
-
if (await pathExists(theme.themePath)) {
|
|
68
|
-
styleLintConfigurationData.project.component['work-dir-pattern'] = {
|
|
69
|
-
[valueKey]: formatPathForPHPStormConfig(theme.themePath)
|
|
70
|
-
};
|
|
71
|
-
const packageJsonPath = path.join(process.cwd(), theme.themePath, 'package.json');
|
|
72
|
-
if (await pathExists(packageJsonPath)) {
|
|
73
|
-
styleLintConfigurationData.project.component['custom-configuration-file'] = {
|
|
74
|
-
'@_used': 'true',
|
|
75
|
-
'@_path': formatPathForPHPStormConfig(packageJsonPath)
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
98
|
+
await setupESlintConfig(esLintConfigurationData);
|
|
80
99
|
|
|
81
|
-
await buildXmlFile(pathToESLintConfig,
|
|
100
|
+
await buildXmlFile(pathToESLintConfig, esLintConfigurationData);
|
|
82
101
|
}
|
|
83
102
|
});
|
|
84
103
|
|
|
85
|
-
module.exports =
|
|
104
|
+
module.exports = setupESLintConfigTask;
|
|
@@ -16,17 +16,17 @@ const properties = {
|
|
|
16
16
|
*/
|
|
17
17
|
const setupDefaultProperties = (inspectionTool, defaultProperties = properties) => {
|
|
18
18
|
let hasChanges = false;
|
|
19
|
-
if (
|
|
19
|
+
if (inspectionTool['@_enabled'] === undefined) {
|
|
20
20
|
hasChanges = true;
|
|
21
21
|
inspectionTool['@_enabled'] = defaultProperties.enabled;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (
|
|
24
|
+
if (inspectionTool['@_enabled_by_default'] === undefined) {
|
|
25
25
|
hasChanges = true;
|
|
26
26
|
inspectionTool['@_enabled_by_default'] = defaultProperties.enabled_by_default;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (inspectionTool['@_level'] === undefined) {
|
|
30
30
|
hasChanges = true;
|
|
31
31
|
inspectionTool['@_level'] = defaultProperties.level;
|
|
32
32
|
}
|
|
@@ -6,6 +6,7 @@ const {
|
|
|
6
6
|
classKey
|
|
7
7
|
} = require('../keys');
|
|
8
8
|
const setupESLintInspection = require('./eslint-inspection-config');
|
|
9
|
+
const { getInspectionToolsConfig } = require('./inspection-tools-config');
|
|
9
10
|
const setupMessDetectorValidationInspection = require('./mess-detector-validation-inspection-config');
|
|
10
11
|
const setupPhpCSFixerValidationInspection = require('./php-cs-fixer-validation-inspection-config');
|
|
11
12
|
const setupPhpCSValidationInspection = require('./php-cs-validation-inspection-config');
|
|
@@ -35,17 +36,12 @@ const inspectionProfileDefaults = {
|
|
|
35
36
|
/**
|
|
36
37
|
* @type {() => import('listr2').ListrTask<import('../../../../../typings/context').ListrContext>}
|
|
37
38
|
*/
|
|
38
|
-
const
|
|
39
|
+
const setupInspectionToolsConfigTask = () => ({
|
|
39
40
|
title: 'Set up inspection tools configuration',
|
|
40
41
|
task: async (ctx, task) => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
} = ctx;
|
|
46
|
-
|
|
47
|
-
if (await pathExists(phpStorm.inspectionTools.path)) {
|
|
48
|
-
const inspectionToolsData = await loadXmlFile(phpStorm.inspectionTools.path);
|
|
42
|
+
const inspectionToolsConfig = getInspectionToolsConfig();
|
|
43
|
+
if (await pathExists(inspectionToolsConfig.path)) {
|
|
44
|
+
const inspectionToolsData = await loadXmlFile(inspectionToolsConfig.path);
|
|
49
45
|
|
|
50
46
|
if (!inspectionToolsData.component) {
|
|
51
47
|
inspectionToolsData.component = inspectionProfileDefaults.component;
|
|
@@ -75,7 +71,7 @@ const setupInspectionToolsConfig = () => ({
|
|
|
75
71
|
]);
|
|
76
72
|
|
|
77
73
|
if (hasChanges.includes(true)) {
|
|
78
|
-
await buildXmlFile(
|
|
74
|
+
await buildXmlFile(inspectionToolsConfig.path, inspectionToolsData);
|
|
79
75
|
} else {
|
|
80
76
|
task.skip();
|
|
81
77
|
}
|
|
@@ -114,8 +110,8 @@ const setupInspectionToolsConfig = () => ({
|
|
|
114
110
|
setupESLintInspection(inspectionTools)
|
|
115
111
|
]);
|
|
116
112
|
|
|
117
|
-
await buildXmlFile(
|
|
113
|
+
await buildXmlFile(inspectionToolsConfig.path, inspectionToolsData);
|
|
118
114
|
}
|
|
119
115
|
});
|
|
120
116
|
|
|
121
|
-
module.exports =
|
|
117
|
+
module.exports = setupInspectionToolsConfigTask;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { baseConfig } = require('../../../../config');
|
|
3
|
+
|
|
4
|
+
const getInspectionToolsConfig = () => ({
|
|
5
|
+
path: path.join(process.cwd(), '.idea', 'inspectionProfiles', 'Project_Default.xml'),
|
|
6
|
+
templatePath: path.join(baseConfig.templateDir, 'Project_Default.template.xml')
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
getInspectionToolsConfig
|
|
11
|
+
};
|
|
@@ -3,6 +3,7 @@ const pathExists = require('../../../../util/path-exists');
|
|
|
3
3
|
const { setupXMLStructure } = require('../setup-xml-structure');
|
|
4
4
|
const setupMessDetector = require('./mess-detector-config');
|
|
5
5
|
const setupPHPCodeSniffer = require('./php-code-sniffer-config');
|
|
6
|
+
const { getPhpConfig } = require('./php-config');
|
|
6
7
|
const setupPHPCSFixer = require('./php-cs-fixer-config');
|
|
7
8
|
const setupPHPProjectSharedConfiguration = require('./php-project-shared-configuration-config');
|
|
8
9
|
|
|
@@ -12,29 +13,20 @@ const setupPHPProjectSharedConfiguration = require('./php-project-shared-configu
|
|
|
12
13
|
const setupPhpConfig = () => ({
|
|
13
14
|
title: 'Set up PHP configuration',
|
|
14
15
|
task: async (ctx, task) => {
|
|
15
|
-
const
|
|
16
|
-
config: {
|
|
17
|
-
phpStorm,
|
|
18
|
-
phpStorm: {
|
|
19
|
-
php: {
|
|
20
|
-
phpLanguageLevel
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} = ctx;
|
|
16
|
+
const phpConfig = getPhpConfig(ctx.config.overridenConfiguration);
|
|
25
17
|
|
|
26
|
-
if (await pathExists(
|
|
27
|
-
const phpConfigContent = setupXMLStructure(await loadXmlFile(
|
|
18
|
+
if (await pathExists(phpConfig.path)) {
|
|
19
|
+
const phpConfigContent = setupXMLStructure(await loadXmlFile(phpConfig.path));
|
|
28
20
|
const phpConfigs = phpConfigContent.project.component;
|
|
29
21
|
const hasChanges = await Promise.all([
|
|
30
22
|
setupMessDetector(phpConfigs),
|
|
31
23
|
setupPHPCodeSniffer(phpConfigs),
|
|
32
24
|
setupPHPCSFixer(phpConfigs),
|
|
33
|
-
setupPHPProjectSharedConfiguration(phpConfigs, phpLanguageLevel)
|
|
25
|
+
setupPHPProjectSharedConfiguration(phpConfigs, phpConfig.phpLanguageLevel)
|
|
34
26
|
]);
|
|
35
27
|
|
|
36
28
|
if (hasChanges.includes(true)) {
|
|
37
|
-
await buildXmlFile(
|
|
29
|
+
await buildXmlFile(phpConfig.path, phpConfigContent);
|
|
38
30
|
} else {
|
|
39
31
|
task.skip();
|
|
40
32
|
}
|
|
@@ -49,10 +41,10 @@ const setupPhpConfig = () => ({
|
|
|
49
41
|
setupMessDetector(phpConfigs),
|
|
50
42
|
setupPHPCodeSniffer(phpConfigs),
|
|
51
43
|
setupPHPCSFixer(phpConfigs),
|
|
52
|
-
setupPHPProjectSharedConfiguration(phpConfigs, phpLanguageLevel)
|
|
44
|
+
setupPHPProjectSharedConfiguration(phpConfigs, phpConfig.phpLanguageLevel)
|
|
53
45
|
]);
|
|
54
46
|
|
|
55
|
-
await buildXmlFile(
|
|
47
|
+
await buildXmlFile(phpConfig.path, phpConfigContent);
|
|
56
48
|
}
|
|
57
49
|
});
|
|
58
50
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { baseConfig } = require('../../../../config');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {import('../../../../../typings/index').CMAConfiguration} app
|
|
6
|
+
*/
|
|
7
|
+
const getPhpConfig = (app) => {
|
|
8
|
+
const [majorPHPVersion, minorPHPVersion] = app.configuration.php.version.split('.');
|
|
9
|
+
const phpLanguageLevel = `${ majorPHPVersion }.${ minorPHPVersion }`;
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
phpLanguageLevel,
|
|
13
|
+
path: path.join(process.cwd(), '.idea', 'php.xml'),
|
|
14
|
+
templatePath: path.join(baseConfig.templateDir, 'php.template.xml')
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
getPhpConfig
|
|
20
|
+
};
|
|
@@ -9,19 +9,20 @@ const xmlConfiguration = {
|
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const setupXMLStructure = (data
|
|
12
|
+
const setupXMLStructure = (data) => {
|
|
13
13
|
if (!data) {
|
|
14
14
|
data = xmlConfiguration;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
if (data['?xml'] === undefined) {
|
|
17
18
|
data['?xml'] = xmlConfiguration['?xml'];
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
if (
|
|
21
|
+
if (data.project === undefined) {
|
|
21
22
|
data.project = xmlConfiguration.project;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
if (
|
|
25
|
+
if (data.project.component === undefined) {
|
|
25
26
|
data.project.component = xmlConfiguration.project.component;
|
|
26
27
|
}
|
|
27
28
|
|
package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js
CHANGED
|
@@ -48,7 +48,7 @@ const setupComposerSettings = async (workspaceConfigs) => {
|
|
|
48
48
|
|
|
49
49
|
if (composerSettingsComponent) {
|
|
50
50
|
if (
|
|
51
|
-
|
|
51
|
+
composerSettingsComponent.pharConfigPath === undefined
|
|
52
52
|
&& isComposerJsonExists
|
|
53
53
|
) {
|
|
54
54
|
hasChanges = true;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { loadXmlFile, buildXmlFile } = require('../../../../config/xml-parser');
|
|
2
2
|
const pathExists = require('../../../../util/path-exists');
|
|
3
|
+
const { getPhpConfig } = require('../php-config/php-config');
|
|
3
4
|
const { setupXMLStructure } = require('../setup-xml-structure');
|
|
4
5
|
const setupComposerSettings = require('./composer-settings-config');
|
|
5
6
|
const setupFormatOnSave = require('./format-setting-config');
|
|
@@ -7,6 +8,7 @@ const setupPHPDebugGeneral = require('./php-debug-general-config');
|
|
|
7
8
|
const setupPHPServers = require('./php-server-config');
|
|
8
9
|
const setupPropertiesComponent = require('./properties-component-config');
|
|
9
10
|
const setupRunManager = require('./run-manager-config');
|
|
11
|
+
const { getWorkspaceConfig } = require('./workspace-config');
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* @type {() => import('listr2').ListrTask<import('../../../../../typings/context').ListrContext>}
|
|
@@ -14,24 +16,20 @@ const setupRunManager = require('./run-manager-config');
|
|
|
14
16
|
const setupWorkspaceConfig = () => ({
|
|
15
17
|
title: 'Set up Workspace configuration',
|
|
16
18
|
task: async (ctx, task) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = ctx;
|
|
22
|
-
|
|
23
|
-
if (await pathExists(phpStorm.xdebug.path)) {
|
|
24
|
-
const workspaceConfiguration = setupXMLStructure(await loadXmlFile(phpStorm.xdebug.path));
|
|
19
|
+
const workspaceConfig = getWorkspaceConfig(ctx.config.overridenConfiguration);
|
|
20
|
+
const phpConfig = getPhpConfig(ctx.config.overridenConfiguration);
|
|
21
|
+
if (await pathExists(workspaceConfig.path)) {
|
|
22
|
+
const workspaceConfiguration = setupXMLStructure(await loadXmlFile(workspaceConfig.path));
|
|
25
23
|
const workspaceConfigs = workspaceConfiguration.project.component;
|
|
26
24
|
const hasChanges = await Promise.all([
|
|
27
|
-
setupPHPDebugGeneral(workspaceConfigs,
|
|
28
|
-
setupPHPServers(workspaceConfigs,
|
|
29
|
-
setupRunManager(workspaceConfigs,
|
|
25
|
+
setupPHPDebugGeneral(workspaceConfigs, workspaceConfig),
|
|
26
|
+
setupPHPServers(workspaceConfigs, workspaceConfig),
|
|
27
|
+
setupRunManager(workspaceConfigs, workspaceConfig),
|
|
30
28
|
setupPropertiesComponent(workspaceConfigs)
|
|
31
29
|
]);
|
|
32
30
|
|
|
33
31
|
if (hasChanges.includes(true)) {
|
|
34
|
-
await buildXmlFile(
|
|
32
|
+
await buildXmlFile(phpConfig.path, workspaceConfiguration);
|
|
35
33
|
} else {
|
|
36
34
|
task.skip();
|
|
37
35
|
}
|
|
@@ -43,15 +41,15 @@ const setupWorkspaceConfig = () => ({
|
|
|
43
41
|
const workspaceConfigs = workspaceConfiguration.project.component;
|
|
44
42
|
|
|
45
43
|
await Promise.all([
|
|
46
|
-
setupPHPDebugGeneral(workspaceConfigs,
|
|
47
|
-
setupPHPServers(workspaceConfigs,
|
|
48
|
-
setupRunManager(workspaceConfigs,
|
|
44
|
+
setupPHPDebugGeneral(workspaceConfigs, workspaceConfig),
|
|
45
|
+
setupPHPServers(workspaceConfigs, workspaceConfig),
|
|
46
|
+
setupRunManager(workspaceConfigs, workspaceConfig),
|
|
49
47
|
setupPropertiesComponent(workspaceConfigs),
|
|
50
48
|
setupComposerSettings(workspaceConfigs),
|
|
51
49
|
setupFormatOnSave(workspaceConfigs)
|
|
52
50
|
]);
|
|
53
51
|
|
|
54
|
-
await buildXmlFile(
|
|
52
|
+
await buildXmlFile(workspaceConfig.path, workspaceConfiguration);
|
|
55
53
|
}
|
|
56
54
|
});
|
|
57
55
|
|
package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js
CHANGED
|
@@ -10,11 +10,10 @@ const ignoreConnectionsThroughUnregisteredServersKey = '@_ignore_connections_thr
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @param {Array} workspaceConfigs
|
|
13
|
-
* @param {import('
|
|
13
|
+
* @param {ReturnType<typeof import('./workspace-config').getWorkspaceConfig>} workspaceConfig
|
|
14
14
|
* @returns {Promise<Boolean>}
|
|
15
15
|
*/
|
|
16
|
-
const setupPHPDebugGeneral = async (workspaceConfigs,
|
|
17
|
-
const { xdebug } = phpStormConfiguration;
|
|
16
|
+
const setupPHPDebugGeneral = async (workspaceConfigs, workspaceConfig) => {
|
|
18
17
|
let hasChanges = false;
|
|
19
18
|
const phpDebugGeneralComponent = workspaceConfigs.find(
|
|
20
19
|
(workspaceConfig) => workspaceConfig[nameKey] === PHP_DEBUG_GENERAL_COMPONENT_NAME
|
|
@@ -31,10 +30,10 @@ const setupPHPDebugGeneral = async (workspaceConfigs, phpStormConfiguration) =>
|
|
|
31
30
|
|
|
32
31
|
if (!(xdebugDebugPortKey in phpDebugGeneralComponent)) {
|
|
33
32
|
hasChanges = true;
|
|
34
|
-
phpDebugGeneralComponent[xdebugDebugPortKey] =
|
|
33
|
+
phpDebugGeneralComponent[xdebugDebugPortKey] = workspaceConfig.v3Port;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
const missingXDebugPorts = [
|
|
36
|
+
const missingXDebugPorts = [workspaceConfig.v3Port, workspaceConfig.v2Port].filter(
|
|
38
37
|
(port) => !phpDebugGeneralComponent.xdebug_debug_ports.some((xPort) => xPort[portKey] === port)
|
|
39
38
|
);
|
|
40
39
|
|
|
@@ -50,9 +49,9 @@ const setupPHPDebugGeneral = async (workspaceConfigs, phpStormConfiguration) =>
|
|
|
50
49
|
hasChanges = true;
|
|
51
50
|
workspaceConfigs.push({
|
|
52
51
|
[nameKey]: PHP_DEBUG_GENERAL_COMPONENT_NAME,
|
|
53
|
-
[xdebugDebugPortKey]:
|
|
52
|
+
[xdebugDebugPortKey]: workspaceConfig.v3Port,
|
|
54
53
|
[ignoreConnectionsThroughUnregisteredServersKey]: 'true',
|
|
55
|
-
xdebug_debug_ports: [
|
|
54
|
+
xdebug_debug_ports: [workspaceConfig.v3Port, workspaceConfig.v2Port].map((port) => ({
|
|
56
55
|
[portKey]: port
|
|
57
56
|
}))
|
|
58
57
|
});
|
|
@@ -6,20 +6,19 @@ const hostKey = '@_host';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @param {Array} workspaceConfigs
|
|
9
|
-
* @param {import('
|
|
9
|
+
* @param {ReturnType<typeof import('./workspace-config').getWorkspaceConfig>} workspaceConfig
|
|
10
10
|
* @returns {Promise<Boolean>}
|
|
11
11
|
*/
|
|
12
|
-
const setupPHPServers = async (workspaceConfigs,
|
|
13
|
-
const { xdebug } = phpStormConfiguration;
|
|
12
|
+
const setupPHPServers = async (workspaceConfigs, workspaceConfig) => {
|
|
14
13
|
let hasChanges = false;
|
|
15
14
|
const phpServersComponent = workspaceConfigs.find(
|
|
16
15
|
(workspaceConfig) => workspaceConfig[nameKey] === PHP_SERVERS_COMPONENT_NAME
|
|
17
16
|
);
|
|
18
17
|
|
|
19
18
|
const defaultServerConfig = {
|
|
20
|
-
[hostKey]:
|
|
19
|
+
[hostKey]: workspaceConfig.debugServerAddress,
|
|
21
20
|
id: '7e16e907-9ce3-4559-9d26-a30a5650d11f',
|
|
22
|
-
[nameKey]:
|
|
21
|
+
[nameKey]: workspaceConfig.serverName
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
if (phpServersComponent) {
|
|
@@ -31,7 +30,7 @@ const setupPHPServers = async (workspaceConfigs, phpStormConfiguration) => {
|
|
|
31
30
|
phpServersComponent.servers = [];
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const serverConfiguration = phpServersComponent.servers.find((server) => server.server[nameKey] ===
|
|
33
|
+
const serverConfiguration = phpServersComponent.servers.find((server) => server.server[nameKey] === workspaceConfig.serverName);
|
|
35
34
|
|
|
36
35
|
if (!serverConfiguration) {
|
|
37
36
|
hasChanges = true;
|
|
@@ -9,23 +9,22 @@ const sessionIdKey = '@_session_id';
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {Array} workspaceConfigs
|
|
12
|
-
* @param {import('
|
|
12
|
+
* @param {ReturnType<typeof import('./workspace-config').getWorkspaceConfig>} workspaceConfig
|
|
13
13
|
* @returns {Promise<Boolean>}
|
|
14
14
|
*/
|
|
15
|
-
const setupRunManager = async (workspaceConfigs,
|
|
16
|
-
const { xdebug } = phpStormConfiguration;
|
|
15
|
+
const setupRunManager = async (workspaceConfigs, workspaceConfig) => {
|
|
17
16
|
let hasChanges = false;
|
|
18
17
|
const runManagerComponent = workspaceConfigs.find(
|
|
19
18
|
(workspaceConfig) => workspaceConfig[nameKey] === RUN_MANAGER_COMPONENT_NAME
|
|
20
19
|
);
|
|
21
20
|
|
|
22
21
|
const defaultRunManagerConfiguration = {
|
|
23
|
-
[nameKey]:
|
|
22
|
+
[nameKey]: workspaceConfig.runManagerName,
|
|
24
23
|
'@_type': PHP_REMOTE_DEBUG_RUN_CONFIGURATION_TYPE,
|
|
25
24
|
'@_factoryName': 'PHP Remote Debug',
|
|
26
25
|
'@_filter_connections': 'FILTER',
|
|
27
|
-
[serverNameKey]:
|
|
28
|
-
[sessionIdKey]:
|
|
26
|
+
[serverNameKey]: workspaceConfig.serverName,
|
|
27
|
+
[sessionIdKey]: workspaceConfig.sessionId,
|
|
29
28
|
method: {
|
|
30
29
|
'@_v': '2'
|
|
31
30
|
}
|
|
@@ -41,7 +40,8 @@ const setupRunManager = async (workspaceConfigs, phpStormConfiguration) => {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
const phpRemoteDebugRunConfiguration = runManagerComponent.configuration.find(
|
|
44
|
-
|
|
43
|
+
// eslint-disable-next-line max-len
|
|
44
|
+
(configuration) => configuration['@_type'] === PHP_REMOTE_DEBUG_RUN_CONFIGURATION_TYPE && configuration[nameKey] === workspaceConfig.runManagerName
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
if (!phpRemoteDebugRunConfiguration) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { baseConfig } = require('../../../../config');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {import('../../../../../typings/index').CMAConfiguration} app
|
|
6
|
+
*/
|
|
7
|
+
const getWorkspaceConfig = (app) => ({
|
|
8
|
+
v2Port: '9111',
|
|
9
|
+
v3Port: '9003',
|
|
10
|
+
debugServerAddress: `http://${ app.host }`,
|
|
11
|
+
serverName: 'create-magento-app',
|
|
12
|
+
runManagerName: 'create-magento-app',
|
|
13
|
+
sessionId: 'PHPSTORM',
|
|
14
|
+
path: path.join(process.cwd(), '.idea', 'workspace.xml'),
|
|
15
|
+
templatePath: path.join(baseConfig.templateDir, 'workspace.template.xml')
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
getWorkspaceConfig
|
|
20
|
+
};
|
|
@@ -33,7 +33,7 @@ const installSodiumExtension = () => ({
|
|
|
33
33
|
const extractedArchivePath = path.join(tempDir, 'libsodium-stable');
|
|
34
34
|
const enabledExtensions = await getEnabledExtensions(ctx.config);
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (enabledExtensions.sodium !== undefined) {
|
|
37
37
|
cmaGlobalConfig.set(HAS_LIBSODIUM_BEEN_INSTALLED, true);
|
|
38
38
|
task.skip();
|
|
39
39
|
return;
|
|
@@ -25,16 +25,6 @@ export function execAsyncSpawn (
|
|
|
25
25
|
options?: ExecAsyncSpawnOptions<true>
|
|
26
26
|
): Promise<{ code: number, result: string }>;
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Execute bash command
|
|
30
|
-
* @param command Bash command
|
|
31
|
-
* @param options Child process exec options ([docs](https://nodejs.org/dist/latest-v14.x/docs/api/child_process.html#child_process_child_process_exec_command_options_callback))
|
|
32
|
-
*/
|
|
33
|
-
export function execAsync(
|
|
34
|
-
command: string,
|
|
35
|
-
options?: { encoding: BufferEncoding } & ExecOptions
|
|
36
|
-
): Promise<string>
|
|
37
|
-
|
|
38
28
|
export function execCommandTask(
|
|
39
29
|
command: string,
|
|
40
30
|
options?: Omit<ExecAsyncSpawnOptions<false>, 'callback'>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/**
|
|
3
|
+
* Execute bash command
|
|
4
|
+
* @param command Bash command
|
|
5
|
+
* @param options Child process exec options ([docs](https://nodejs.org/dist/latest-v14.x/docs/api/child_process.html#child_process_child_process_exec_command_options_callback))
|
|
6
|
+
*/
|
|
7
|
+
export function execAsync(
|
|
8
|
+
command: string,
|
|
9
|
+
options?: { encoding: BufferEncoding } & ExecOptions
|
|
10
|
+
): Promise<string>
|
package/lib/util/open-browser.js
CHANGED
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.4",
|
|
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": "dca735e563dd90fd22fbb8bf706c122f2002bda8"
|
|
57
57
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const getPhpStormConfig = (app, config) => {
|
|
4
|
-
const [majorPHPVersion, minorPHPVersion] = app.configuration.php.version.split('.');
|
|
5
|
-
const phpLanguageLevel = `${ majorPHPVersion }.${ minorPHPVersion }`;
|
|
6
|
-
const { templateDir } = config;
|
|
7
|
-
const phpStormConfiguration = {
|
|
8
|
-
xdebug: {
|
|
9
|
-
v2Port: '9111',
|
|
10
|
-
v3Port: '9003',
|
|
11
|
-
debugServerAddress: `http://${ app.host }`,
|
|
12
|
-
serverName: 'create-magento-app',
|
|
13
|
-
runManagerName: 'create-magento-app',
|
|
14
|
-
sessionId: 'PHPSTORM',
|
|
15
|
-
path: path.join(process.cwd(), '.idea', 'workspace.xml'),
|
|
16
|
-
templatePath: path.join(templateDir, 'workspace.template.xml')
|
|
17
|
-
},
|
|
18
|
-
php: {
|
|
19
|
-
phpLanguageLevel,
|
|
20
|
-
path: path.join(process.cwd(), '.idea', 'php.xml'),
|
|
21
|
-
templatePath: path.join(templateDir, 'php.template.xml')
|
|
22
|
-
},
|
|
23
|
-
database: {
|
|
24
|
-
driver: 'mysql',
|
|
25
|
-
dataSourceManagerName: 'mysql 8.0',
|
|
26
|
-
dataSourcesLocal: {
|
|
27
|
-
path: path.join(process.cwd(), '.idea', 'dataSources.local.xml'),
|
|
28
|
-
templatePath: path.join(templateDir, 'dataSources.local.template.xml')
|
|
29
|
-
},
|
|
30
|
-
dataSources: {
|
|
31
|
-
path: path.join(process.cwd(), '.idea', 'dataSources.xml'),
|
|
32
|
-
templatePath: path.join(templateDir, 'dataSources.template.xml')
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
inspectionTools: {
|
|
36
|
-
path: path.join(process.cwd(), '.idea', 'inspectionProfiles', 'Project_Default.xml'),
|
|
37
|
-
templatePath: path.join(templateDir, 'Project_Default.template.xml')
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return phpStormConfiguration;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
module.exports = {
|
|
45
|
-
getPhpStormConfig
|
|
46
|
-
};
|