@scandipwa/magento-scripts 1.14.0 → 1.14.1-alpha.2

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.
Files changed (44) hide show
  1. package/lib/config/templates/php-fpm.template.conf +1 -0
  2. package/lib/config/versions/magento-2.3.7-p2.js +47 -0
  3. package/lib/config/versions/magento-2.3.7-p3.js +47 -0
  4. package/lib/config/versions/magento-2.4.3-p2.js +51 -0
  5. package/lib/config/versions/magento-2.4.4.js +51 -0
  6. package/lib/config/xml-parser.js +61 -0
  7. package/lib/tasks/file-system/create-phpstorm-config/database-config.js +248 -0
  8. package/lib/tasks/file-system/create-phpstorm-config/eslint-config.js +85 -0
  9. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +154 -0
  10. package/lib/tasks/file-system/create-phpstorm-config/index.js +27 -0
  11. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/coding-standard-config.js +29 -0
  12. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/config.js +54 -0
  13. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/custom-ruleset-path-config.js +31 -0
  14. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/default-properties-config.js +42 -0
  15. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/eslint-inspection-config.js +37 -0
  16. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/index.js +80 -0
  17. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/magento-coding-standard-config.js +29 -0
  18. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/mess-detector-validation-inspection-config.js +145 -0
  19. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/paths.js +20 -0
  20. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-fixer-validation-inspection-config.js +60 -0
  21. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-validation-inspection-config.js +119 -0
  22. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/stylelint-inspection-config.js +37 -0
  23. package/lib/tasks/file-system/create-phpstorm-config/keys.js +14 -0
  24. package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +67 -0
  25. package/lib/tasks/file-system/create-phpstorm-config/php-config/mess-detector-config.js +57 -0
  26. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-code-sniffer-config.js +76 -0
  27. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-cs-fixer-config.js +63 -0
  28. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-project-shared-configuration-config.js +69 -0
  29. package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +77 -0
  30. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +98 -0
  31. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/format-setting-config.js +57 -0
  32. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +66 -0
  33. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +64 -0
  34. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +60 -0
  35. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/properties-component-config.js +51 -0
  36. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/run-manager-config.js +74 -0
  37. package/lib/tasks/file-system/create-phpstorm-config/xml-utils.js +5 -0
  38. package/lib/tasks/file-system/index.js +1 -1
  39. package/lib/tasks/start.js +6 -2
  40. package/lib/util/instance-metadata.js +7 -1
  41. package/package.json +13 -2
  42. package/typings/context.d.ts +2 -0
  43. package/typings/phpstorm.d.ts +33 -0
  44. package/lib/tasks/file-system/create-php-storm-config.js +0 -82
@@ -0,0 +1,98 @@
1
+ const path = require('path');
2
+ const { baseConfig } = require('../../../../config');
3
+ const pathExists = require('../../../../util/path-exists');
4
+ const { nameKey } = require('../keys');
5
+ const { formatPathForPHPStormConfig } = require('../xml-utils');
6
+
7
+ const COMPOSER_SETTINGS_COMPONENT_NAME = 'ComposerSettings';
8
+
9
+ const pharPathKey = '@_pharPath';
10
+ const doNotAskKey = '@_doNotAsk';
11
+ const synchronizationStateKey = '@_synchronizationState';
12
+
13
+ const composerJsonPath = path.join(process.cwd(), 'composer.json');
14
+ const composerJsonFormattedPath = formatPathForPHPStormConfig(composerJsonPath);
15
+ const composerPharPath = path.join(baseConfig.cacheDir, 'composer', 'composer.phar');
16
+ const composerPharFormattedPath = formatPathForPHPStormConfig(composerPharPath);
17
+
18
+ const defaultComposerSettingsProperties = {
19
+ [doNotAskKey]: 'true',
20
+ [synchronizationStateKey]: 'SYNCHRONIZE'
21
+ };
22
+
23
+ // TODO Ideally, we want to setup interpreter for compose.phar
24
+
25
+ // It should look like this:
26
+ // <component name="ComposerSettings" synchronizationState="DONT_SYNCHRONIZE">
27
+ // <pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath>
28
+ // <execution>
29
+ // <phar
30
+ // pharPath="$PROJECT_DIR$/node_modules/.create-magento-app-cache/composer/composer.phar"
31
+ // interpreterId="f19b09e2-16e7-491f-9056-3299df58e578"
32
+ // />
33
+ // </execution>
34
+ // </component>
35
+
36
+ /**
37
+ * @param {Array} workspaceConfigs
38
+ * @returns {Promise<Boolean>}
39
+ */
40
+ const setupComposerSettings = async (workspaceConfigs) => {
41
+ let hasChanges = false;
42
+ const composerSettingsComponent = workspaceConfigs.find(
43
+ (workspaceConfig) => workspaceConfig[nameKey] === COMPOSER_SETTINGS_COMPONENT_NAME
44
+ );
45
+
46
+ const isComposerJsonExists = await pathExists(composerJsonPath);
47
+ const isComposerPharExists = await pathExists(composerPharPath);
48
+
49
+ if (composerSettingsComponent) {
50
+ if (
51
+ 'pharConfigPath' in composerSettingsComponent
52
+ && isComposerJsonExists
53
+ && composerSettingsComponent.pharConfigPath !== composerJsonFormattedPath
54
+ ) {
55
+ hasChanges = true;
56
+ composerSettingsComponent.pharConfigPath = composerJsonFormattedPath;
57
+ }
58
+
59
+ const pharConfig = composerSettingsComponent.execution && composerSettingsComponent.execution.phar;
60
+
61
+ if (pharConfig && isComposerPharExists && pharConfig[pharPathKey] !== composerPharFormattedPath) {
62
+ hasChanges = true;
63
+ pharConfig[pharPathKey] = composerPharFormattedPath;
64
+ } else if (!pharConfig && isComposerPharExists) {
65
+ hasChanges = true;
66
+ composerSettingsComponent.execution = composerSettingsComponent.execution || {};
67
+ composerSettingsComponent.execution.phar = {
68
+ [pharPathKey]: composerPharFormattedPath
69
+ };
70
+ }
71
+
72
+ const composerSettingsMissingProperties = Object.entries(defaultComposerSettingsProperties)
73
+ .filter(([key]) => !(key in composerSettingsComponent));
74
+
75
+ if (composerSettingsMissingProperties.length > 0) {
76
+ hasChanges = true;
77
+ composerSettingsMissingProperties.forEach(([key, value]) => {
78
+ composerSettingsComponent[key] = value;
79
+ });
80
+ }
81
+ } else {
82
+ hasChanges = true;
83
+ workspaceConfigs.push({
84
+ [nameKey]: COMPOSER_SETTINGS_COMPONENT_NAME,
85
+ ...defaultComposerSettingsProperties,
86
+ pharConfigPath: composerJsonFormattedPath,
87
+ execution: {
88
+ phar: {
89
+ [pharPathKey]: composerPharFormattedPath
90
+ }
91
+ }
92
+ });
93
+ }
94
+
95
+ return hasChanges;
96
+ };
97
+
98
+ module.exports = setupComposerSettings;
@@ -0,0 +1,57 @@
1
+ const {
2
+ nameKey,
3
+ valueKey
4
+ } = require('../keys');
5
+
6
+ const FORMAT_ON_SAVE_OPTIONS_COMPONENT_NAME = 'FormatOnSaveOptions';
7
+
8
+ const MY_FORMAT_ONLY_CHANGED_LINES_OPTION_NAME = 'myFormatOnlyChangedLines';
9
+ const MY_RUN_ON_SAVE_OPTION_NAME = 'myRunOnSave';
10
+
11
+ /**
12
+ * @param {Array} workspaceConfigs
13
+ * @returns {Promise<Boolean>}
14
+ */
15
+ const setupFormatOnSave = async (workspaceConfigs) => {
16
+ let hasChanges = false;
17
+ const formatOnSaveOptionsComponent = workspaceConfigs.find(
18
+ (workspaceConfig) => workspaceConfig[nameKey] === FORMAT_ON_SAVE_OPTIONS_COMPONENT_NAME
19
+ );
20
+
21
+ if (formatOnSaveOptionsComponent) {
22
+ if (formatOnSaveOptionsComponent.option && !Array.isArray(formatOnSaveOptionsComponent.option)) {
23
+ hasChanges = true;
24
+ formatOnSaveOptionsComponent.option = [formatOnSaveOptionsComponent.option];
25
+ } else if (!formatOnSaveOptionsComponent.option) {
26
+ hasChanges = true;
27
+ formatOnSaveOptionsComponent.option = [];
28
+ }
29
+
30
+ const missingOptions = [MY_FORMAT_ONLY_CHANGED_LINES_OPTION_NAME, MY_RUN_ON_SAVE_OPTION_NAME].filter(
31
+ (optionName) => !formatOnSaveOptionsComponent.option.some((option) => option[nameKey] === optionName)
32
+ );
33
+
34
+ if (missingOptions.length > 0) {
35
+ hasChanges = true;
36
+ missingOptions.forEach((missingOption) => {
37
+ formatOnSaveOptionsComponent.option.push({
38
+ [nameKey]: missingOption,
39
+ [valueKey]: 'true'
40
+ });
41
+ });
42
+ }
43
+ } else {
44
+ hasChanges = true;
45
+ workspaceConfigs.push({
46
+ [nameKey]: FORMAT_ON_SAVE_OPTIONS_COMPONENT_NAME,
47
+ option: [MY_FORMAT_ONLY_CHANGED_LINES_OPTION_NAME, MY_RUN_ON_SAVE_OPTION_NAME].map((option) => ({
48
+ [nameKey]: option,
49
+ [valueKey]: 'true'
50
+ }))
51
+ });
52
+ }
53
+
54
+ return hasChanges;
55
+ };
56
+
57
+ module.exports = setupFormatOnSave;
@@ -0,0 +1,66 @@
1
+ const { loadXmlFile, buildXmlFile } = require('../../../../config/xml-parser');
2
+ const pathExists = require('../../../../util/path-exists');
3
+ const setupComposerSettings = require('./composer-settings-config');
4
+ const setupFormatOnSave = require('./format-setting-config');
5
+ const setupPHPDebugGeneral = require('./php-debug-general-config');
6
+ const setupPHPServers = require('./php-server-config');
7
+ const setupPropertiesComponent = require('./properties-component-config');
8
+ const setupRunManager = require('./run-manager-config');
9
+
10
+ /**
11
+ * @type {() => import('listr2').ListrTask<import('../../../../../typings/context').ListrContext>}
12
+ */
13
+ const setupWorkspaceConfig = () => ({
14
+ title: 'Set up Workspace configuration',
15
+ task: async (ctx, task) => {
16
+ const {
17
+ config: {
18
+ phpStorm
19
+ }
20
+ } = ctx;
21
+
22
+ if (await pathExists(phpStorm.xdebug.path)) {
23
+ const workspaceConfiguration = await loadXmlFile(phpStorm.xdebug.path);
24
+ const workspaceConfigs = workspaceConfiguration.project.component;
25
+ const hasChanges = await Promise.all([
26
+ setupPHPDebugGeneral(workspaceConfigs, phpStorm),
27
+ setupPHPServers(workspaceConfigs, phpStorm),
28
+ setupRunManager(workspaceConfigs, phpStorm),
29
+ setupPropertiesComponent(workspaceConfigs)
30
+ ]);
31
+
32
+ if (hasChanges.includes(true)) {
33
+ await buildXmlFile(phpStorm.php.path, workspaceConfiguration);
34
+ } else {
35
+ task.skip();
36
+ }
37
+
38
+ return;
39
+ }
40
+
41
+ const workspaceConfiguration = {
42
+ '?xml': {
43
+ '@_version': '1.0',
44
+ '@_encoding': 'UTF-8'
45
+ },
46
+ project: {
47
+ '@_version': '4',
48
+ component: []
49
+ }
50
+ };
51
+ const workspaceConfigs = workspaceConfiguration.project.component;
52
+
53
+ await Promise.all([
54
+ setupPHPDebugGeneral(workspaceConfigs, phpStorm),
55
+ setupPHPServers(workspaceConfigs, phpStorm),
56
+ setupRunManager(workspaceConfigs, phpStorm),
57
+ setupPropertiesComponent(workspaceConfigs),
58
+ setupComposerSettings(workspaceConfigs),
59
+ setupFormatOnSave(workspaceConfigs)
60
+ ]);
61
+
62
+ await buildXmlFile(phpStorm.xdebug.path, workspaceConfiguration);
63
+ }
64
+ });
65
+
66
+ module.exports = setupWorkspaceConfig;
@@ -0,0 +1,64 @@
1
+ const {
2
+ nameKey
3
+ } = require('../keys');
4
+
5
+ const PHP_DEBUG_GENERAL_COMPONENT_NAME = 'PhpDebugGeneral';
6
+
7
+ const portKey = '@_port';
8
+ const xdebugDebugPortKey = '@_xdebug_debug_port';
9
+ const ignoreConnectionsThroughUnregisteredServersKey = '@_ignore_connections_through_unregistered_servers';
10
+
11
+ /**
12
+ * @param {Array} workspaceConfigs
13
+ * @param {import('../../../../../typings/phpstorm').PHPStormConfig} phpStormConfiguration
14
+ * @returns {Promise<Boolean>}
15
+ */
16
+ const setupPHPDebugGeneral = async (workspaceConfigs, phpStormConfiguration) => {
17
+ const { xdebug } = phpStormConfiguration;
18
+ let hasChanges = false;
19
+ const phpDebugGeneralComponent = workspaceConfigs.find(
20
+ (workspaceConfig) => workspaceConfig[nameKey] === PHP_DEBUG_GENERAL_COMPONENT_NAME
21
+ );
22
+
23
+ if (phpDebugGeneralComponent) {
24
+ if (phpDebugGeneralComponent.xdebug_debug_ports && !Array.isArray(phpDebugGeneralComponent.xdebug_debug_ports)) {
25
+ hasChanges = true;
26
+ phpDebugGeneralComponent.xdebug_debug_ports = [phpDebugGeneralComponent.xdebug_debug_ports];
27
+ } else if (!phpDebugGeneralComponent.xdebug_debug_ports) {
28
+ hasChanges = true;
29
+ phpDebugGeneralComponent.xdebug_debug_ports = [];
30
+ }
31
+
32
+ if (!(xdebugDebugPortKey in phpDebugGeneralComponent)) {
33
+ hasChanges = true;
34
+ phpDebugGeneralComponent[xdebugDebugPortKey] = xdebug.v3Port;
35
+ }
36
+
37
+ const missingXDebugPorts = [xdebug.v3Port, xdebug.v2Port].filter(
38
+ (port) => !phpDebugGeneralComponent.xdebug_debug_ports.some((xPort) => xPort[portKey] === port)
39
+ );
40
+
41
+ if (missingXDebugPorts.length > 0) {
42
+ hasChanges = true;
43
+ missingXDebugPorts.forEach((port) => {
44
+ phpDebugGeneralComponent.xdebug_debug_ports.push({
45
+ [portKey]: port
46
+ });
47
+ });
48
+ }
49
+ } else {
50
+ hasChanges = true;
51
+ workspaceConfigs.push({
52
+ [nameKey]: PHP_DEBUG_GENERAL_COMPONENT_NAME,
53
+ [xdebugDebugPortKey]: xdebug.v3Port,
54
+ [ignoreConnectionsThroughUnregisteredServersKey]: 'true',
55
+ xdebug_debug_ports: [xdebug.v3Port, xdebug.v2Port].map((port) => ({
56
+ [portKey]: port
57
+ }))
58
+ });
59
+ }
60
+
61
+ return hasChanges;
62
+ };
63
+
64
+ module.exports = setupPHPDebugGeneral;
@@ -0,0 +1,60 @@
1
+ const { nameKey } = require('../keys');
2
+
3
+ const PHP_SERVERS_COMPONENT_NAME = 'PhpServers';
4
+
5
+ const hostKey = '@_host';
6
+
7
+ /**
8
+ * @param {Array} workspaceConfigs
9
+ * @param {import('../../../../../typings/phpstorm').PHPStormConfig} phpStormConfiguration
10
+ * @returns {Promise<Boolean>}
11
+ */
12
+ const setupPHPServers = async (workspaceConfigs, phpStormConfiguration) => {
13
+ const { xdebug } = phpStormConfiguration;
14
+ let hasChanges = false;
15
+ const phpServersComponent = workspaceConfigs.find(
16
+ (workspaceConfig) => workspaceConfig[nameKey] === PHP_SERVERS_COMPONENT_NAME
17
+ );
18
+
19
+ const defaultServerConfig = {
20
+ [hostKey]: xdebug.debugServerAddress,
21
+ id: '7e16e907-9ce3-4559-9d26-a30a5650d11f',
22
+ [nameKey]: xdebug.serverName
23
+ };
24
+
25
+ if (phpServersComponent) {
26
+ if (phpServersComponent.servers && !Array.isArray(phpServersComponent.servers)) {
27
+ hasChanges = true;
28
+ phpServersComponent.servers = [phpServersComponent.servers];
29
+ } else if (!phpServersComponent.servers) {
30
+ hasChanges = true;
31
+ phpServersComponent.servers = [];
32
+ }
33
+
34
+ const serverConfiguration = phpServersComponent.servers.find((server) => server.server[nameKey] === xdebug.serverName);
35
+
36
+ if (serverConfiguration && serverConfiguration.server[hostKey] !== xdebug.debugServerAddress) {
37
+ hasChanges = true;
38
+ serverConfiguration.server[hostKey] = xdebug.debugServerAddress;
39
+ } else if (!serverConfiguration) {
40
+ hasChanges = true;
41
+ phpServersComponent.servers.push({
42
+ server: defaultServerConfig
43
+ });
44
+ }
45
+ } else {
46
+ hasChanges = true;
47
+ workspaceConfigs.push({
48
+ [nameKey]: PHP_SERVERS_COMPONENT_NAME,
49
+ servers: [
50
+ {
51
+ server: defaultServerConfig
52
+ }
53
+ ]
54
+ });
55
+ }
56
+
57
+ return hasChanges;
58
+ };
59
+
60
+ module.exports = setupPHPServers;
@@ -0,0 +1,51 @@
1
+ const path = require('path');
2
+ // const { baseConfig } = require('../../../../config');
3
+ const { getCSAThemes } = require('../../../../util/CSA-theme');
4
+ const pathExists = require('../../../../util/path-exists');
5
+ const { nameKey } = require('../keys');
6
+ // const { formatPathForPHPStormConfig } = require('../xml-utils');
7
+
8
+ const PROPERTIES_COMPONENT_NAME = 'PropertiesComponent';
9
+
10
+ const defaultProperties = {
11
+ keyToString: {
12
+ 'RunOnceActivity.OpenProjectViewOnStart': 'true',
13
+ 'RunOnceActivity.ShowReadmeOnStart': 'true'
14
+ }
15
+ };
16
+
17
+ /**
18
+ * @param {Array} workspaceConfigs
19
+ * @returns {Promise<Boolean>}
20
+ */
21
+ const setupPropertiesComponent = async (workspaceConfigs) => {
22
+ let hasChanges = false;
23
+ const propertiesComponent = workspaceConfigs.find(
24
+ (workspaceConfig) => workspaceConfig[nameKey] === PROPERTIES_COMPONENT_NAME
25
+ );
26
+
27
+ if (propertiesComponent) {
28
+ // check later
29
+ } else {
30
+ hasChanges = true;
31
+ const themes = await getCSAThemes();
32
+ if (themes.length > 0) {
33
+ const theme = themes[0];
34
+ const themeESLintPath = path.join(process.cwd(), theme.themePath, 'node_modules', 'eslint');
35
+ if (await pathExists(themeESLintPath)) {
36
+ defaultProperties.keyToString['node.js.selected.package.eslint'] = themeESLintPath;
37
+ defaultProperties.keyToString['js.linters.configure.manually.selectedeslint'] = 'true';
38
+ defaultProperties.keyToString['node.js.detected.package.eslint'] = 'true';
39
+ defaultProperties.keyToString['settings.editor.selected.configurable'] = 'settings.javascript.linters.eslint';
40
+ }
41
+ }
42
+ workspaceConfigs.push({
43
+ [nameKey]: PROPERTIES_COMPONENT_NAME,
44
+ '#text': JSON.stringify(defaultProperties)
45
+ });
46
+ }
47
+
48
+ return hasChanges;
49
+ };
50
+
51
+ module.exports = setupPropertiesComponent;
@@ -0,0 +1,74 @@
1
+ const { nameKey } = require('../keys');
2
+
3
+ const RUN_MANAGER_COMPONENT_NAME = 'RunManager';
4
+
5
+ const PHP_REMOTE_DEBUG_RUN_CONFIGURATION_TYPE = 'PhpRemoteDebugRunConfigurationType';
6
+
7
+ const serverNameKey = '@_server_name';
8
+ const sessionIdKey = '@_session_id';
9
+
10
+ /**
11
+ * @param {Array} workspaceConfigs
12
+ * @param {import('../../../../../typings/phpstorm').PHPStormConfig} phpStormConfiguration
13
+ * @returns {Promise<Boolean>}
14
+ */
15
+ const setupRunManager = async (workspaceConfigs, phpStormConfiguration) => {
16
+ const { xdebug } = phpStormConfiguration;
17
+ let hasChanges = false;
18
+ const runManagerComponent = workspaceConfigs.find(
19
+ (workspaceConfig) => workspaceConfig[nameKey] === RUN_MANAGER_COMPONENT_NAME
20
+ );
21
+
22
+ const defaultRunManagerConfiguration = {
23
+ [nameKey]: xdebug.runManagerName,
24
+ '@_type': PHP_REMOTE_DEBUG_RUN_CONFIGURATION_TYPE,
25
+ '@_factoryName': 'PHP Remote Debug',
26
+ '@_filter_connections': 'FILTER',
27
+ [serverNameKey]: xdebug.serverName,
28
+ [sessionIdKey]: xdebug.sessionId,
29
+ method: {
30
+ '@_v': '2'
31
+ }
32
+ };
33
+
34
+ if (runManagerComponent) {
35
+ if (runManagerComponent.configuration && !Array.isArray(runManagerComponent.configuration)) {
36
+ hasChanges = true;
37
+ runManagerComponent.configuration = [runManagerComponent.configuration];
38
+ } else if (!runManagerComponent.configuration) {
39
+ hasChanges = true;
40
+ runManagerComponent.configuration = [];
41
+ }
42
+
43
+ const phpRemoteDebugRunConfiguration = runManagerComponent.configuration.find(
44
+ (configuration) => configuration['@_type'] === PHP_REMOTE_DEBUG_RUN_CONFIGURATION_TYPE && configuration[nameKey] === xdebug.runManagerName
45
+ );
46
+
47
+ if (phpRemoteDebugRunConfiguration) {
48
+ if (phpRemoteDebugRunConfiguration[serverNameKey] !== xdebug.serverName) {
49
+ hasChanges = true;
50
+ phpRemoteDebugRunConfiguration[serverNameKey] = xdebug.serverName;
51
+ }
52
+
53
+ if (phpRemoteDebugRunConfiguration[sessionIdKey] !== xdebug.sessionId) {
54
+ hasChanges = true;
55
+ phpRemoteDebugRunConfiguration[sessionIdKey] = xdebug.sessionId;
56
+ }
57
+ } else {
58
+ hasChanges = true;
59
+ runManagerComponent.configuration.push(defaultRunManagerConfiguration);
60
+ }
61
+ } else {
62
+ hasChanges = true;
63
+ workspaceConfigs.push({
64
+ [nameKey]: RUN_MANAGER_COMPONENT_NAME,
65
+ configuration: [
66
+ defaultRunManagerConfiguration
67
+ ]
68
+ });
69
+ }
70
+
71
+ return hasChanges;
72
+ };
73
+
74
+ module.exports = setupRunManager;
@@ -0,0 +1,5 @@
1
+ const formatPathForPHPStormConfig = (p) => p.replace(process.cwd(), '$PROJECT_DIR$');
2
+
3
+ module.exports = {
4
+ formatPathForPHPStormConfig
5
+ };
@@ -1,7 +1,7 @@
1
1
  const createNginxConfig = require('./create-nginx-config');
2
2
  const createPhpConfig = require('./create-php-config');
3
3
  const createPhpFpmConfig = require('./create-php-fpm-config');
4
- const createPhpStormConfig = require('./create-php-storm-config');
4
+ const createPhpStormConfig = require('./create-phpstorm-config');
5
5
  const createVSCodeConfig = require('./create-vscode-config');
6
6
 
7
7
  /**
@@ -29,6 +29,7 @@ const convertLegacyVolumes = require('./docker/convert-legacy-volumes');
29
29
  const enableMagentoComposerPlugins = require('./magento/enable-magento-composer-plugins');
30
30
  const getIsWsl = require('../util/is-wsl');
31
31
  const checkForXDGOpen = require('../util/xdg-open-exists');
32
+ const { getInstanceMetadata, constants: { WEB_LOCATION_TITLE } } = require('../util/instance-metadata');
32
33
 
33
34
  /**
34
35
  * @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
@@ -189,8 +190,11 @@ const start = () => ({
189
190
 
190
191
  return false;
191
192
  },
192
- task: ({ ports, config: { overridenConfiguration: { host, ssl } } }) => {
193
- openBrowser(`${ssl.enabled ? 'https' : 'http'}://${host}${ssl.enabled || ports.app === 80 ? '' : `:${ports.app}`}/`);
193
+ task: (ctx) => {
194
+ const instanceMetadata = getInstanceMetadata(ctx);
195
+ const locationOnTheWeb = instanceMetadata.frontend.find(({ title }) => title === WEB_LOCATION_TITLE);
196
+
197
+ openBrowser(locationOnTheWeb.text);
194
198
  },
195
199
  options: {
196
200
  showTimer: false
@@ -70,5 +70,11 @@ const getInstanceMetadata = (ctx) => {
70
70
  };
71
71
 
72
72
  module.exports = {
73
- getInstanceMetadata
73
+ getInstanceMetadata,
74
+ constants: {
75
+ WEB_LOCAL_LOCATION_TITLE,
76
+ WEB_LOCATION_TITLE,
77
+ WEB_ADMIN_LOCATION_TITLE,
78
+ WEB_ADMIN_CREDENTIALS_TITLE
79
+ }
74
80
  };
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.14.0",
6
+ "version": "1.14.1-alpha.2",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -26,6 +26,7 @@
26
26
  "conf": "10.1.1",
27
27
  "enquirer": "2.3.6",
28
28
  "eta": "1.12.3",
29
+ "fast-xml-parser": "^4.0.7",
29
30
  "hjson": "^3.2.2",
30
31
  "is-installed-globally": "0.4.0",
31
32
  "joi": "17.6.0",
@@ -41,5 +42,15 @@
41
42
  "publishConfig": {
42
43
  "access": "public"
43
44
  },
44
- "gitHead": "60c7a2bacde24256dcb2d17128e41c0b371987a7"
45
+ "keywords": [
46
+ "magento",
47
+ "docker",
48
+ "php",
49
+ "nginx",
50
+ "redis",
51
+ "elasticsearch",
52
+ "mysql",
53
+ "scandipwa"
54
+ ],
55
+ "gitHead": "8f43ab3d68af6442bbd618efd785654ac62e54b8"
45
56
  }
@@ -1,6 +1,7 @@
1
1
  import mysql2 from 'mysql2';
2
2
 
3
3
  import { CMAConfiguration, PHPExtensions } from './index';
4
+ import { PHPStormConfig } from './phpstorm';
4
5
 
5
6
  export interface ListrContext {
6
7
  magentoVersion: string
@@ -82,6 +83,7 @@ export interface ListrContext {
82
83
  overridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
83
84
  userConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
84
85
  nonOverridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
86
+ phpStorm: PHPStormConfig
85
87
  }
86
88
  systemConfiguration: {
87
89
  analytics: boolean
@@ -0,0 +1,33 @@
1
+ export interface PHPStormConfig {
2
+ xdebug: {
3
+ v2Port: string;
4
+ v3Port: string;
5
+ debugServerAddress: string;
6
+ serverName: string;
7
+ runManagerName: string;
8
+ sessionId: string;
9
+ path: string;
10
+ templatePath: string;
11
+ }
12
+ php: {
13
+ phpLanguageLevel: string;
14
+ path: string;
15
+ templatePath: string;
16
+ }
17
+ database: {
18
+ driver: string;
19
+ dataSourceManagerName: string;
20
+ dataSourcesLocal: {
21
+ path: string;
22
+ templatePath: string;
23
+ }
24
+ dataSources: {
25
+ path: string;
26
+ templatePath: string;
27
+ }
28
+ }
29
+ inspectionTools: {
30
+ path: string;
31
+ templatePath: string;
32
+ }
33
+ }