@scandipwa/magento-scripts 2.0.0-alpha.8 → 2.0.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 (141) hide show
  1. package/lib/commands/cli.js +18 -1
  2. package/lib/commands/logs.js +28 -2
  3. package/lib/commands/start.js +24 -3
  4. package/lib/commands/status.js +9 -1
  5. package/lib/config/config.js +20 -2
  6. package/lib/config/dependencies-for-platforms.js +1 -1
  7. package/lib/config/docker.js +94 -54
  8. package/lib/config/get-project-configuration.js +5 -0
  9. package/lib/config/index.js +10 -3
  10. package/lib/config/php/versions/php-7.2.js +1 -0
  11. package/lib/config/php/versions/php-7.3.js +1 -0
  12. package/lib/config/php/versions/php-7.4.js +1 -0
  13. package/lib/config/php/versions/php-8.1.js +1 -0
  14. package/lib/config/php-config.js +4 -3
  15. package/lib/config/port-config.js +3 -1
  16. package/lib/config/services/composer/versions/composer-1.js +13 -0
  17. package/lib/config/services/composer/versions/composer-2.js +8 -0
  18. package/lib/config/services/composer/versions/index.js +4 -0
  19. package/lib/config/services/maildev/index.js +7 -0
  20. package/lib/config/services/nginx/versions/index.js +3 -0
  21. package/lib/config/services/nginx/versions/nginx-1.18.js +11 -0
  22. package/lib/config/{ssl-terminator → services/ssl-terminator}/index.js +3 -0
  23. package/lib/config/templates/magentorc.template +12 -5
  24. package/lib/config/templates/nginx.fastcgi_params.template +29 -0
  25. package/lib/config/templates/php-debug.template.ini +31 -0
  26. package/lib/config/templates/php-fpm.template.conf +1 -2
  27. package/lib/config/templates/php.template.ini +5 -201
  28. package/lib/config/templates/ssl-terminator.template.conf +2 -0
  29. package/lib/config/templates/varnish.template.vcl +20 -13
  30. package/lib/config/varnish/varnish-6-0.js +4 -0
  31. package/lib/config/varnish/varnish-6-6.js +4 -0
  32. package/lib/config/varnish/varnish-7-0.js +4 -0
  33. package/lib/config/versions/magento-2.2.10.js +41 -0
  34. package/lib/config/versions/magento-2.3.0.js +8 -10
  35. package/lib/config/versions/magento-2.3.1.js +8 -10
  36. package/lib/config/versions/magento-2.3.2-p1.js +8 -10
  37. package/lib/config/versions/magento-2.3.2-p2.js +8 -10
  38. package/lib/config/versions/magento-2.3.2.js +8 -10
  39. package/lib/config/versions/magento-2.3.3-p1.js +8 -10
  40. package/lib/config/versions/magento-2.3.3.js +8 -10
  41. package/lib/config/versions/magento-2.3.4-p1.js +8 -10
  42. package/lib/config/versions/magento-2.3.4-p2.js +8 -10
  43. package/lib/config/versions/magento-2.3.4.js +8 -10
  44. package/lib/config/versions/magento-2.3.5-p1.js +8 -10
  45. package/lib/config/versions/magento-2.3.5-p2.js +8 -10
  46. package/lib/config/versions/magento-2.3.5.js +8 -10
  47. package/lib/config/versions/magento-2.3.6-p1.js +8 -10
  48. package/lib/config/versions/magento-2.3.6.js +8 -10
  49. package/lib/config/versions/magento-2.3.7-p1.js +8 -10
  50. package/lib/config/versions/magento-2.3.7-p2.js +8 -10
  51. package/lib/config/versions/magento-2.3.7-p3.js +8 -10
  52. package/lib/config/versions/magento-2.3.7-p4.js +8 -10
  53. package/lib/config/versions/magento-2.3.7.js +8 -10
  54. package/lib/config/versions/magento-2.4.0-p1.js +8 -10
  55. package/lib/config/versions/magento-2.4.0.js +8 -10
  56. package/lib/config/versions/magento-2.4.1-p1.js +8 -10
  57. package/lib/config/versions/magento-2.4.1.js +8 -10
  58. package/lib/config/versions/magento-2.4.2-p1.js +8 -10
  59. package/lib/config/versions/magento-2.4.2-p2.js +8 -10
  60. package/lib/config/versions/magento-2.4.2.js +8 -10
  61. package/lib/config/versions/magento-2.4.3-p1.js +8 -10
  62. package/lib/config/versions/magento-2.4.3-p2.js +8 -10
  63. package/lib/config/versions/magento-2.4.3-p3.js +8 -10
  64. package/lib/config/versions/magento-2.4.3.js +8 -10
  65. package/lib/config/versions/magento-2.4.4-p1.js +8 -10
  66. package/lib/config/versions/magento-2.4.4.js +8 -10
  67. package/lib/config/versions/magento-2.4.5.js +8 -10
  68. package/lib/tasks/cli/create-bashrc-config.js +4 -2
  69. package/lib/tasks/composer/local-auth-json.js +1 -1
  70. package/lib/tasks/database/connect-to-database.js +6 -3
  71. package/lib/tasks/database/create-magento-database.js +5 -2
  72. package/lib/tasks/database/create-magento-user.js +50 -0
  73. package/lib/tasks/database/default-magento-database.js +3 -0
  74. package/lib/tasks/database/default-magento-user.js +7 -0
  75. package/lib/tasks/database/import-dump-to-database.js +3 -2
  76. package/lib/tasks/docker/api.d.ts +25 -1
  77. package/lib/tasks/docker/api.js +31 -1
  78. package/lib/tasks/docker/containers/container-api.d.ts +21 -0
  79. package/lib/tasks/docker/containers/container-api.js +82 -17
  80. package/lib/tasks/docker/containers/tasks.js +44 -13
  81. package/lib/tasks/docker/convert-composer-home-to-composer-cache-volume.js +52 -0
  82. package/lib/tasks/docker/convert-mysql-to-mariadb.js +2 -2
  83. package/lib/tasks/docker/image/image-api.d.ts +44 -0
  84. package/lib/tasks/docker/image/image-api.js +30 -2
  85. package/lib/tasks/docker/index.js +6 -1
  86. package/lib/tasks/docker/project-image-builder.js +37 -14
  87. package/lib/tasks/docker/system/index.js +5 -0
  88. package/lib/tasks/docker/system/system-api.d.ts +71 -0
  89. package/lib/tasks/docker/system/system-api.js +29 -0
  90. package/lib/tasks/docker/volume/index.js +2 -1
  91. package/lib/tasks/docker/volume/tasks.js +67 -9
  92. package/lib/tasks/docker/volume/volume-api.d.ts +40 -0
  93. package/lib/tasks/docker/volume/volume-api.js +54 -1
  94. package/lib/tasks/execute.js +11 -9
  95. package/lib/tasks/file-system/create-nginx-config.js +3 -5
  96. package/lib/tasks/file-system/create-php-config.js +2 -23
  97. package/lib/tasks/file-system/create-php-debug-config.js +45 -0
  98. package/lib/tasks/file-system/create-php-fpm-config.js +2 -4
  99. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +13 -3
  100. package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -1
  101. package/lib/tasks/file-system/create-ssl-terminator-config.js +23 -8
  102. package/lib/tasks/file-system/create-varnish-config.js +4 -7
  103. package/lib/tasks/file-system/create-vscode-config.js +2 -1
  104. package/lib/tasks/file-system/index.js +3 -2
  105. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +2 -4
  106. package/lib/tasks/magento/setup-magento/flush-redis-config.js +3 -6
  107. package/lib/tasks/magento/setup-magento/index.js +2 -0
  108. package/lib/tasks/magento/setup-magento/install-magento.js +8 -13
  109. package/lib/tasks/magento/setup-magento/set-base-url.js +2 -1
  110. package/lib/tasks/magento/setup-magento/set-mail-config.js +22 -0
  111. package/lib/tasks/magento/setup-magento/varnish-config.js +4 -9
  112. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +15 -16
  113. package/lib/tasks/php/php-container.js +1 -1
  114. package/lib/tasks/php/update-env-php.js +3 -5
  115. package/lib/tasks/{prefix → project-config}/index.js +6 -6
  116. package/lib/tasks/requirements/composer-credentials.js +7 -3
  117. package/lib/tasks/requirements/docker/context.js +88 -0
  118. package/lib/tasks/requirements/docker/index.js +111 -19
  119. package/lib/tasks/requirements/docker/install.js +21 -7
  120. package/lib/tasks/requirements/docker/permissions.js +2 -11
  121. package/lib/tasks/requirements/docker/running-status.js +94 -24
  122. package/lib/tasks/requirements/docker/version.js +1 -0
  123. package/lib/tasks/requirements/index.js +0 -2
  124. package/lib/tasks/requirements/php-version.js +4 -2
  125. package/lib/tasks/start.js +27 -8
  126. package/lib/tasks/status/index.js +60 -21
  127. package/lib/tasks/stop.js +2 -0
  128. package/lib/tasks/theme/retrieve-theme-data.js +12 -2
  129. package/lib/util/config-file-validator.js +17 -3
  130. package/lib/util/execute-in-container.js +35 -5
  131. package/lib/util/instance-metadata.js +14 -2
  132. package/lib/util/systemctl.js +62 -13
  133. package/package.json +2 -2
  134. package/typings/context.d.ts +11 -0
  135. package/typings/index.d.ts +46 -1
  136. package/lib/tasks/requirements/dependency/arch.js +0 -50
  137. package/lib/tasks/requirements/dependency/centos.js +0 -36
  138. package/lib/tasks/requirements/dependency/fedora.js +0 -36
  139. package/lib/tasks/requirements/dependency/index.js +0 -33
  140. package/lib/tasks/requirements/dependency/mac.js +0 -124
  141. package/lib/tasks/requirements/dependency/ubuntu.js +0 -83
@@ -1,36 +0,0 @@
1
- const dependenciesForPlatforms = require('../../../config/dependencies-for-platforms');
2
- const { execAsyncSpawn } = require('../../../util/exec-async-command');
3
- const installDependenciesTask = require('../../../util/install-dependencies-task');
4
-
5
- /**
6
- * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
7
- */
8
- const centosDependenciesCheck = () => ({
9
- title: 'Checking CentOS dependencies',
10
- task: async (ctx, task) => {
11
- const installedDependencies = (await execAsyncSpawn('yum list installed')).split('\n')
12
- .filter((pkg) => !pkg.toLowerCase().includes('installed packages'))
13
- .map((pkg) => pkg.match(/^(\S+)/i))
14
- .filter(Boolean)
15
- .map((pkg) => pkg[1])
16
- .map((pkg) => pkg.match(/^(\S+)\.\S+/i))
17
- .filter(Boolean)
18
- .map((pkg) => pkg[1]);
19
-
20
- const dependenciesToInstall = dependenciesForPlatforms
21
- .CentOS
22
- .dependencies
23
- .filter((dep) => !installedDependencies.includes(dep));
24
-
25
- if (dependenciesToInstall.length > 0) {
26
- return task.newListr(
27
- installDependenciesTask({
28
- platform: 'CentOS',
29
- dependenciesToInstall
30
- })
31
- );
32
- }
33
- }
34
- });
35
-
36
- module.exports = centosDependenciesCheck;
@@ -1,36 +0,0 @@
1
- const dependenciesForPlatforms = require('../../../config/dependencies-for-platforms');
2
- const { execAsyncSpawn } = require('../../../util/exec-async-command');
3
- const installDependenciesTask = require('../../../util/install-dependencies-task');
4
-
5
- /**
6
- * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
7
- */
8
- const fedoraDependenciesCheck = () => ({
9
- title: 'Checking Fedora Linux dependencies',
10
- task: async (ctx, task) => {
11
- const installedDependencies = (await execAsyncSpawn('yum list installed')).split('\n')
12
- .filter((pkg) => !pkg.toLowerCase().includes('installed packages'))
13
- .map((pkg) => pkg.match(/^(\S+)/i))
14
- .filter(Boolean)
15
- .map((pkg) => pkg[1])
16
- .map((pkg) => pkg.match(/^(\S+)\.\S+/i))
17
- .filter(Boolean)
18
- .map((pkg) => pkg[1]);
19
-
20
- const dependenciesToInstall = dependenciesForPlatforms
21
- .Fedora
22
- .dependencies
23
- .filter((dep) => !installedDependencies.includes(dep));
24
-
25
- if (dependenciesToInstall.length > 0) {
26
- return task.newListr(
27
- installDependenciesTask({
28
- platform: 'Fedora',
29
- dependenciesToInstall
30
- })
31
- );
32
- }
33
- }
34
- });
35
-
36
- module.exports = fedoraDependenciesCheck;
@@ -1,33 +0,0 @@
1
- const archDependenciesCheck = require('./arch');
2
- const fedoraDependenciesCheck = require('./fedora');
3
- const centosDependenciesCheck = require('./centos');
4
- const ubuntuDependenciesCheck = require('./ubuntu');
5
- const macDependenciesCheck = require('./mac');
6
- const osPlatform = require('../../../util/os-platform');
7
-
8
- const dependencyCheck = async () => {
9
- if (process.platform === 'darwin') {
10
- return macDependenciesCheck();
11
- }
12
-
13
- const distro = await osPlatform();
14
- switch (distro) {
15
- case 'Arch Linux': {
16
- return archDependenciesCheck();
17
- }
18
- case 'Fedora': {
19
- return fedoraDependenciesCheck();
20
- }
21
- case 'CentOS': {
22
- return centosDependenciesCheck();
23
- }
24
- case 'Ubuntu': {
25
- return ubuntuDependenciesCheck();
26
- }
27
- default: {
28
- // skip check
29
- }
30
- }
31
- };
32
-
33
- module.exports = dependencyCheck;
@@ -1,124 +0,0 @@
1
- const dependenciesForPlatforms = require('../../../config/dependencies-for-platforms');
2
- const { execAsyncSpawn, execCommandTask } = require('../../../util/exec-async-command');
3
- const {
4
- BREW_BIN_PATH_ARM_NATIVE,
5
- BREW_BIN_PATH_ARM_ROSETTA,
6
- BREW_BIN_PATH_INTEL,
7
- getBrewCommand
8
- } = require('../../../util/get-brew-bin-path');
9
- const installDependenciesTask = require('../../../util/install-dependencies-task');
10
- const pathExists = require('../../../util/path-exists');
11
-
12
- const brewInstallCommand = '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)';
13
-
14
- /**
15
- * @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
16
- */
17
- const installBrewRosettaTask = () => ({
18
- title: 'Installing Brew using Rosetta 2',
19
- task: async (ctx, task) => {
20
- if (await pathExists(BREW_BIN_PATH_ARM_ROSETTA)) {
21
- task.skip('Brew in Rosetta is already installed');
22
- return;
23
- }
24
-
25
- return task.newListr(
26
- execCommandTask(brewInstallCommand, {
27
- useRosetta2: true
28
- })
29
- );
30
- }
31
- });
32
-
33
- /**
34
- * @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
35
- */
36
- const installBrewNativeTask = () => ({
37
- title: 'Installing Brew',
38
- task: async (ctx, task) => {
39
- if (
40
- (ctx.arch === 'arm64' && await pathExists(BREW_BIN_PATH_ARM_NATIVE))
41
- || (ctx.arch === 'x64' && await pathExists(BREW_BIN_PATH_INTEL))
42
- ) {
43
- task.skip('Brew in native path is already installed');
44
- return;
45
- }
46
-
47
- return task.newListr(
48
- execCommandTask(brewInstallCommand, {
49
- useRosetta2: false
50
- })
51
- );
52
- }
53
- });
54
-
55
- /**
56
- * @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
57
- */
58
- const macDependenciesCheck = () => ({
59
- title: 'Checking MacOS dependencies',
60
- task: async (ctx, task) => {
61
- const tasks = [installBrewNativeTask()];
62
-
63
- if (ctx.arch === 'arm64') {
64
- tasks.push(installBrewRosettaTask());
65
- }
66
-
67
- return task.newListr(
68
- tasks.concat([
69
- {
70
- task: async () => {
71
- const installDependenciesTasks = [];
72
- if (ctx.arch === 'arm64') {
73
- const installedNativeDependencies = (
74
- await execAsyncSpawn(`${await getBrewCommand({ native: true })} list`, { useRosetta2: false })
75
- ).split('\n');
76
- const dependenciesToInstallOnArm = dependenciesForPlatforms['darwin-arm']
77
- .dependencies
78
- .filter((dep) => !installedNativeDependencies.includes(dep));
79
-
80
- if (dependenciesToInstallOnArm.length > 0) {
81
- installDependenciesTasks.push(
82
- installDependenciesTask({
83
- platform: 'darwin-arm',
84
- dependenciesToInstall: dependenciesToInstallOnArm,
85
- useMacNativeEnvironment: true
86
- })
87
- );
88
- }
89
- }
90
-
91
- const installedDependencies = (
92
- await execAsyncSpawn(`${await getBrewCommand({ native: false })} list`, { useRosetta2: true })
93
- ).split('\n');
94
- const dependenciesToInstall = dependenciesForPlatforms
95
- .darwin
96
- .dependencies
97
- .filter((dep) => !installedDependencies.includes(dep));
98
-
99
- if (dependenciesToInstall.length > 0) {
100
- installDependenciesTasks.push(
101
- installDependenciesTask({
102
- platform: 'darwin',
103
- dependenciesToInstall,
104
- useMacNativeEnvironment: false
105
- })
106
- );
107
- }
108
-
109
- if (installDependenciesTasks.length > 0) {
110
- return task.newListr(installDependenciesTasks);
111
- }
112
-
113
- task.skip();
114
- }
115
- }
116
- ])
117
- );
118
- },
119
- options: {
120
- bottomBar: 10
121
- }
122
- });
123
-
124
- module.exports = macDependenciesCheck;
@@ -1,83 +0,0 @@
1
- const logger = require('@scandipwa/scandipwa-dev-utils/logger');
2
- const os = require('os');
3
- const dependenciesForPlatforms = require('../../../config/dependencies-for-platforms');
4
- const { execAsyncSpawn, execCommandTask } = require('../../../util/exec-async-command');
5
- const installDependenciesTask = require('../../../util/install-dependencies-task');
6
-
7
- const pkgRegex = /^(\S+)\/\S+\s(\S+)\s\S+\s\S+$/i;
8
-
9
- const updateSystem = () => ({
10
- title: 'Updating Ubuntu system',
11
- task: async (ctx, task) => {
12
- task.output = 'Enter your sudo password!';
13
- task.output = logger.style.command(`>[sudo] password for ${ os.userInfo().username }:`);
14
-
15
- return task.newListr(
16
- execCommandTask('sudo apt update', {
17
- callback: (t) => {
18
- task.output = t;
19
- },
20
- pipeInput: true
21
- })
22
- );
23
- },
24
- options: {
25
- bottomBar: 10
26
- }
27
- });
28
-
29
- /**
30
- * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
31
- */
32
- const ubuntuDependenciesCheck = () => ({
33
- title: 'Checking Ubuntu Linux dependencies',
34
- task: async (ctx, task) => {
35
- const installedDependencies = (await execAsyncSpawn('apt list --installed')).split('\n')
36
- .filter((pkg) => pkgRegex.test(pkg))
37
- .map((pkg) => pkg.match(pkgRegex))
38
- .map((pkg) => pkg[1]);
39
-
40
- const dependenciesToInstall = dependenciesForPlatforms
41
- .Ubuntu
42
- .dependencies
43
- .filter((dep) => {
44
- if (Array.isArray(dep)) {
45
- return !dep.some((dp) => installedDependencies.includes(dp));
46
- }
47
-
48
- return !installedDependencies.includes(dep);
49
- })
50
- .map((dep) => (Array.isArray(dep) ? dep[0] : dep));
51
-
52
- if (dependenciesToInstall.length > 0) {
53
- const runSystemUpdate = await task.prompt({
54
- type: 'Confirm',
55
- message: `Would you like to run ${logger.style.command('apt update')} before installing missing ${dependenciesToInstall.length} dependenc${dependenciesToInstall.length > 1 ? 'ies' : 'y'}?`
56
- });
57
-
58
- if (runSystemUpdate) {
59
- return task.newListr([
60
- updateSystem(),
61
- installDependenciesTask({
62
- platform: 'Ubuntu',
63
- dependenciesToInstall
64
- })
65
- ], {
66
- concurrent: false
67
- });
68
- }
69
-
70
- return task.newListr(
71
- installDependenciesTask({
72
- platform: 'Ubuntu',
73
- dependenciesToInstall
74
- })
75
- );
76
- }
77
- },
78
- options: {
79
- bottomBar: 10
80
- }
81
- });
82
-
83
- module.exports = ubuntuDependenciesCheck;