@scandipwa/magento-scripts 1.14.1-alpha.8 → 1.15.1

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 (178) hide show
  1. package/lib/commands/cli.js +9 -4
  2. package/lib/commands/logs.js +1 -0
  3. package/lib/commands/start.js +18 -5
  4. package/lib/config/check-configuration-file.js +16 -1
  5. package/lib/config/cma-config.js +16 -0
  6. package/lib/config/dependencies-for-platforms.js +15 -3
  7. package/lib/config/docker.js +45 -12
  8. package/lib/config/get-port-config.js +7 -2
  9. package/lib/config/index.js +2 -1
  10. package/lib/config/php/extensions/libsodium.js +2 -1
  11. package/lib/config/port-config.js +2 -1
  12. package/lib/config/scandipwa-versions.js +2 -1
  13. package/lib/config/ssl-terminator/index.js +10 -0
  14. package/lib/config/system-config.js +34 -5
  15. package/lib/config/templates/magentorc.template +2 -0
  16. package/lib/config/templates/nginx.template.conf +0 -31
  17. package/lib/config/templates/ssl-terminator.template.conf +27 -0
  18. package/lib/config/templates/varnish.template.vcl +9 -4
  19. package/lib/config/versions/magento-2.3.0.js +3 -1
  20. package/lib/config/versions/magento-2.3.1.js +3 -1
  21. package/lib/config/versions/magento-2.3.2-p2.js +3 -1
  22. package/lib/config/versions/magento-2.3.2.js +3 -1
  23. package/lib/config/versions/magento-2.3.3-p1.js +3 -1
  24. package/lib/config/versions/magento-2.3.3.js +3 -1
  25. package/lib/config/versions/magento-2.3.4-p2.js +3 -1
  26. package/lib/config/versions/magento-2.3.4.js +3 -1
  27. package/lib/config/versions/magento-2.3.5-p1.js +3 -1
  28. package/lib/config/versions/magento-2.3.5-p2.js +3 -1
  29. package/lib/config/versions/magento-2.3.5.js +3 -1
  30. package/lib/config/versions/magento-2.3.6-p1.js +3 -1
  31. package/lib/config/versions/magento-2.3.6.js +3 -1
  32. package/lib/config/versions/magento-2.3.7-p1.js +3 -1
  33. package/lib/config/versions/magento-2.3.7-p2.js +3 -1
  34. package/lib/config/versions/magento-2.3.7-p3.js +3 -1
  35. package/lib/config/versions/magento-2.3.7.js +3 -1
  36. package/lib/config/versions/magento-2.4.0-p1.js +3 -1
  37. package/lib/config/versions/magento-2.4.0.js +3 -1
  38. package/lib/config/versions/magento-2.4.1-p1.js +3 -1
  39. package/lib/config/versions/magento-2.4.1.js +3 -1
  40. package/lib/config/versions/magento-2.4.2-p1.js +3 -1
  41. package/lib/config/versions/magento-2.4.2-p2.js +3 -1
  42. package/lib/config/versions/magento-2.4.2.js +3 -1
  43. package/lib/config/versions/magento-2.4.3-p1.js +3 -1
  44. package/lib/config/versions/magento-2.4.3-p2.js +3 -1
  45. package/lib/config/versions/magento-2.4.3.js +3 -1
  46. package/lib/config/versions/magento-2.4.4.js +3 -1
  47. package/lib/config/xml-parser.js +63 -0
  48. package/lib/errors/known-error.js +15 -0
  49. package/lib/errors/unknown-error.js +15 -0
  50. package/lib/tasks/cli/create-bashrc-config.js +2 -1
  51. package/lib/tasks/composer/index.js +5 -3
  52. package/lib/tasks/composer/local-auth-json.js +8 -4
  53. package/lib/tasks/docker/network.js +2 -1
  54. package/lib/tasks/execute/index.js +2 -3
  55. package/lib/tasks/file-system/create-nginx-config.js +4 -43
  56. package/lib/tasks/file-system/create-php-config.js +2 -1
  57. package/lib/tasks/file-system/create-php-fpm-config.js +2 -1
  58. package/lib/tasks/file-system/create-phpstorm-config/database-config.js +249 -0
  59. package/lib/tasks/file-system/create-phpstorm-config/eslint-config.js +85 -0
  60. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +154 -0
  61. package/lib/tasks/file-system/create-phpstorm-config/index.js +27 -0
  62. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/coding-standard-config.js +26 -0
  63. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/config.js +54 -0
  64. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/custom-ruleset-path-config.js +28 -0
  65. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/default-properties-config.js +42 -0
  66. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/eslint-inspection-config.js +37 -0
  67. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/index.js +80 -0
  68. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/magento-coding-standard-config.js +26 -0
  69. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/mess-detector-validation-inspection-config.js +142 -0
  70. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/paths.js +20 -0
  71. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-fixer-validation-inspection-config.js +60 -0
  72. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-validation-inspection-config.js +116 -0
  73. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/stylelint-inspection-config.js +37 -0
  74. package/lib/tasks/file-system/create-phpstorm-config/keys.js +14 -0
  75. package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +67 -0
  76. package/lib/tasks/file-system/create-phpstorm-config/php-config/mess-detector-config.js +54 -0
  77. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-code-sniffer-config.js +66 -0
  78. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-cs-fixer-config.js +58 -0
  79. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-project-shared-configuration-config.js +59 -0
  80. package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +77 -0
  81. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +97 -0
  82. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/format-setting-config.js +57 -0
  83. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +66 -0
  84. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +64 -0
  85. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +57 -0
  86. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/properties-component-config.js +49 -0
  87. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/run-manager-config.js +64 -0
  88. package/lib/tasks/file-system/create-phpstorm-config/xml-utils.js +5 -0
  89. package/lib/tasks/file-system/create-ssl-terminator-config.js +96 -0
  90. package/lib/tasks/file-system/create-varnish-config.js +2 -1
  91. package/lib/tasks/file-system/create-vscode-config.js +3 -2
  92. package/lib/tasks/file-system/index.js +3 -1
  93. package/lib/tasks/magento/enable-magento-composer-plugins.js +3 -2
  94. package/lib/tasks/magento/install-magento.js +7 -5
  95. package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +26 -0
  96. package/lib/tasks/magento/setup-magento/delete-admin-users.js +1 -1
  97. package/lib/tasks/magento/setup-magento/delete-customers.js +7 -4
  98. package/lib/tasks/magento/setup-magento/delete-orders.js +6 -4
  99. package/lib/tasks/magento/setup-magento/flush-redis-config.js +2 -1
  100. package/lib/tasks/magento/setup-magento/index.js +3 -1
  101. package/lib/tasks/magento/setup-magento/install-magento.js +2 -1
  102. package/lib/tasks/magento/setup-magento/set-base-url.js +7 -2
  103. package/lib/tasks/magento/setup-magento/upgrade-magento.js +11 -1
  104. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +41 -0
  105. package/lib/tasks/mysql/connect-to-mysql.js +2 -1
  106. package/lib/tasks/mysql/import-dump-to-mysql.js +13 -2
  107. package/lib/tasks/mysql/import-remote-db/index.js +2 -1
  108. package/lib/tasks/mysql/import-remote-db/ssh/index.js +2 -1
  109. package/lib/tasks/mysql/import-remote-db/ssh/regular-server.js +2 -1
  110. package/lib/tasks/php/bundled-extensions.js +28 -0
  111. package/lib/tasks/php/compile-options.js +27 -54
  112. package/lib/tasks/php/compile.js +6 -4
  113. package/lib/tasks/php/configure.js +7 -66
  114. package/lib/tasks/php/extensions/disable.js +2 -1
  115. package/lib/tasks/php/extensions/enable.js +2 -1
  116. package/lib/tasks/php/extensions/index.js +74 -0
  117. package/lib/tasks/php/extensions/install.js +3 -3
  118. package/lib/tasks/php/index.js +7 -6
  119. package/lib/tasks/php/install-sodium.js +93 -0
  120. package/lib/tasks/php/update-phpbrew.js +7 -3
  121. package/lib/tasks/php/validate-php.js +67 -0
  122. package/lib/tasks/php-fpm/start-php-fpm.js +4 -2
  123. package/lib/tasks/requirements/composer.js +59 -5
  124. package/lib/tasks/requirements/dependency/arch.js +2 -1
  125. package/lib/tasks/requirements/dependency/centos.js +2 -1
  126. package/lib/tasks/requirements/dependency/fedora.js +2 -1
  127. package/lib/tasks/requirements/dependency/mac.js +18 -3
  128. package/lib/tasks/requirements/docker/index.js +94 -40
  129. package/lib/tasks/requirements/docker/install-on-mac.js +29 -0
  130. package/lib/tasks/requirements/docker/install.js +2 -1
  131. package/lib/tasks/requirements/docker/running-status.js +32 -31
  132. package/lib/tasks/requirements/docker/version.js +2 -1
  133. package/lib/tasks/requirements/index.js +3 -0
  134. package/lib/tasks/requirements/node-version.js +2 -1
  135. package/lib/tasks/requirements/php-version.js +26 -24
  136. package/lib/tasks/requirements/phpbrew/index.js +2 -1
  137. package/lib/tasks/requirements/phpbrew/install.js +14 -2
  138. package/lib/tasks/requirements/phpbrew/version.js +2 -1
  139. package/lib/tasks/requirements/platform.js +5 -3
  140. package/lib/tasks/requirements/rosetta.js +32 -0
  141. package/lib/tasks/start.js +10 -2
  142. package/lib/tasks/status/index.js +24 -8
  143. package/lib/tasks/theme/build-theme.js +2 -1
  144. package/lib/tasks/theme/install-theme.js +2 -1
  145. package/lib/tasks/theme/link-theme.js +2 -2
  146. package/lib/tasks/theme/retrieve-theme-data.js +2 -1
  147. package/lib/tasks/theme/setup-persisted-query.js +2 -1
  148. package/lib/tasks/theme/setup-themes.js +10 -3
  149. package/lib/tasks/theme/symlink-theme.js +8 -1
  150. package/lib/util/CSA-theme.js +4 -0
  151. package/lib/util/analytics.js +320 -0
  152. package/lib/util/arch.js +1 -1
  153. package/lib/util/config-file-validator.js +4 -2
  154. package/lib/util/config-php-json.js +3 -2
  155. package/lib/util/env-php-json.js +3 -2
  156. package/lib/util/exec-async-command.d.ts +2 -0
  157. package/lib/util/exec-async-command.js +31 -15
  158. package/lib/util/exec-async.js +9 -0
  159. package/lib/util/get-brew-bin-path.js +64 -0
  160. package/lib/util/get-installed-magento-version.js +3 -2
  161. package/lib/util/get-jsonfile-data.js +2 -1
  162. package/lib/util/install-dependencies-task.js +15 -5
  163. package/lib/util/instance-metadata.js +11 -4
  164. package/lib/util/ip.js +47 -1
  165. package/lib/util/magento-task.js +20 -9
  166. package/lib/util/php-task.js +7 -7
  167. package/lib/util/request.js +0 -0
  168. package/lib/util/resolve-configuration-with-overrides.js +2 -1
  169. package/lib/util/run-composer.js +5 -3
  170. package/lib/util/run-magento.js +3 -2
  171. package/lib/util/run-php.js +7 -2
  172. package/lib/util/wait-for-it.js +3 -2
  173. package/package.json +5 -3
  174. package/typings/context.d.ts +4 -0
  175. package/typings/index.d.ts +13 -1
  176. package/typings/phpstorm.d.ts +33 -0
  177. package/lib/tasks/file-system/create-php-storm-config.js +0 -82
  178. package/lib/tasks/magento/setup-magento/disable-full-page-cache.js +0 -20
package/lib/util/ip.js CHANGED
@@ -1,8 +1,54 @@
1
+ const { request } = require('smol-request');
2
+
1
3
  const ipRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
2
4
 
3
5
  const isIpAddress = (text) => ipRegex.test(text);
4
6
 
7
+ const externalIpProviders = [
8
+ 'http://api.ipify.org/',
9
+ 'http://icanhazip.com/',
10
+ 'http://ifconfig.io/ip',
11
+ 'http://ip.appspot.com/',
12
+ 'http://ident.me/',
13
+ 'http://whatismyip.akamai.com/',
14
+ 'http://tnx.nl/ip',
15
+ 'http://myip.dnsomatic.com/',
16
+ 'http://ipecho.net/plain',
17
+ 'http://diagnostic.opendns.com/myip',
18
+ 'http://trackip.net/ip'
19
+ ];
20
+
21
+ /**
22
+ * Get an external IP address
23
+ * @returns {Promise<string>}
24
+ */
25
+ const getExternalIpAddress = async () => {
26
+ let ip;
27
+
28
+ for (const ipProvider of externalIpProviders) {
29
+ try {
30
+ const response = await request(ipProvider, {
31
+ responseType: 'text'
32
+ });
33
+
34
+ if (response.status === 200) {
35
+ ip = response.data;
36
+ break;
37
+ }
38
+ } catch (e) {
39
+ //
40
+ }
41
+ }
42
+
43
+ if (!ip) {
44
+ throw new Error('External IP address is not available!');
45
+ }
46
+
47
+ return ip;
48
+ };
49
+
5
50
  module.exports = {
6
51
  ipRegex,
7
- isIpAddress
52
+ isIpAddress,
53
+ getExternalIpAddress
8
54
  };
@@ -1,17 +1,28 @@
1
1
  const runMagentoCommand = require('./run-magento');
2
2
 
3
3
  /**
4
- * @type {(command: string) => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
4
+ * @param {String} command
5
+ * @param {Object} [options]
6
+ * @param {(e: Error) => void} [options.onError]
7
+ * @returns {import('listr2').ListrTask<import('../../typings/context').ListrContext>}
5
8
  */
6
- const magentoTask = (command) => ({
9
+ const magentoTask = (command, options = {}) => ({
7
10
  title: `Running command 'magento ${command}'`,
8
- task: ({ magentoVersion, verbose }, task) => runMagentoCommand(command, {
9
- callback: !verbose ? undefined : (t) => {
10
- task.output = t;
11
- },
12
- magentoVersion,
13
- throwNonZeroCode: true
14
- }),
11
+ task: async ({ magentoVersion, verbose }, task) => {
12
+ try {
13
+ await runMagentoCommand(command, {
14
+ callback: !verbose ? undefined : (t) => {
15
+ task.output = t;
16
+ },
17
+ magentoVersion,
18
+ throwNonZeroCode: true
19
+ });
20
+ } catch (e) {
21
+ if (options.onError) {
22
+ options.onError(e);
23
+ }
24
+ }
25
+ },
15
26
  options: {
16
27
  bottomBar: 10
17
28
  }
@@ -1,20 +1,20 @@
1
1
  const runPhpCode = require('./run-php');
2
2
 
3
3
  /**
4
- * @type {(
5
- * command: string,
6
- * options: { noTitle: boolean, env: Record<string, string> }
7
- * ) => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
4
+ * @param {String} command
5
+ * @param {{ noTitle: boolean, env: Record<string, string> }} options
6
+ * @returns {import('listr2').ListrTask<import('../../typings/context').ListrContext>}
8
7
  */
9
8
  const phpTask = (command, options = {}) => ({
10
9
  title: !options.noTitle ? `Running command 'php ${command}` : undefined,
11
- task: ({ magentoVersion }, task) => runPhpCode(command, {
10
+ task: (ctx, task) => runPhpCode(command, {
12
11
  callback: (t) => {
13
12
  task.output = t;
14
13
  },
15
14
  throwNonZeroCode: true,
16
- magentoVersion,
17
- env: options.env
15
+ magentoVersion: ctx.magentoVersion,
16
+ env: options.env,
17
+ useRosettaOnMac: ctx.arch === 'arm64' && ctx.platform === 'darwin'
18
18
  })
19
19
  });
20
20
 
File without changes
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const UnknownError = require('../errors/unknown-error');
2
3
  const { configFileSchema } = require('./config-file-validator');
3
4
  const { deepmerge } = require('./deepmerge');
4
5
  const pathExists = require('./path-exists');
@@ -11,7 +12,7 @@ const resolveConfigurationWithOverrides = async (configuration, baseConfig, proj
11
12
  try {
12
13
  await configFileSchema.validateAsync(userConfiguration);
13
14
  } catch (e) {
14
- throw new Error(`Configuration file validation error!\n\n${e.message}`);
15
+ throw new UnknownError(`Configuration file validation error!\n\n${e.message}`);
15
16
  }
16
17
 
17
18
  const overridenConfiguration = deepmerge(configuration, userConfiguration);
@@ -1,5 +1,6 @@
1
1
  const { execAsyncSpawn } = require('./exec-async-command');
2
2
  const { getConfigFromMagentoVersion, defaultConfiguration } = require('../config');
3
+ const UnknownError = require('../errors/unknown-error');
3
4
  /**
4
5
  * Execute composer command
5
6
  * @param {String} command composer command
@@ -20,12 +21,13 @@ const runComposerCommand = async (command, options = {}) => {
20
21
  const { code, result } = await execAsyncSpawn(`${php.binPath} -c ${php.iniPath} ${composer.binPath} ${command}`, {
21
22
  ...options,
22
23
  cwd: magentoDir,
23
- withCode: true
24
+ withCode: true,
25
+ useRosetta2: true
24
26
  });
25
27
 
26
28
  if (throwNonZeroCode && code !== 0) {
27
- throw new Error(`Code: ${code}
28
- Response: ${result}`);
29
+ throw new UnknownError(`Code: ${code}
30
+ Response: ${result}`);
29
31
  }
30
32
 
31
33
  return { code, result };
@@ -1,5 +1,6 @@
1
1
  const { execAsyncSpawn } = require('./exec-async-command');
2
2
  const { getConfigFromMagentoVersion, defaultConfiguration, magento } = require('../config');
3
+ const UnknownError = require('../errors/unknown-error');
3
4
  /**
4
5
  * Execute magento command
5
6
  * @param {String} command magento command
@@ -27,8 +28,8 @@ const runMagentoCommand = async (command, options = {}) => {
27
28
  });
28
29
 
29
30
  if (throwNonZeroCode && code !== 0) {
30
- throw new Error(`Code: ${code}
31
- Response: ${result}`);
31
+ throw new UnknownError(`Code: ${code}
32
+ Response: ${result}`);
32
33
  }
33
34
 
34
35
  return { code, result };
@@ -1,5 +1,6 @@
1
1
  const { execAsyncSpawn } = require('./exec-async-command');
2
2
  const { getConfigFromMagentoVersion, defaultConfiguration } = require('../config');
3
+ const UnknownError = require('../errors/unknown-error');
3
4
  /**
4
5
  * Execute PHP code
5
6
  * @param {String} command magento command
@@ -11,6 +12,7 @@ const { getConfigFromMagentoVersion, defaultConfiguration } = require('../config
11
12
  * @param {Boolean} options.throwNonZeroCode Throw if command return non 0 code.
12
13
  * @param {String} options.magentoVersion Magento version for config
13
14
  * @param {Record<string, string>} options.env Environment variables
15
+ * @param {Boolean} options.useRosettaOnMac Use Rosetta 2 on MacOS
14
16
  */
15
17
  const runPhpCode = async (command, options = {}) => {
16
18
  const {
@@ -23,14 +25,17 @@ const runPhpCode = async (command, options = {}) => {
23
25
  const env = Object.entries(options.env).map(([key, value]) => `${key}=${value}`).join(' ');
24
26
  spawnCommand = `${env} ${spawnCommand}`;
25
27
  }
28
+ if (options.useRosettaOnMac) {
29
+ spawnCommand = `arch -x86_64 bash -c '${spawnCommand}'`;
30
+ }
26
31
  const { code, result } = await execAsyncSpawn(spawnCommand, {
27
32
  ...options,
28
33
  withCode: true
29
34
  });
30
35
 
31
36
  if (throwNonZeroCode && code !== 0) {
32
- throw new Error(`Code: ${code}
33
- Response: ${result}`);
37
+ throw new UnknownError(`Code: ${code}
38
+ Response: ${result}`);
34
39
  }
35
40
 
36
41
  return { code, result };
@@ -1,4 +1,5 @@
1
1
  const net = require('net');
2
+ const UnknownError = require('../errors/unknown-error');
2
3
  const sleep = require('./sleep');
3
4
 
4
5
  const connectToHostPort = ({ host, port }) => new Promise((resolve, reject) => {
@@ -14,7 +15,7 @@ const connectToHostPort = ({ host, port }) => new Promise((resolve, reject) => {
14
15
  });
15
16
  socket.on('timeout', () => {
16
17
  socket.end();
17
- reject(new Error('Connection timeout'));
18
+ reject(new UnknownError('Connection timeout'));
18
19
  });
19
20
  });
20
21
 
@@ -29,7 +30,7 @@ const waitForIt = async ({
29
30
  // eslint-disable-next-line no-await-in-loop
30
31
  await Promise.race([
31
32
  sleep(300).then(() => {
32
- throw new Error('Connection timeout');
33
+ throw new UnknownError('Connection timeout');
33
34
  }),
34
35
  connectToHostPort({ host, port })
35
36
  ]);
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.1-alpha.8",
6
+ "version": "1.15.1",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -22,10 +22,11 @@
22
22
  "arm64"
23
23
  ],
24
24
  "dependencies": {
25
- "@scandipwa/scandipwa-dev-utils": "0.1.12",
25
+ "@scandipwa/scandipwa-dev-utils": "0.1.13",
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",
@@ -35,6 +36,7 @@
35
36
  "mysql2": "2.3.2",
36
37
  "node-ssh": "12.0.0",
37
38
  "semver": "7.3.5",
39
+ "smol-request": "^2.1.2",
38
40
  "systeminformation": "5.11.7",
39
41
  "yargs": "17.3.1"
40
42
  },
@@ -51,5 +53,5 @@
51
53
  "mysql",
52
54
  "scandipwa"
53
55
  ],
54
- "gitHead": "a59a530f5ebb1946f3138b57fb1674fe7df305c9"
56
+ "gitHead": "ba6f9e613e4448cf449c6e82f8d95ff546de2294"
55
57
  }
@@ -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
@@ -13,10 +14,12 @@ export interface ListrContext {
13
14
  redis: number
14
15
  elasticsearch: number
15
16
  varnish: number
17
+ sslTerminator: number
16
18
  }
17
19
  arch: 'arm64' | 'x64'
18
20
  isArm: boolean
19
21
  isWsl: boolean
22
+ isArmMac: boolean
20
23
  platform?: NodeJS.Platform
21
24
  platformVersion?: string
22
25
  /**
@@ -84,6 +87,7 @@ export interface ListrContext {
84
87
  overridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
85
88
  userConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
86
89
  nonOverridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
90
+ phpStorm: PHPStormConfig
87
91
  }
88
92
  systemConfiguration: {
89
93
  analytics: boolean
@@ -10,7 +10,14 @@ export interface ServiceWithVersion {
10
10
  version: string
11
11
  }
12
12
 
13
- // export inter/
13
+ export interface SSLTerminatorConfiguration extends ServiceWithVersion {
14
+ /**
15
+ * Configuration file location
16
+ *
17
+ * @example ./my-ssl-terminator-config.conf
18
+ */
19
+ configTemplate: string
20
+ }
14
21
 
15
22
  export interface NginxConfiguration extends ServiceWithVersion {
16
23
  /**
@@ -194,6 +201,11 @@ export interface CMAConfiguration {
194
201
  * Varnish configuration
195
202
  */
196
203
  varnish: VarnishConfiguration
204
+
205
+ /**
206
+ * SSL Terminator configuration
207
+ */
208
+ sslTerminator: SSLTerminatorConfiguration
197
209
  }
198
210
  /**
199
211
  * Magento configuration
@@ -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
+ }
@@ -1,82 +0,0 @@
1
- const setConfigFile = require('../../util/set-config');
2
- const pathExists = require('../../util/path-exists');
3
- const path = require('path');
4
- const fs = require('fs');
5
-
6
- const createPhpStormConfig = () => ({
7
- title: 'Setting PHPStorm config',
8
- task: async ({ config: { phpStorm }, ports }) => {
9
- const { phpLanguageLevel } = phpStorm.php;
10
- const jdbcUrl = `jdbc:mysql://localhost:${ports.mysql}/magento`;
11
-
12
- try {
13
- await setConfigFile({
14
- configPathname: phpStorm.xdebug.path,
15
- template: phpStorm.xdebug.templatePath,
16
- overwrite: true,
17
- templateArgs: {
18
- phpStorm
19
- }
20
- });
21
- } catch (e) {
22
- throw new Error(`Unexpected error accrued during workspace.xml config creation\n\n${e}`);
23
- }
24
-
25
- try {
26
- await setConfigFile({
27
- configPathname: phpStorm.php.path,
28
- template: phpStorm.php.templatePath,
29
- overwrite: true,
30
- templateArgs: {
31
- phpLanguageLevel
32
- }
33
- });
34
- } catch (e) {
35
- throw new Error(`Unexpected error accrued during php.xml config creation\n\n${e}`);
36
- }
37
-
38
- try {
39
- await setConfigFile({
40
- configPathname: phpStorm.database.dataSourcesLocal.path,
41
- template: phpStorm.database.dataSourcesLocal.templatePath,
42
- overwrite: true,
43
- templateArgs: {
44
- phpStorm
45
- }
46
- });
47
- } catch (e) {
48
- throw new Error(`Unexpected error accrued during dataSources.local.xml config creation\n\n${e}`);
49
- }
50
-
51
- try {
52
- await setConfigFile({
53
- configPathname: phpStorm.database.dataSources.path,
54
- template: phpStorm.database.dataSources.templatePath,
55
- overwrite: true,
56
- templateArgs: {
57
- phpStorm,
58
- jdbcUrl
59
- }
60
- });
61
- } catch (e) {
62
- throw new Error(`Unexpected error accrued during dataSources.xml config creation\n\n${e}`);
63
- }
64
-
65
- if (!await pathExists(path.resolve('./.idea/dataSources'))) {
66
- await fs.promises.mkdir(path.resolve('./.idea/dataSources'));
67
- }
68
-
69
- try {
70
- await setConfigFile({
71
- configPathname: phpStorm.inspectionTools.path,
72
- template: phpStorm.inspectionTools.templatePath,
73
- overwrite: true,
74
- templateArgs: {}
75
- });
76
- } catch (e) {
77
- throw new Error(`Unexpected error accrued during Project_Default.xml config creation\n\n${e}`);
78
- }
79
- }
80
- });
81
-
82
- module.exports = createPhpStormConfig;
@@ -1,20 +0,0 @@
1
- const envPhpToJson = require('../../../util/env-php-json');
2
- const magentoTask = require('../../../util/magento-task');
3
-
4
- /**
5
- * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
6
- */
7
- const disableFullPageCache = () => ({
8
- title: 'Disabling full_page cache in Magento',
9
- task: async ({ magentoVersion }, task) => {
10
- const { cache_types } = await envPhpToJson(process.cwd(), { magentoVersion });
11
-
12
- if (cache_types.full_page !== 0) {
13
- return task.newListr(magentoTask('cache:disable full_page'));
14
- }
15
-
16
- task.skip();
17
- }
18
- });
19
-
20
- module.exports = disableFullPageCache;