@scandipwa/magento-scripts 1.11.3 → 1.12.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 (97) hide show
  1. package/.eslintrc +0 -0
  2. package/LICENSE +0 -0
  3. package/lib/config/dependencies-for-platforms.js +0 -1
  4. package/lib/config/index.js +4 -2
  5. package/lib/config/{php.js → php-config.js} +0 -0
  6. package/lib/config/phpbrew.js +12 -0
  7. package/lib/config/phpstorm/debug-config.js +46 -0
  8. package/lib/config/save-config.js +0 -0
  9. package/lib/config/templates/Project_Default.template.xml +13 -0
  10. package/lib/config/templates/cma-config.template.js +0 -0
  11. package/lib/config/templates/dataSources.local.template.xml +11 -0
  12. package/lib/config/templates/dataSources.template.xml +12 -0
  13. package/lib/config/templates/magentorc.template +0 -0
  14. package/lib/config/templates/php-fpm.template.conf +0 -0
  15. package/lib/config/templates/php.template.xml +14 -0
  16. package/lib/config/templates/vscode-launch.template.json +15 -0
  17. package/lib/config/templates/workspace.template.xml +20 -0
  18. package/lib/config/versions/magento-2.3.0.js +1 -1
  19. package/lib/config/versions/magento-2.3.1.js +1 -1
  20. package/lib/config/versions/magento-2.3.2-p2.js +1 -1
  21. package/lib/config/versions/magento-2.3.2.js +1 -1
  22. package/lib/config/versions/magento-2.3.3-p1.js +1 -1
  23. package/lib/config/versions/magento-2.3.3.js +1 -1
  24. package/lib/config/versions/magento-2.3.4-p2.js +1 -1
  25. package/lib/config/versions/magento-2.3.4.js +1 -1
  26. package/lib/config/versions/magento-2.3.5-p1.js +1 -1
  27. package/lib/config/versions/magento-2.3.5-p2.js +1 -1
  28. package/lib/config/versions/magento-2.3.5.js +1 -1
  29. package/lib/config/versions/magento-2.3.6-p1.js +1 -1
  30. package/lib/config/versions/magento-2.3.6.js +1 -1
  31. package/lib/config/versions/magento-2.3.7-p1.js +3 -3
  32. package/lib/config/versions/magento-2.3.7.js +3 -3
  33. package/lib/config/versions/magento-2.4.0-p1.js +2 -2
  34. package/lib/config/versions/magento-2.4.0.js +2 -2
  35. package/lib/config/versions/magento-2.4.1-p1.js +2 -2
  36. package/lib/config/versions/magento-2.4.1.js +2 -2
  37. package/lib/config/versions/magento-2.4.2-p1.js +3 -3
  38. package/lib/config/versions/magento-2.4.2-p2.js +3 -3
  39. package/lib/config/versions/magento-2.4.2.js +3 -3
  40. package/lib/config/versions/magento-2.4.3-p1.js +3 -3
  41. package/lib/config/versions/magento-2.4.3.js +3 -3
  42. package/lib/tasks/cache/index.js +0 -0
  43. package/lib/tasks/cli/index.js +0 -0
  44. package/lib/tasks/composer/index.js +13 -6
  45. package/lib/tasks/docker/index.js +1 -1
  46. package/lib/tasks/docker/network.js +2 -2
  47. package/lib/tasks/execute/index.js +0 -0
  48. package/lib/tasks/file-system/create-php-storm-config.js +82 -0
  49. package/lib/tasks/file-system/create-vscode-config.js +111 -0
  50. package/lib/tasks/file-system/index.js +5 -1
  51. package/lib/tasks/magento/index.js +0 -0
  52. package/lib/tasks/magento/setup-magento/adjust-magento-configuration.js +0 -0
  53. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +0 -0
  54. package/lib/tasks/magento/setup-magento/create-admin.js +0 -0
  55. package/lib/tasks/magento/setup-magento/delete-admin-users.js +0 -0
  56. package/lib/tasks/magento/setup-magento/flush-redis-config.js +0 -0
  57. package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +0 -0
  58. package/lib/tasks/magento/setup-magento/set-base-url.js +0 -0
  59. package/lib/tasks/magento/setup-magento/set-deployment-mode.js +1 -1
  60. package/lib/tasks/magento/setup-magento/set-url-rewrite.js +0 -0
  61. package/lib/tasks/magento/setup-magento/waiting-for-redis.js +1 -1
  62. package/lib/tasks/mysql/index.js +0 -0
  63. package/lib/tasks/php/compile.js +2 -2
  64. package/lib/tasks/php/configure.js +80 -59
  65. package/lib/tasks/php/extensions/disable.js +41 -0
  66. package/lib/tasks/php/extensions/enable.js +44 -0
  67. package/lib/tasks/php/extensions/install.js +47 -0
  68. package/lib/tasks/php/update-phpbrew.js +0 -0
  69. package/lib/tasks/php-fpm/index.js +0 -0
  70. package/lib/tasks/php-fpm/start-php-fpm.js +3 -3
  71. package/lib/tasks/php-fpm/stop-php-fpm.js +2 -2
  72. package/lib/tasks/requirements/composer.js +1 -1
  73. package/lib/tasks/requirements/dependency/arch.js +0 -0
  74. package/lib/tasks/requirements/dependency/centos.js +2 -2
  75. package/lib/tasks/requirements/dependency/fedora.js +0 -0
  76. package/lib/tasks/requirements/dependency/index.js +1 -4
  77. package/lib/tasks/requirements/dependency/mac.js +0 -0
  78. package/lib/tasks/requirements/dependency/ubuntu.js +0 -0
  79. package/lib/tasks/requirements/docker/index.js +2 -2
  80. package/lib/util/clean-object.js +0 -0
  81. package/lib/util/config-file-validator.js +7 -1
  82. package/lib/util/download-file.js +0 -0
  83. package/lib/util/ip.js +0 -0
  84. package/lib/util/match-filesystem.js +0 -0
  85. package/lib/util/move-file.js +0 -0
  86. package/lib/util/path-exists-sync.js +0 -0
  87. package/lib/util/portscanner.js +0 -0
  88. package/lib/util/run-composer.js +0 -0
  89. package/lib/util/run-magento.js +0 -0
  90. package/lib/util/run-php.js +0 -0
  91. package/lib/util/set-config.js +0 -0
  92. package/lib/util/sleep.js +0 -0
  93. package/lib/util/wait-for-it.js +0 -0
  94. package/lib/util/wait-for-logs.js +0 -0
  95. package/package.json +3 -2
  96. package/typings/context.d.ts +2 -2
  97. package/typings/index.d.ts +36 -2
@@ -0,0 +1,47 @@
1
+ /* eslint-disable max-len */
2
+ const macosVersion = require('macos-version');
3
+ const { execAsyncSpawn } = require('../../../util/exec-async-command');
4
+
5
+ /**
6
+ * @param {String} extensionName
7
+ * @param {import('../../../../typings/index').PHPExtension} extensionOptions
8
+ * @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
9
+ */
10
+ const installExtension = (extensionName, extensionOptions) => ({
11
+ title: `Installing ${extensionName} extension`,
12
+ task: async (ctx, task) => {
13
+ const {
14
+ config,
15
+ config: { php }
16
+ } = ctx;
17
+ const { hooks } = extensionOptions;
18
+
19
+ if (extensionOptions.install) {
20
+ await Promise.resolve(extensionOptions.install(ctx, task));
21
+ } else {
22
+ const options = macosVersion.isMacOS ? extensionOptions.macosOptions : extensionOptions.linuxOptions;
23
+
24
+ if (hooks && hooks.preInstall) {
25
+ await Promise.resolve(hooks.preInstall(config));
26
+ }
27
+
28
+ await execAsyncSpawn(`source ~/.phpbrew/bashrc && \
29
+ phpbrew use ${ php.version } && \
30
+ phpbrew ext install ${ extensionName }${ extensionOptions.version ? ` ${extensionOptions.version}` : ''}${ options ? ` -- ${ options }` : ''}`,
31
+ {
32
+ callback: (t) => {
33
+ task.output = t;
34
+ }
35
+ });
36
+
37
+ if (hooks && hooks.postInstall) {
38
+ await Promise.resolve(hooks.postInstall(config));
39
+ }
40
+ }
41
+ },
42
+ options: {
43
+ bottomBar: 10
44
+ }
45
+ });
46
+
47
+ module.exports = installExtension;
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  const { execAsyncSpawn } = require('../../util/exec-async-command');
2
- const getPhpConfig = require('../../config/php');
2
+ const getPhpConfig = require('../../config/php-config');
3
3
  const { getBaseConfig } = require('../../config/index');
4
4
  const getProcessId = require('./get-process-id');
5
5
 
@@ -7,7 +7,7 @@ const getProcessId = require('./get-process-id');
7
7
  * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
8
8
  */
9
9
  const startPhpFpm = () => ({
10
- title: 'Starting php-fpm',
10
+ title: 'Starting PHP-FPM',
11
11
  task: async ({ config: { overridenConfiguration }, projectPath }, task) => {
12
12
  const php = getPhpConfig(overridenConfiguration.configuration, getBaseConfig(projectPath));
13
13
  const processId = await getProcessId(php.fpmPidFilePath);
@@ -35,7 +35,7 @@ const startPhpFpm = () => ({
35
35
  }
36
36
  );
37
37
  } catch (e) {
38
- throw new Error(`Error during php-fpm start\n\n${e}`);
38
+ throw new Error(`Error during PHP-FPM start\n\n${e}`);
39
39
  }
40
40
  },
41
41
  options: {
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const { execAsyncSpawn } = require('../../util/exec-async-command');
3
3
  const pathExists = require('../../util/path-exists');
4
- const getPhpConfig = require('../../config/php');
4
+ const getPhpConfig = require('../../config/php-config');
5
5
  const { getBaseConfig } = require('../../config/index');
6
6
  const getProcessId = require('./get-process-id');
7
7
 
@@ -9,7 +9,7 @@ const getProcessId = require('./get-process-id');
9
9
  * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
10
10
  */
11
11
  const stopPhpFpmTask = () => ({
12
- title: 'Stopping php-fpm',
12
+ title: 'Stopping PHP-FPM',
13
13
  task: async ({ config: { overridenConfiguration }, projectPath }, task) => {
14
14
  const php = getPhpConfig(overridenConfiguration.configuration, getBaseConfig(projectPath));
15
15
  const processId = await getProcessId(php.fpmPidFilePath);
@@ -4,7 +4,7 @@ const logger = require('@scandipwa/scandipwa-dev-utils/logger');
4
4
  * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
5
5
  */
6
6
  const checkComposer = () => ({
7
- title: 'Checking composer environmental variables',
7
+ title: 'Checking Composer environmental variables',
8
8
  task: () => {
9
9
  try {
10
10
  if (!process.env.COMPOSER_AUTH) {
File without changes
@@ -5,7 +5,7 @@ const installDependenciesTask = require('../../../util/install-dependencies-task
5
5
  /**
6
6
  * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
7
7
  */
8
- const fedoraDependenciesCheck = () => ({
8
+ const centosDependenciesCheck = () => ({
9
9
  title: 'Checking CentOS dependencies',
10
10
  task: async (ctx, task) => {
11
11
  const installedDependencies = (await execAsyncSpawn('yum list installed')).split('\n')
@@ -32,4 +32,4 @@ const fedoraDependenciesCheck = () => ({
32
32
  }
33
33
  });
34
34
 
35
- module.exports = fedoraDependenciesCheck;
35
+ module.exports = centosDependenciesCheck;
File without changes
@@ -1,4 +1,3 @@
1
- const os = require('os');
2
1
  const osPlatform = require('../../../util/os-platform');
3
2
  const archDependenciesCheck = require('./arch');
4
3
  const fedoraDependenciesCheck = require('./fedora');
@@ -7,9 +6,7 @@ const ubuntuDependenciesCheck = require('./ubuntu');
7
6
  const macDependenciesCheck = require('./mac');
8
7
 
9
8
  const dependencyCheck = async () => {
10
- const currentPlatform = os.platform();
11
-
12
- if (currentPlatform === 'darwin') {
9
+ if (process.platform === 'darwin') {
13
10
  return macDependenciesCheck();
14
11
  }
15
12
 
File without changes
File without changes
@@ -9,7 +9,7 @@ const getDockerVersion = require('./version');
9
9
  * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
10
10
  */
11
11
  const checkDocker = () => ({
12
- title: 'Checking docker',
12
+ title: 'Checking Docker',
13
13
  task: async (ctx, task) => {
14
14
  const { code } = await execAsyncSpawn('docker -v', {
15
15
  withCode: true
@@ -63,7 +63,7 @@ ${ logger.style.link('https://docs.create-magento-app.com/getting-started/prereq
63
63
  getDockerVersion(),
64
64
  {
65
65
  task: (ctx) => {
66
- task.title = `Using docker version ${ctx.dockerVersion}`;
66
+ task.title = `Using Docker version ${ctx.dockerVersion}`;
67
67
  }
68
68
  }
69
69
  ]);
File without changes
@@ -83,7 +83,13 @@ const serviceConfigurationSchema = Joi.object({
83
83
  * @type {Joi.ObjectSchema<import('../../typings').CMAConfiguration['configuration']['composer']>}
84
84
  */
85
85
  const composerConfigurationSchema = Joi.object({
86
- version: Joi.string().optional().allow('1', '2')
86
+ version: Joi.string().optional().custom((value) => {
87
+ if (['1', '2'].includes(value)) {
88
+ return undefined;
89
+ }
90
+
91
+ return versionValidator(value);
92
+ })
87
93
  });
88
94
 
89
95
  /**
File without changes
package/lib/util/ip.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/lib/util/sleep.js CHANGED
File without changes
File without changes
File without changes
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.11.3",
6
+ "version": "1.12.2",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -27,6 +27,7 @@
27
27
  "enquirer": "2.3.6",
28
28
  "eta": "1.12.3",
29
29
  "getos": "3.2.1",
30
+ "hjson": "^3.2.2",
30
31
  "is-installed-globally": "0.4.0",
31
32
  "joi": "17.4.2",
32
33
  "listr2": "3.13.0",
@@ -41,5 +42,5 @@
41
42
  "publishConfig": {
42
43
  "access": "public"
43
44
  },
44
- "gitHead": "65ce8d3707c624de570a0f39c1ba890fe736554b"
45
+ "gitHead": "8e4db94149d0d2b56fef23f6c9db8c0df223da2e"
45
46
  }
@@ -1,4 +1,4 @@
1
- import { CMAConfiguration, PHPExtension } from './index';
1
+ import { CMAConfiguration, PHPExtensions } from './index';
2
2
 
3
3
  export interface ListrContext {
4
4
  magentoVersion: string
@@ -29,7 +29,7 @@ export interface ListrContext {
29
29
  fpmBinPath: string
30
30
  fpmConfPath: string
31
31
  fpmPidFilePath: string
32
- extensions: PHPExtension
32
+ extensions: PHPExtensions
33
33
  version: string
34
34
  }
35
35
  composer: {
@@ -1,3 +1,7 @@
1
+ import { ListrTaskWrapper } from 'listr2';
2
+
3
+ import { ListrContext } from './context';
4
+
1
5
  /* eslint-disable no-use-before-define */
2
6
  export interface ServiceWithVersion {
3
7
  /**
@@ -37,11 +41,40 @@ export interface PHPExtension extends Record<string, unknown> {
37
41
  * }
38
42
  * ```
39
43
  */
44
+ linuxOptions?: string
45
+ macosOptions?: string
40
46
  extensionName?: string
41
47
  hooks?: {
42
- preInstall: (config: CMAConfiguration['configuration']) => Promise<void>
43
- postInstall: (config: CMAConfiguration['configuration']) => Promise<void>
48
+ preEnable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
49
+ postEnable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
50
+ preDisable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
51
+ postDisable?: (config: CMAConfiguration['configuration']) => Promise<void> | void
52
+ preInstall?: (config: CMAConfiguration['configuration']) => Promise<void> | void
53
+ postInstall?: (config: CMAConfiguration['configuration']) => Promise<void> | void
44
54
  }
55
+ /**
56
+ * Allow to define custom logic to install extension
57
+ */
58
+ install?: (
59
+ ctx: ListrContext,
60
+ task: ListrTaskWrapper<ListrContext, any>
61
+ ) => Promise<void> | void
62
+
63
+ /**
64
+ * Allow to define custom logic to enable an extension
65
+ */
66
+ enable?: (
67
+ ctx: ListrContext,
68
+ task: ListrTaskWrapper<ListrContext, any>
69
+ ) => Promise<void> | void
70
+
71
+ /**
72
+ * Allow to define custom logic to disable an extension
73
+ */
74
+ disable?: (
75
+ ctx: ListrContext,
76
+ task: ListrTaskWrapper<ListrContext, any>
77
+ ) => Promise<void> | void
45
78
  }
46
79
 
47
80
  export interface PHPExtensions {
@@ -54,6 +87,7 @@ export interface PHPExtensions {
54
87
  xdebug: PHPExtension
55
88
  fileinfo: PHPExtension
56
89
  libsodium: PHPExtension
90
+ [key: string]: PHPExtension
57
91
  }
58
92
 
59
93
  export interface PHPConfiguration {