@scandipwa/magento-scripts 1.16.0-alpha.4 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/lib/commands/cli.js +2 -4
  2. package/lib/commands/execute.js +28 -3
  3. package/lib/commands/start.js +37 -15
  4. package/lib/commands/status.js +2 -0
  5. package/lib/config/docker.js +65 -42
  6. package/lib/config/get-project-configuration.js +3 -1
  7. package/lib/config/index.js +10 -7
  8. package/lib/config/magento/required-php-extensions/index.js +29 -0
  9. package/lib/config/magento/required-php-extensions/magento-2.3.js +19 -0
  10. package/lib/config/magento/required-php-extensions/magento-2.4.js +29 -0
  11. package/lib/config/php/base-repo.js +3 -0
  12. package/lib/config/php/extensions/apcu.js +12 -0
  13. package/lib/config/php/extensions/bcmath.js +7 -0
  14. package/lib/config/php/extensions/curl.js +11 -0
  15. package/lib/config/php/extensions/gd.js +14 -0
  16. package/lib/config/php/extensions/index.js +18 -2
  17. package/lib/config/php/extensions/intl.js +10 -0
  18. package/lib/config/php/extensions/opcache.js +10 -0
  19. package/lib/config/php/extensions/pdo_mysql.js +7 -0
  20. package/lib/config/php/extensions/soap.js +10 -0
  21. package/lib/config/php/extensions/sodium.js +10 -0
  22. package/lib/config/php/extensions/xdebug.js +8 -5
  23. package/lib/config/php/extensions/xsl.js +10 -0
  24. package/lib/config/php/extensions/zip.js +10 -0
  25. package/lib/config/php/{releases → versions}/index.js +0 -0
  26. package/lib/config/php/versions/php-7.2.js +23 -0
  27. package/lib/config/php/versions/php-7.3.js +23 -0
  28. package/lib/config/php/versions/php-7.4.js +23 -0
  29. package/lib/config/php/versions/php-8.1.js +23 -0
  30. package/lib/config/php-config.js +8 -12
  31. package/lib/config/port-config.js +1 -5
  32. package/lib/config/templates/magentorc.template +3 -3
  33. package/lib/config/templates/php-fpm.template.conf +3 -3
  34. package/lib/config/templates/php.template.ini +12 -6
  35. package/lib/config/templates/ssl-terminator.template.conf +1 -1
  36. package/lib/config/templates/vscode-launch.template.json +3 -1
  37. package/lib/config/versions/magento-2.3.0.js +8 -2
  38. package/lib/config/versions/magento-2.3.1.js +8 -2
  39. package/lib/config/versions/magento-2.3.2-p1.js +44 -0
  40. package/lib/config/versions/magento-2.3.2-p2.js +8 -2
  41. package/lib/config/versions/magento-2.3.2.js +8 -2
  42. package/lib/config/versions/magento-2.3.3-p1.js +8 -2
  43. package/lib/config/versions/magento-2.3.3.js +8 -2
  44. package/lib/config/versions/magento-2.3.4-p1.js +44 -0
  45. package/lib/config/versions/magento-2.3.4-p2.js +8 -2
  46. package/lib/config/versions/magento-2.3.4.js +8 -2
  47. package/lib/config/versions/magento-2.3.5-p1.js +8 -2
  48. package/lib/config/versions/magento-2.3.5-p2.js +8 -2
  49. package/lib/config/versions/magento-2.3.5.js +8 -2
  50. package/lib/config/versions/magento-2.3.6-p1.js +8 -2
  51. package/lib/config/versions/magento-2.3.6.js +8 -2
  52. package/lib/config/versions/magento-2.3.7-p1.js +8 -2
  53. package/lib/config/versions/magento-2.3.7-p2.js +8 -2
  54. package/lib/config/versions/magento-2.3.7-p3.js +8 -2
  55. package/lib/config/versions/magento-2.3.7.js +8 -2
  56. package/lib/config/versions/magento-2.4.0-p1.js +9 -3
  57. package/lib/config/versions/magento-2.4.0.js +9 -3
  58. package/lib/config/versions/magento-2.4.1-p1.js +6 -5
  59. package/lib/config/versions/magento-2.4.1.js +9 -2
  60. package/lib/config/versions/magento-2.4.2-p1.js +6 -5
  61. package/lib/config/versions/magento-2.4.2-p2.js +6 -6
  62. package/lib/config/versions/magento-2.4.2.js +6 -6
  63. package/lib/config/versions/magento-2.4.3-p1.js +7 -7
  64. package/lib/config/versions/magento-2.4.3-p2.js +7 -7
  65. package/lib/config/versions/magento-2.4.3.js +7 -7
  66. package/lib/config/versions/magento-2.4.4.js +9 -2
  67. package/lib/tasks/cleanup.js +2 -2
  68. package/lib/tasks/composer/index.js +14 -104
  69. package/lib/tasks/docker/api.d.ts +71 -0
  70. package/lib/tasks/docker/api.js +30 -0
  71. package/lib/tasks/docker/containers/container-api.d.ts +128 -0
  72. package/lib/tasks/docker/containers/container-api.js +153 -0
  73. package/lib/tasks/docker/containers/index.js +19 -0
  74. package/lib/tasks/docker/containers/tasks.js +215 -0
  75. package/lib/tasks/docker/convert-legacy-volumes.js +7 -3
  76. package/lib/tasks/docker/image/image-api.d.ts +34 -0
  77. package/lib/tasks/docker/image/image-api.js +49 -0
  78. package/lib/tasks/docker/image/index.js +5 -0
  79. package/lib/tasks/docker/index.js +1 -13
  80. package/lib/tasks/docker/network/index.js +7 -0
  81. package/lib/tasks/docker/network/network-api.d.ts +103 -0
  82. package/lib/tasks/docker/network/network-api.js +99 -0
  83. package/lib/tasks/docker/{network.js → network/tasks.js} +17 -10
  84. package/lib/tasks/docker/project-image-builder.js +167 -0
  85. package/lib/tasks/docker/volumes.js +1 -1
  86. package/lib/tasks/file-system/create-nginx-config.js +2 -3
  87. package/lib/tasks/file-system/create-php-config.js +20 -5
  88. package/lib/tasks/file-system/create-php-fpm-config.js +8 -4
  89. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +41 -29
  90. package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -0
  91. package/lib/tasks/file-system/create-phpstorm-config/keys.js +15 -1
  92. package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +4 -1
  93. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +3 -3
  94. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +81 -0
  95. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/index.js +42 -0
  96. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/php-docker-settings-config.js +9 -0
  97. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/setup-php-docker-container-settings-config.js +66 -0
  98. package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +11 -9
  99. package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +2 -1
  100. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +15 -30
  101. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +24 -5
  102. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/mess-detector-project-configuration-config.js +50 -0
  103. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-code-sniffer-project-configuration-config.js +50 -0
  104. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-cs-fixer-project-configuration-config.js +50 -0
  105. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +15 -15
  106. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +29 -3
  107. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-stan-project-configuration-config.js.js +50 -0
  108. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +42 -0
  109. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/psalm-project-configuration-config.js.js +50 -0
  110. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +0 -2
  111. package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -2
  112. package/lib/tasks/file-system/create-vscode-config.js +57 -42
  113. package/lib/tasks/file-system/index.js +2 -1
  114. package/lib/tasks/link.js +1 -2
  115. package/lib/tasks/magento/install-magento-project.js +39 -64
  116. package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +4 -4
  117. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +6 -2
  118. package/lib/tasks/magento/setup-magento/create-admin.js +5 -6
  119. package/lib/tasks/magento/setup-magento/disable-2fa.js +3 -5
  120. package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +3 -4
  121. package/lib/tasks/magento/setup-magento/index.js +1 -3
  122. package/lib/tasks/magento/setup-magento/install-magento.js +57 -11
  123. package/lib/tasks/magento/setup-magento/migrate-database.js +12 -11
  124. package/lib/tasks/magento/setup-magento/set-deployment-mode.js +4 -4
  125. package/lib/tasks/magento/setup-magento/varnish-config.js +7 -5
  126. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +128 -3
  127. package/lib/tasks/mysql/connect-to-mysql.js +44 -19
  128. package/lib/tasks/mysql/import-dump-to-mysql.js +161 -25
  129. package/lib/tasks/php/php-container.js +108 -0
  130. package/lib/tasks/php/update-env-php.js +35 -19
  131. package/lib/tasks/php/update-env.php +61 -56
  132. package/lib/tasks/php/working_health_check.php +85 -0
  133. package/lib/tasks/requirements/{composer.js → composer-credentials.js} +3 -1
  134. package/lib/tasks/requirements/docker/index.js +15 -12
  135. package/lib/tasks/requirements/docker/performance.js +54 -0
  136. package/lib/tasks/requirements/docker/version.js +8 -8
  137. package/lib/tasks/requirements/index.js +7 -10
  138. package/lib/tasks/requirements/php-version.js +8 -116
  139. package/lib/tasks/requirements/platform.js +12 -25
  140. package/lib/tasks/start.js +41 -48
  141. package/lib/tasks/status/index.js +4 -10
  142. package/lib/tasks/stop.js +0 -2
  143. package/lib/tasks/theme/install-theme.js +1 -1
  144. package/lib/tasks/theme/symlink-theme.js +2 -3
  145. package/lib/util/config-php-json.js +13 -4
  146. package/lib/util/dockerfile-builder/build-instructions.js +197 -0
  147. package/lib/util/dockerfile-builder/index.js +276 -0
  148. package/lib/util/dockerfile-builder/types.d.ts +123 -0
  149. package/lib/util/env-php-json.js +10 -6
  150. package/lib/util/exec-async-command.js +3 -9
  151. package/lib/util/macos-version.js +20 -0
  152. package/lib/util/magento-task.js +3 -4
  153. package/lib/util/nginx-logs-parser.js +122 -0
  154. package/lib/util/php-task.js +3 -6
  155. package/lib/util/prefix.js +1 -1
  156. package/lib/util/run-composer.js +6 -14
  157. package/lib/util/run-container-image.js +17 -0
  158. package/lib/util/run-magento.js +6 -14
  159. package/lib/util/run-php.js +6 -17
  160. package/package.json +9 -9
  161. package/typings/context.d.ts +3 -9
  162. package/typings/index.d.ts +38 -57
  163. package/lib/config/composer.js +0 -11
  164. package/lib/config/php/extensions/libsodium.js +0 -36
  165. package/lib/config/php/releases/php-7.2.js +0 -25
  166. package/lib/config/php/releases/php-7.3.js +0 -25
  167. package/lib/config/php/releases/php-7.4.js +0 -23
  168. package/lib/config/php/releases/php-8.1.js +0 -25
  169. package/lib/config/phpbrew.js +0 -12
  170. package/lib/tasks/composer/install-prestissimo.js +0 -88
  171. package/lib/tasks/docker/containers.js +0 -231
  172. package/lib/tasks/php/bundled-extensions.js +0 -27
  173. package/lib/tasks/php/compile-options.js +0 -56
  174. package/lib/tasks/php/compile.js +0 -55
  175. package/lib/tasks/php/configure.js +0 -89
  176. package/lib/tasks/php/extensions/disable.js +0 -49
  177. package/lib/tasks/php/extensions/enable.js +0 -52
  178. package/lib/tasks/php/extensions/index.js +0 -80
  179. package/lib/tasks/php/extensions/install.js +0 -54
  180. package/lib/tasks/php/index.js +0 -79
  181. package/lib/tasks/php/install-sodium.js +0 -93
  182. package/lib/tasks/php/update-phpbrew.js +0 -45
  183. package/lib/tasks/php/validate-php.js +0 -67
  184. package/lib/tasks/php-fpm/get-process-id.js +0 -14
  185. package/lib/tasks/php-fpm/index.js +0 -4
  186. package/lib/tasks/php-fpm/start-php-fpm.js +0 -49
  187. package/lib/tasks/php-fpm/stop-php-fpm.js +0 -48
  188. package/lib/tasks/requirements/phpbrew/index.js +0 -61
  189. package/lib/tasks/requirements/phpbrew/install.js +0 -159
  190. package/lib/tasks/requirements/phpbrew/version.js +0 -28
@@ -1,8 +1,9 @@
1
- const { execAsyncSpawn } = require('./exec-async-command');
2
- const { getConfigFromMagentoVersion, defaultConfiguration, magento } = require('../config');
3
1
  const UnknownError = require('../errors/unknown-error');
2
+ const { runPHPContainerCommand } = require('../tasks/php/php-container');
4
3
  /**
5
4
  * Execute magento command
5
+ *
6
+ * @param {import('../../typings/context').ListrContext} ctx
6
7
  * @param {String} command magento command
7
8
  * @param {Object} options
8
9
  * @param {Boolean} options.logOutput Log output to console using logger
@@ -10,20 +11,11 @@ const UnknownError = require('../errors/unknown-error');
10
11
  * @param {String} options.cwd
11
12
  * @param {() => {}} options.callback
12
13
  * @param {Boolean} options.throwNonZeroCode Throw if command return non 0 code.
13
- * @param {String} options.magentoVersion Magento version for config
14
14
  */
15
- const runMagentoCommand = async (command, options = {}) => {
16
- const {
17
- throwNonZeroCode = true,
18
- magentoVersion = defaultConfiguration.name
19
- } = options;
20
- const {
21
- php,
22
- baseConfig: { magentoDir }
23
- } = await getConfigFromMagentoVersion(magentoVersion);
24
- const { code, result } = await execAsyncSpawn(`${php.binPath} -c ${php.iniPath} ${magento.binPath} ${command}`, {
15
+ const runMagentoCommand = async (ctx, command, options = {}) => {
16
+ const { throwNonZeroCode = true } = options;
17
+ const { code, result } = await runPHPContainerCommand(ctx, `bin/magento ${command}`, {
25
18
  ...options,
26
- cwd: magentoDir,
27
19
  withCode: true
28
20
  });
29
21
 
@@ -1,34 +1,23 @@
1
- const { execAsyncSpawn } = require('./exec-async-command');
2
- const { getConfigFromMagentoVersion, defaultConfiguration } = require('../config');
3
1
  const UnknownError = require('../errors/unknown-error');
2
+ const { runPHPContainerCommand } = require('../tasks/php/php-container');
4
3
  /**
5
4
  * Execute PHP code
6
- * @param {String} command magento command
5
+ * @param {import('../../typings/context').ListrContext} ctx
6
+ * @param {String} command php command
7
7
  * @param {Object} options
8
8
  * @param {Boolean} options.logOutput Log output to console using logger
9
9
  * @param {Boolean} options.withCode
10
10
  * @param {String} options.cwd
11
11
  * @param {() => {}} options.callback
12
12
  * @param {Boolean} options.throwNonZeroCode Throw if command return non 0 code.
13
- * @param {String} options.magentoVersion Magento version for config
14
13
  * @param {Record<string, string>} options.env Environment variables
15
14
  * @param {Boolean} options.useRosettaOnMac Use Rosetta 2 on MacOS
16
15
  */
17
- const runPhpCode = async (command, options = {}) => {
16
+ const runPhpCode = async (ctx, command, options = {}) => {
18
17
  const {
19
- throwNonZeroCode = true,
20
- magentoVersion = defaultConfiguration.magentoVersion
18
+ throwNonZeroCode = true
21
19
  } = options;
22
- const { php } = await getConfigFromMagentoVersion(magentoVersion);
23
- let spawnCommand = `${php.binPath} -c ${php.iniPath} ${command}`;
24
- if (options.env && Object.keys(options.env).length > 0) {
25
- const env = Object.entries(options.env).map(([key, value]) => `${key}=${value}`).join(' ');
26
- spawnCommand = `${env} ${spawnCommand}`;
27
- }
28
- if (options.useRosettaOnMac) {
29
- spawnCommand = `arch -x86_64 bash -c '${spawnCommand}'`;
30
- }
31
- const { code, result } = await execAsyncSpawn(spawnCommand, {
20
+ const { code, result } = await runPHPContainerCommand(ctx, `php ${command}`, {
32
21
  ...options,
33
22
  withCode: true
34
23
  });
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.16.0-alpha.4",
6
+ "version": "2.0.0-alpha.0",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -23,22 +23,22 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@scandipwa/scandipwa-dev-utils": "0.1.13",
26
- "conf": "10.1.1",
26
+ "conf": "10.1.2",
27
27
  "enquirer": "2.3.6",
28
28
  "eta": "1.12.3",
29
- "fast-xml-parser": "^4.0.7",
29
+ "fast-xml-parser": "^4.0.9",
30
30
  "hjson": "^3.2.2",
31
31
  "is-installed-globally": "0.4.0",
32
32
  "joi": "17.6.0",
33
33
  "listr2": "4.0.5",
34
34
  "macos-version": "5.2.1",
35
35
  "merge-files": "0.1.2",
36
- "mysql2": "2.3.2",
37
- "node-ssh": "12.0.0",
38
- "semver": "7.3.5",
36
+ "mysql2": "2.3.3",
37
+ "node-ssh": "12.0.5",
38
+ "semver": "7.3.7",
39
39
  "smol-request": "^2.1.2",
40
- "systeminformation": "5.11.7",
41
- "yargs": "17.3.1"
40
+ "systeminformation": "5.12.1",
41
+ "yargs": "17.5.1"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
@@ -53,5 +53,5 @@
53
53
  "mysql",
54
54
  "scandipwa"
55
55
  ],
56
- "gitHead": "987f793ba2d0bb3bcabea54d3b996a5204222738"
56
+ "gitHead": "a63454a3015891e4ebe5a7e84a0c88989a1d0edc"
57
57
  }
@@ -31,12 +31,8 @@ export interface ListrContext {
31
31
  edition?: 'community' | 'enterprise'
32
32
  config: {
33
33
  php: {
34
- binPath: string
35
- iniPath: string
36
34
  iniTemplatePath: string
37
- fpmBinPath: string
38
35
  fpmConfPath: string
39
- fpmPidFilePath: string
40
36
  extensions: PHPExtensions
41
37
  version: string
42
38
  }
@@ -57,7 +53,7 @@ export interface ListrContext {
57
53
  o: string
58
54
  }
59
55
  }>
60
- getContainers(): Record<'nginx' | 'redis' | 'mysql' | 'elasticsearch' | 'varnish', {
56
+ getContainers(): Record<'php' | 'sslTerminator' | 'nginx' | 'redis' | 'mysql' | 'elasticsearch' | 'varnish', {
61
57
  _: string
62
58
  ports: string[]
63
59
  healthCheck: {
@@ -70,10 +66,7 @@ export interface ListrContext {
70
66
  securityOptions: string[]
71
67
  network: string
72
68
  image: string
73
- imageDetails: {
74
- name: string
75
- tag: string
76
- }
69
+ debugImage?: string
77
70
  name: string
78
71
  command: string
79
72
  connectCommand: string[]
@@ -84,6 +77,7 @@ export interface ListrContext {
84
77
  magentoDir: string
85
78
  templateDir: string
86
79
  cacheDir: string
80
+ containerMagentoDir: string
87
81
  }
88
82
  overridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
89
83
  userConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
@@ -1,5 +1,3 @@
1
- import { ListrTaskWrapper } from 'listr2';
2
-
3
1
  import { ListrContext } from './context';
4
2
 
5
3
  /* eslint-disable no-use-before-define */
@@ -42,80 +40,56 @@ export interface VarnishConfiguration extends ServiceWithVersion {
42
40
  configTemplate: string
43
41
  }
44
42
 
45
- export interface PHPExtension extends Record<string, unknown> {
46
- version?: string
43
+ export interface PHPExtensionInstallationInstruction {
47
44
  /**
48
- * Name of the extension loaded to PHP.
49
- *
50
- * @example `libsodium` extension is using `sodium` extensionName because it is loaded into PHP as `sodium` extension
51
- * and dynamic library that it requires called `sodium`
45
+ * Alternative name for extension
52
46
  *
53
- * ```
54
- * {
55
- * php: {
56
- * extensions: {
57
- * libsodium: {
58
- * extensionName: 'sodium'
59
- * }
60
- * }
61
- * }
62
- * }
47
+ * @example ```js
48
+ * alternativeName: ['Zend OPcache']
63
49
  * ```
64
50
  */
65
- linuxOptions?: string
66
- macosOptions?: string
67
- extensionName?: string
68
- hooks?: {
69
- preEnable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
70
- postEnable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
71
- preDisable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
72
- postDisable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
73
- preInstall?: (config: CMAConfiguration['configuration']) => Promise<void> | void
74
- postInstall?: (config: CMAConfiguration['configuration']) => Promise<void> | void
75
- }
51
+ alternativeName?: string[]
76
52
  /**
77
- * Allow to define custom logic to install extension
53
+ * Command to install extension
54
+ *
55
+ * @example ```bash
56
+ * docker-php-ext-install bcmath
57
+ * ```
58
+ * @example ```bash
59
+ * pecl install xdebug && docker-php-ext-enable xdebug
60
+ * ```
78
61
  */
79
- install?: (
80
- ctx: ListrContext,
81
- task: ListrTaskWrapper<ListrContext, any>
82
- ) => Promise<void> | void
62
+ command: (arg0: (Omit<PHPExtensionInstallationInstruction, 'command'> & { ctx: ListrContext})) => string | string
83
63
 
84
64
  /**
85
- * Allow to define custom logic to enable an extension
65
+ * System dependencies required by the extension
66
+ *
67
+ * @example ```js
68
+ * dependencies: ['icu-dev']
69
+ * ```
86
70
  */
87
- enable?: (
88
- ctx: ListrContext,
89
- task: ListrTaskWrapper<ListrContext, any>
90
- ) => Promise<void> | void
71
+ dependencies?: string[]
91
72
 
92
73
  /**
93
- * Allow to define custom logic to disable an extension
74
+ * Extension version (if supported)
94
75
  */
95
- disable?: (
96
- ctx: ListrContext,
97
- task: ListrTaskWrapper<ListrContext, any>
98
- ) => Promise<void> | void
76
+ version?: string
99
77
  }
100
78
 
101
79
  export interface PHPExtensions {
102
- gd: PHPExtension
103
- intl: PHPExtension
104
- zlib: PHPExtension
105
- openssl: PHPExtension
106
- sockets: PHPExtension
107
- simpleXML: PHPExtension
108
- xdebug: PHPExtension
109
- fileinfo: PHPExtension
110
- libsodium: PHPExtension
111
- [key: string]: PHPExtension
80
+ [key: string]: PHPExtensionInstallationInstruction
112
81
  }
113
82
 
114
83
  export interface PHPConfiguration {
115
84
  /**
116
- * PHP version
85
+ * Base image with tag
117
86
  */
118
- version: string
87
+ baseImage?: string
88
+
89
+ /**
90
+ * Image with XDebug enabled
91
+ */
92
+ debugImage?: string
119
93
 
120
94
  /**
121
95
  * Configuration file template location
@@ -124,10 +98,17 @@ export interface PHPConfiguration {
124
98
  */
125
99
  configTemplate: string
126
100
 
101
+ /**
102
+ * PHP-FPM configuration file template location
103
+ *
104
+ * @example ./my-php-fpm-template.conf
105
+ */
106
+ fpmConfigTemplate: string
107
+
127
108
  /**
128
109
  * Extensions for PHP
129
110
  */
130
- extensions: PHPExtensions & Record<string, PHPExtension>
111
+ extensions: PHPExtensions
131
112
 
132
113
  /**
133
114
  * Disabled extension list
@@ -1,11 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = ({ composer }, config) => {
4
- const { cacheDir } = config;
5
-
6
- return {
7
- dirPath: path.join(cacheDir, 'composer'),
8
- binPath: path.join(cacheDir, 'composer', 'composer.phar'),
9
- version: composer.version
10
- };
11
- };
@@ -1,36 +0,0 @@
1
- const path = require('path');
2
- const fs = require('fs');
3
- const pathExists = require('../../../util/path-exists');
4
- const UnknownError = require('../../../errors/unknown-error');
5
- const phpbrewConfig = require('../../phpbrew');
6
-
7
- /**
8
- * @type {import('../../../../typings/index').PHPExtension}
9
- */
10
- module.exports = {
11
- extensionName: 'sodium',
12
- hooks: {
13
- postInstall: async ({ php }) => {
14
- const sodiumDynamicLibraryPath = path.join(
15
- phpbrewConfig.phpPath,
16
- `php-${php.version}`,
17
- 'var',
18
- 'db',
19
- 'libsodium.ini'
20
- );
21
-
22
- if (!await pathExists(sodiumDynamicLibraryPath)) {
23
- throw new UnknownError(`libsodium dynamic library file configuration not found: ${sodiumDynamicLibraryPath}`);
24
- }
25
- const fileContent = await fs.promises.readFile(sodiumDynamicLibraryPath, 'utf-8');
26
-
27
- if (/^extension=libsodium\.so$/.test(fileContent.trim())) {
28
- await fs.promises.writeFile(
29
- sodiumDynamicLibraryPath,
30
- 'extension=sodium.so\n',
31
- 'utf-8'
32
- );
33
- }
34
- }
35
- }
36
- };
@@ -1,25 +0,0 @@
1
- const path = require('path');
2
- const { xdebug } = require('../extensions');
3
-
4
- const php72 = ({ templateDir, additionalExtensions = {} }) => ({
5
- version: '7.2.34',
6
- configTemplate: path.join(templateDir || '', 'php.template.ini'),
7
- extensions: {
8
- gd: {
9
- macosOptions: '--with-zlib-dir=$(brew --prefix zlib) --with-freetype-dir=$(brew --prefix freetype)'
10
- },
11
- intl: {},
12
- zlib: {},
13
- openssl: {},
14
- sockets: {},
15
- SimpleXML: {},
16
- xdebug,
17
- apcu: {},
18
- opcache: {
19
- extensionName: 'Zend OPcache'
20
- },
21
- ...additionalExtensions
22
- }
23
- });
24
-
25
- module.exports = php72;
@@ -1,25 +0,0 @@
1
- const path = require('path');
2
- const { xdebug } = require('../extensions');
3
-
4
- const php73 = ({ templateDir, additionalExtensions = {} }) => ({
5
- version: '7.3.33',
6
- configTemplate: path.join(templateDir || '', 'php.template.ini'),
7
- extensions: {
8
- gd: {
9
- macosOptions: '--with-zlib-dir=$(brew --prefix zlib) --with-freetype-dir=$(brew --prefix freetype)'
10
- },
11
- intl: {},
12
- zlib: {},
13
- openssl: {},
14
- sockets: {},
15
- SimpleXML: {},
16
- xdebug,
17
- apcu: {},
18
- opcache: {
19
- extensionName: 'Zend OPcache'
20
- },
21
- ...additionalExtensions
22
- }
23
- });
24
-
25
- module.exports = php73;
@@ -1,23 +0,0 @@
1
- const path = require('path');
2
- const { xdebug } = require('../extensions');
3
-
4
- const php74 = ({ templateDir, additionalExtensions = {} } = {}) => ({
5
- version: '7.4.30',
6
- configTemplate: path.join(templateDir || '', 'php.template.ini'),
7
- extensions: {
8
- gd: {},
9
- intl: {},
10
- zlib: {},
11
- openssl: {},
12
- sockets: {},
13
- SimpleXML: {},
14
- xdebug,
15
- apcu: {},
16
- opcache: {
17
- extensionName: 'Zend OPcache'
18
- },
19
- ...additionalExtensions
20
- }
21
- });
22
-
23
- module.exports = php74;
@@ -1,25 +0,0 @@
1
- const path = require('path');
2
- const { libsodium, xdebug } = require('../extensions');
3
-
4
- const php81 = ({ templateDir, additionalExtensions = {} } = {}) => ({
5
- version: '8.1.7',
6
- configTemplate: path.join(templateDir || '', 'php.template.ini'),
7
- extensions: {
8
- gd: {},
9
- intl: {},
10
- zlib: {},
11
- openssl: {},
12
- sockets: {},
13
- SimpleXML: {},
14
- libsodium,
15
- fileinfo: {},
16
- xdebug,
17
- apcu: {},
18
- opcache: {
19
- extensionName: 'Zend OPcache'
20
- },
21
- ...additionalExtensions
22
- }
23
- });
24
-
25
- module.exports = php81;
@@ -1,12 +0,0 @@
1
- const os = require('os');
2
- const path = require('path');
3
-
4
- const homePath = process.env.PHPBREW_HOME || path.join(os.homedir(), '.phpbrew');
5
- const phpbrewConfig = {
6
- homePath,
7
- buildPath: path.join(homePath, 'build'),
8
- phpPath: path.join(homePath, 'php'),
9
- bashrcPath: path.join(homePath, 'bashrc')
10
- };
11
-
12
- module.exports = phpbrewConfig;
@@ -1,88 +0,0 @@
1
- const logger = require('@scandipwa/scandipwa-dev-utils/logger');
2
- const os = require('os');
3
- const path = require('path');
4
- const fs = require('fs');
5
- const semver = require('semver');
6
- const { baseConfig } = require('../../config');
7
- const getJsonfileData = require('../../util/get-jsonfile-data');
8
- const pathExists = require('../../util/path-exists');
9
- const runComposerCommand = require('../../util/run-composer');
10
-
11
- const globalComposerJsonPath = path.join(os.homedir(), '.config', 'composer', 'composer.json');
12
- const localComposerJsonPath = path.join(baseConfig.magentoDir, 'composer.json');
13
- const prestissimoPluginName = 'hirak/prestissimo';
14
-
15
- /**
16
- * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
17
- */
18
- const prestissimoInstall = () => ({
19
- title: 'Installing Prestissimo',
20
- task: async (ctx, task) => {
21
- const { magentoVersion, composerVersion } = ctx;
22
-
23
- if (semver.satisfies(composerVersion, '^2')) {
24
- if (await pathExists(globalComposerJsonPath) && semver.satisfies(composerVersion, '^2.2.0')) {
25
- const globalComposerJsonData = await getJsonfileData(globalComposerJsonPath);
26
- const hasPrestissimoInstalled = globalComposerJsonData
27
- && globalComposerJsonData.require
28
- && !!globalComposerJsonData.require[prestissimoPluginName];
29
-
30
- if (await pathExists(localComposerJsonPath)) {
31
- const localComposerJsonData = await getJsonfileData(localComposerJsonPath);
32
-
33
- if (
34
- hasPrestissimoInstalled
35
- && localComposerJsonData
36
- && localComposerJsonData.config
37
- && localComposerJsonData.config['allow-plugins']
38
- && typeof localComposerJsonData.config['allow-plugins'][prestissimoPluginName] !== 'boolean'
39
- ) {
40
- const disableConfirmation = await task.prompt({
41
- type: 'Select',
42
- message: `We noticed that you have Composer ${ctx.composerVersion}, but you have ${logger.style.code(prestissimoPluginName)} installed, which is used only in Composer 1.
43
- Would you like to disable it in your project?`,
44
- choices: [
45
- {
46
- name: 'disable',
47
- message: 'Disable it, thanks'
48
- },
49
- {
50
- name: 'skip',
51
- message: 'Skip this step'
52
- }
53
- ]
54
- });
55
-
56
- if (disableConfirmation === 'disable') {
57
- localComposerJsonData.config['allow-plugins'][prestissimoPluginName] = false;
58
- await fs.promises.writeFile(localComposerJsonPath, JSON.stringify(localComposerJsonData, null, 4), 'utf-8');
59
- }
60
- }
61
- }
62
- }
63
- task.skip();
64
- return;
65
- }
66
- const { code } = await runComposerCommand(`global show ${prestissimoPluginName}`, {
67
- throwNonZeroCode: false,
68
- magentoVersion
69
- });
70
-
71
- if (code === 0) {
72
- task.skip();
73
- return;
74
- }
75
-
76
- await runComposerCommand(`global require ${prestissimoPluginName}`, {
77
- magentoVersion,
78
- callback: (t) => {
79
- task.output = t;
80
- }
81
- });
82
- },
83
- options: {
84
- bottomBar: 10
85
- }
86
- });
87
-
88
- module.exports = prestissimoInstall;