@scandipwa/magento-scripts 1.16.1 → 2.0.0-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.
- package/lib/commands/cli.js +4 -6
- package/lib/commands/execute.js +29 -4
- package/lib/commands/import-db.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/start.js +38 -20
- package/lib/commands/status.js +2 -0
- package/lib/config/docker.js +102 -84
- package/lib/config/get-project-configuration.js +3 -1
- package/lib/config/index.js +10 -7
- package/lib/config/magento/required-php-extensions/index.js +29 -0
- package/lib/config/magento/required-php-extensions/magento-2.3.js +19 -0
- package/lib/config/magento/required-php-extensions/magento-2.4.js +29 -0
- package/lib/config/php/base-repo.js +3 -0
- package/lib/config/php/extensions/apcu.js +12 -0
- package/lib/config/php/extensions/bcmath.js +7 -0
- package/lib/config/php/extensions/curl.js +11 -0
- package/lib/config/php/extensions/gd.js +14 -0
- package/lib/config/php/extensions/index.js +18 -2
- package/lib/config/php/extensions/intl.js +10 -0
- package/lib/config/php/extensions/opcache.js +10 -0
- package/lib/config/php/extensions/pdo_mysql.js +7 -0
- package/lib/config/php/extensions/soap.js +10 -0
- package/lib/config/php/extensions/sodium.js +10 -0
- package/lib/config/php/extensions/xdebug.js +8 -5
- package/lib/config/php/extensions/xsl.js +10 -0
- package/lib/config/php/extensions/zip.js +10 -0
- package/lib/config/php/{releases → versions}/index.js +0 -0
- package/lib/config/php/versions/php-7.2.js +23 -0
- package/lib/config/php/versions/php-7.3.js +23 -0
- package/lib/config/php/versions/php-7.4.js +23 -0
- package/lib/config/php/versions/php-8.1.js +23 -0
- package/lib/config/php-config.js +8 -12
- package/lib/config/port-config.js +2 -6
- package/lib/config/services/elasticsearch/base-repo.js +3 -0
- package/lib/config/services/elasticsearch/default-es-env.js +6 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
- package/lib/config/services/elasticsearch/versions/index.js +5 -0
- package/lib/config/templates/magentorc.template +5 -5
- package/lib/config/templates/mariadb.template.cnf +191 -0
- package/lib/config/templates/php-fpm.template.conf +3 -3
- package/lib/config/templates/php.template.ini +12 -6
- package/lib/config/templates/ssl-terminator.template.conf +1 -1
- package/lib/config/templates/vscode-launch.template.json +3 -1
- package/lib/config/versions/magento-2.3.0.js +10 -5
- package/lib/config/versions/magento-2.3.1.js +10 -5
- package/lib/config/versions/magento-2.3.2-p1.js +43 -0
- package/lib/config/versions/magento-2.3.2-p2.js +10 -5
- package/lib/config/versions/magento-2.3.2.js +10 -5
- package/lib/config/versions/magento-2.3.3-p1.js +10 -5
- package/lib/config/versions/magento-2.3.3.js +10 -5
- package/lib/config/versions/magento-2.3.4-p1.js +43 -0
- package/lib/config/versions/magento-2.3.4-p2.js +10 -5
- package/lib/config/versions/magento-2.3.4.js +10 -5
- package/lib/config/versions/magento-2.3.5-p1.js +8 -2
- package/lib/config/versions/magento-2.3.5-p2.js +8 -2
- package/lib/config/versions/magento-2.3.5.js +8 -2
- package/lib/config/versions/magento-2.3.6-p1.js +8 -2
- package/lib/config/versions/magento-2.3.6.js +8 -2
- package/lib/config/versions/magento-2.3.7-p1.js +8 -2
- package/lib/config/versions/magento-2.3.7-p2.js +8 -2
- package/lib/config/versions/magento-2.3.7-p3.js +8 -2
- package/lib/config/versions/magento-2.3.7.js +8 -2
- package/lib/config/versions/magento-2.4.0-p1.js +9 -3
- package/lib/config/versions/magento-2.4.0.js +9 -3
- package/lib/config/versions/magento-2.4.1-p1.js +6 -5
- package/lib/config/versions/magento-2.4.1.js +9 -2
- package/lib/config/versions/magento-2.4.2-p1.js +6 -5
- package/lib/config/versions/magento-2.4.2-p2.js +6 -6
- package/lib/config/versions/magento-2.4.2.js +6 -6
- package/lib/config/versions/magento-2.4.3-p1.js +7 -7
- package/lib/config/versions/magento-2.4.3-p2.js +7 -7
- package/lib/config/versions/magento-2.4.3.js +7 -7
- package/lib/config/versions/magento-2.4.4.js +9 -2
- package/lib/tasks/cleanup.js +3 -3
- package/lib/tasks/composer/index.js +14 -104
- package/lib/tasks/database/connect-to-database.js +117 -0
- package/lib/tasks/database/create-magento-database.js +18 -0
- package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
- package/lib/tasks/{mysql → database}/fix-db.js +2 -2
- package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +65 -22
- package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
- package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
- package/lib/tasks/{mysql → database}/index.js +2 -2
- package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
- package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
- package/lib/tasks/docker/api.d.ts +71 -0
- package/lib/tasks/docker/api.js +30 -0
- package/lib/tasks/docker/containers/container-api.d.ts +128 -0
- package/lib/tasks/docker/containers/container-api.js +153 -0
- package/lib/tasks/docker/containers/index.js +19 -0
- package/lib/tasks/docker/containers/tasks.js +215 -0
- package/lib/tasks/docker/convert-legacy-volumes.js +15 -10
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
- package/lib/tasks/docker/image/image-api.d.ts +34 -0
- package/lib/tasks/docker/image/image-api.js +49 -0
- package/lib/tasks/docker/image/index.js +5 -0
- package/lib/tasks/docker/index.js +1 -13
- package/lib/tasks/docker/network/index.js +7 -0
- package/lib/tasks/docker/network/network-api.d.ts +103 -0
- package/lib/tasks/docker/network/network-api.js +99 -0
- package/lib/tasks/docker/{network.js → network/tasks.js} +17 -10
- package/lib/tasks/docker/project-image-builder.js +167 -0
- package/lib/tasks/docker/volume/index.js +8 -0
- package/lib/tasks/docker/{volumes.js → volume/tasks.js} +5 -19
- package/lib/tasks/docker/volume/volume-api.d.ts +39 -0
- package/lib/tasks/docker/volume/volume-api.js +66 -0
- package/lib/tasks/execute/index.js +5 -2
- package/lib/tasks/file-system/create-mariadb-config.js +23 -0
- package/lib/tasks/file-system/create-nginx-config.js +2 -3
- package/lib/tasks/file-system/create-php-config.js +20 -5
- package/lib/tasks/file-system/create-php-fpm-config.js +8 -4
- package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +41 -29
- package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -0
- package/lib/tasks/file-system/create-phpstorm-config/keys.js +15 -1
- package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +4 -1
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +3 -3
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +81 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/index.js +42 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/php-docker-settings-config.js +9 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/setup-php-docker-container-settings-config.js +66 -0
- package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +11 -9
- package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +2 -1
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +15 -30
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +24 -5
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/mess-detector-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-code-sniffer-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-cs-fixer-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +15 -15
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +29 -3
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-stan-project-configuration-config.js.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +42 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/psalm-project-configuration-config.js.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +0 -2
- package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -2
- package/lib/tasks/file-system/create-vscode-config.js +57 -42
- package/lib/tasks/file-system/index.js +5 -2
- package/lib/tasks/import-dump.js +6 -6
- package/lib/tasks/link.js +5 -4
- package/lib/tasks/magento/install-magento-project.js +31 -63
- package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +4 -4
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +7 -3
- package/lib/tasks/magento/setup-magento/create-admin.js +5 -6
- package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
- package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
- package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
- package/lib/tasks/magento/setup-magento/disable-2fa.js +3 -5
- package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +3 -4
- package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/magento/setup-magento/install-magento.js +21 -20
- package/lib/tasks/magento/setup-magento/migrate-database.js +7 -14
- package/lib/tasks/magento/setup-magento/set-base-url.js +2 -2
- package/lib/tasks/magento/setup-magento/set-deployment-mode.js +4 -4
- package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
- package/lib/tasks/magento/setup-magento/varnish-config.js +10 -8
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +128 -3
- package/lib/tasks/php/php-container.js +108 -0
- package/lib/tasks/php/update-env-php.js +39 -21
- package/lib/tasks/php/update-env.php +66 -61
- package/lib/tasks/php/working_health_check.php +85 -0
- package/lib/tasks/requirements/{composer.js → composer-credentials.js} +3 -1
- package/lib/tasks/requirements/docker/index.js +15 -12
- package/lib/tasks/requirements/docker/performance.js +54 -0
- package/lib/tasks/requirements/docker/version.js +8 -8
- package/lib/tasks/requirements/index.js +5 -8
- package/lib/tasks/requirements/php-version.js +8 -116
- package/lib/tasks/requirements/platform.js +12 -25
- package/lib/tasks/start.js +21 -50
- package/lib/tasks/status/index.js +8 -12
- package/lib/tasks/stop.js +0 -2
- package/lib/tasks/theme/install-theme.js +1 -1
- package/lib/tasks/theme/link-theme.js +2 -2
- package/lib/tasks/theme/symlink-theme.js +2 -3
- package/lib/util/config-file-validator.js +27 -13
- package/lib/util/config-php-json.js +13 -4
- package/lib/util/database.js +7 -7
- package/lib/util/dockerfile-builder/build-instructions.js +197 -0
- package/lib/util/dockerfile-builder/index.js +276 -0
- package/lib/util/dockerfile-builder/types.d.ts +123 -0
- package/lib/util/env-php-json.js +10 -6
- package/lib/util/exec-async-command.js +3 -9
- package/lib/util/macos-version.js +20 -0
- package/lib/util/magento-task.js +3 -4
- package/lib/util/nginx-logs-parser.js +122 -0
- package/lib/util/php-task.js +3 -6
- package/lib/util/run-composer.js +6 -14
- package/lib/util/run-container-image.js +17 -0
- package/lib/util/run-magento.js +6 -14
- package/lib/util/run-php.js +6 -17
- package/package.json +9 -9
- package/typings/context.d.ts +7 -13
- package/typings/index.d.ts +67 -85
- package/yarn-error.log +9660 -0
- package/lib/config/composer.js +0 -11
- package/lib/config/php/extensions/libsodium.js +0 -36
- package/lib/config/php/releases/php-7.2.js +0 -25
- package/lib/config/php/releases/php-7.3.js +0 -25
- package/lib/config/php/releases/php-7.4.js +0 -23
- package/lib/config/php/releases/php-8.1.js +0 -25
- package/lib/config/phpbrew.js +0 -12
- package/lib/tasks/composer/install-prestissimo.js +0 -103
- package/lib/tasks/docker/containers.js +0 -231
- package/lib/tasks/mysql/connect-to-mysql.js +0 -114
- package/lib/tasks/mysql/create-magento-database.js +0 -18
- package/lib/tasks/php/bundled-extensions.js +0 -27
- package/lib/tasks/php/compile-options.js +0 -56
- package/lib/tasks/php/compile.js +0 -55
- package/lib/tasks/php/configure.js +0 -89
- package/lib/tasks/php/extensions/disable.js +0 -49
- package/lib/tasks/php/extensions/enable.js +0 -52
- package/lib/tasks/php/extensions/index.js +0 -80
- package/lib/tasks/php/extensions/install.js +0 -54
- package/lib/tasks/php/index.js +0 -79
- package/lib/tasks/php/install-sodium.js +0 -93
- package/lib/tasks/php/update-phpbrew.js +0 -45
- package/lib/tasks/php/validate-php.js +0 -67
- package/lib/tasks/php-fpm/get-process-id.js +0 -14
- package/lib/tasks/php-fpm/index.js +0 -4
- package/lib/tasks/php-fpm/start-php-fpm.js +0 -49
- package/lib/tasks/php-fpm/stop-php-fpm.js +0 -48
- package/lib/tasks/requirements/phpbrew/index.js +0 -61
- package/lib/tasks/requirements/phpbrew/install.js +0 -159
- package/lib/tasks/requirements/phpbrew/version.js +0 -28
package/lib/commands/cli.js
CHANGED
|
@@ -5,9 +5,9 @@ const getMagentoVersionConfig = require('../config/get-magento-version-config');
|
|
|
5
5
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
6
6
|
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
7
7
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
8
|
-
const { installComposer, installPrestissimo } = require('../tasks/composer');
|
|
8
|
+
// const { installComposer, installPrestissimo } = require('../tasks/composer');
|
|
9
9
|
const ConsoleBlock = require('../util/console-block');
|
|
10
|
-
const checkComposerCredentials = require('../tasks/requirements/composer');
|
|
10
|
+
const { checkComposerCredentials } = require('../tasks/requirements/composer-credentials');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {import('yargs')} yargs
|
|
@@ -18,8 +18,6 @@ module.exports = (yargs) => {
|
|
|
18
18
|
getMagentoVersionConfig(),
|
|
19
19
|
checkConfigurationFile(),
|
|
20
20
|
getProjectConfiguration(),
|
|
21
|
-
installComposer(),
|
|
22
|
-
installPrestissimo(),
|
|
23
21
|
createBashrcConfigFile(),
|
|
24
22
|
checkComposerCredentials()
|
|
25
23
|
], {
|
|
@@ -63,8 +61,8 @@ module.exports = (yargs) => {
|
|
|
63
61
|
.addEmptyLine();
|
|
64
62
|
|
|
65
63
|
block
|
|
66
|
-
.addLine(`Connect to
|
|
67
|
-
.addLine(`Connect to
|
|
64
|
+
.addLine(`Connect to MariaDB server: ${logger.style.command('mariadb')}`)
|
|
65
|
+
.addLine(`Connect to MariaDB server as root: ${logger.style.command('mariadbroot')}`)
|
|
68
66
|
.addEmptyLine();
|
|
69
67
|
|
|
70
68
|
block.log();
|
package/lib/commands/execute.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
2
|
-
const {
|
|
2
|
+
const { Listr } = require('listr2');
|
|
3
|
+
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
4
|
+
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
3
5
|
const executeInContainer = require('../tasks/execute');
|
|
6
|
+
const getMagentoVersionConfig = require('../config/get-magento-version-config');
|
|
7
|
+
const { checkRequirements } = require('../tasks/requirements');
|
|
8
|
+
const { getCachedPorts } = require('../config/get-port-config');
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
11
|
* @param {import('yargs')} yargs
|
|
@@ -13,7 +18,7 @@ module.exports = (yargs) => {
|
|
|
13
18
|
yargs.usage(`Usage: npm run exec <container name> [commands...]
|
|
14
19
|
|
|
15
20
|
Available containers:
|
|
16
|
-
-
|
|
21
|
+
- mariadb
|
|
17
22
|
- nginx
|
|
18
23
|
- redis
|
|
19
24
|
- elasticsearch
|
|
@@ -21,7 +26,27 @@ Available containers:
|
|
|
21
26
|
- sslTerminator`);
|
|
22
27
|
},
|
|
23
28
|
async (argv) => {
|
|
24
|
-
const
|
|
29
|
+
const tasks = new Listr([
|
|
30
|
+
checkRequirements(),
|
|
31
|
+
getMagentoVersionConfig(),
|
|
32
|
+
checkConfigurationFile(),
|
|
33
|
+
getProjectConfiguration(),
|
|
34
|
+
getCachedPorts()
|
|
35
|
+
], {
|
|
36
|
+
concurrent: false,
|
|
37
|
+
exitOnError: true,
|
|
38
|
+
ctx: { throwMagentoVersionMissing: true },
|
|
39
|
+
rendererOptions: { collapse: false, clearOutput: true }
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
let ctx;
|
|
43
|
+
try {
|
|
44
|
+
ctx = await tasks.run();
|
|
45
|
+
} catch (e) {
|
|
46
|
+
logger.error(e.message || e);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
const containers = ctx.config.docker.getContainers(ctx.ports);
|
|
25
50
|
const services = Object.keys(containers);
|
|
26
51
|
|
|
27
52
|
if (services.includes(argv.containername) || services.some((service) => service.includes(argv.containername))) {
|
|
@@ -40,7 +65,7 @@ Available containers:
|
|
|
40
65
|
}
|
|
41
66
|
}
|
|
42
67
|
|
|
43
|
-
logger.logN(`Executing container ${logger.style.misc(container._)}`);
|
|
68
|
+
logger.logN(`Executing container ${logger.style.misc(container._)} (command: ${logger.style.command(argv.commands[0])})`);
|
|
44
69
|
await executeInContainer({
|
|
45
70
|
containerName: container.name,
|
|
46
71
|
commands: argv.commands
|
package/lib/commands/logs.js
CHANGED
package/lib/commands/start.js
CHANGED
|
@@ -17,6 +17,26 @@ const cmaGaTrackingId = 'UA-127741417-7';
|
|
|
17
17
|
|
|
18
18
|
googleAnalytics.setGaTrackingId(cmaGaTrackingId);
|
|
19
19
|
|
|
20
|
+
const reportErrors = async (errors) => {
|
|
21
|
+
for (const error of errors) {
|
|
22
|
+
const path = (error.path && ` Error path: ${error.path} `) || '';
|
|
23
|
+
if (error instanceof UnknownError || error instanceof KnownError) {
|
|
24
|
+
logger.error(error.message);
|
|
25
|
+
if (error instanceof UnknownError) {
|
|
26
|
+
await googleAnalytics.trackError(`Unknown Error:${path}${error.stack}`);
|
|
27
|
+
} else {
|
|
28
|
+
await googleAnalytics.trackError(`Known Error:${path}${error.message}`);
|
|
29
|
+
}
|
|
30
|
+
} else if (error instanceof Error) {
|
|
31
|
+
logger.error(error.message);
|
|
32
|
+
await googleAnalytics.trackError(`Regular Error:${path}${error.message}`);
|
|
33
|
+
} else {
|
|
34
|
+
logger.error(error);
|
|
35
|
+
await googleAnalytics.trackError(`Non Error:${path}${error}`); // track non-errors throws
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
20
40
|
/**
|
|
21
41
|
* @param {import('yargs')} yargs
|
|
22
42
|
*/
|
|
@@ -49,10 +69,6 @@ module.exports = (yargs) => {
|
|
|
49
69
|
type: 'boolean',
|
|
50
70
|
default: false
|
|
51
71
|
})
|
|
52
|
-
.option('import-db', {
|
|
53
|
-
describe: 'Import database dump to MySQL',
|
|
54
|
-
type: 'string'
|
|
55
|
-
})
|
|
56
72
|
.option('edition', {
|
|
57
73
|
alias: 'e',
|
|
58
74
|
describe: 'Magento Edition to install',
|
|
@@ -80,7 +96,8 @@ module.exports = (yargs) => {
|
|
|
80
96
|
rendererOptions: {
|
|
81
97
|
showErrorMessage: false,
|
|
82
98
|
showTimer: true
|
|
83
|
-
}
|
|
99
|
+
},
|
|
100
|
+
collectErrors: 'minimal'
|
|
84
101
|
}
|
|
85
102
|
);
|
|
86
103
|
const timeStamp = Date.now();
|
|
@@ -148,11 +165,18 @@ module.exports = (yargs) => {
|
|
|
148
165
|
block.log();
|
|
149
166
|
|
|
150
167
|
logger.note(
|
|
151
|
-
`
|
|
168
|
+
`MariaDB credentials, containers status and project information available in ${logger.style.code('npm run status')} command.
|
|
152
169
|
To access Magento CLI, Composer and PHP for this project use ${logger.style.code('npm run cli')} command.`
|
|
153
170
|
);
|
|
154
171
|
logger.log('');
|
|
155
172
|
|
|
173
|
+
if (!analytics && tasks.err && tasks.err.length > 0) {
|
|
174
|
+
logger.warn('You have disabled analytics, but we\'ve encountered errors during startup!');
|
|
175
|
+
for (const err of tasks.err) {
|
|
176
|
+
logger.error(`${err.path}\n${err.message}\n\n${err.stack}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
156
180
|
if (!analytics) {
|
|
157
181
|
process.exit(0);
|
|
158
182
|
}
|
|
@@ -178,22 +202,16 @@ module.exports = (yargs) => {
|
|
|
178
202
|
await googleAnalytics.trackError(e.message || e);
|
|
179
203
|
}
|
|
180
204
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
logger.error(e.message);
|
|
185
|
-
if (e instanceof UnknownError) {
|
|
186
|
-
await googleAnalytics.trackError(`Unknown Error: ${e.stack}`);
|
|
187
|
-
} else {
|
|
188
|
-
await googleAnalytics.trackError(`Known Error: ${e.message}`);
|
|
205
|
+
if (tasks.err && tasks.err.length > 0) {
|
|
206
|
+
for (const err of tasks.err) {
|
|
207
|
+
console.log(err);
|
|
189
208
|
}
|
|
190
|
-
|
|
191
|
-
logger.error(e.message);
|
|
192
|
-
await googleAnalytics.trackError(`Regular Error: ${e.message}`);
|
|
193
|
-
} else {
|
|
194
|
-
logger.error(e);
|
|
195
|
-
await googleAnalytics.trackError(`Non Error: ${e}`); // track non-errors throws
|
|
209
|
+
await reportErrors(tasks.err);
|
|
196
210
|
}
|
|
211
|
+
|
|
212
|
+
process.exit(0);
|
|
213
|
+
} catch (e) {
|
|
214
|
+
await reportErrors([e]);
|
|
197
215
|
process.exit(1);
|
|
198
216
|
}
|
|
199
217
|
}
|
package/lib/commands/status.js
CHANGED
|
@@ -8,6 +8,7 @@ const { checkRequirements } = require('../tasks/requirements');
|
|
|
8
8
|
const { statusContainers } = require('../tasks/docker/containers');
|
|
9
9
|
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
10
10
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
11
|
+
const checkPHPVersion = require('../tasks/requirements/php-version');
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @param {import('yargs')} yargs
|
|
@@ -20,6 +21,7 @@ module.exports = (yargs) => {
|
|
|
20
21
|
checkConfigurationFile(),
|
|
21
22
|
getProjectConfiguration(),
|
|
22
23
|
getCachedPorts(),
|
|
24
|
+
checkPHPVersion(),
|
|
23
25
|
statusContainers()
|
|
24
26
|
], {
|
|
25
27
|
concurrent: false,
|
package/lib/config/docker.js
CHANGED
|
@@ -1,48 +1,60 @@
|
|
|
1
1
|
const os = require('os');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const
|
|
4
|
-
const getIsWsl = require('../util/is-wsl');
|
|
3
|
+
const getPhpConfig = require('./php-config');
|
|
5
4
|
const { isIpAddress } = require('../util/ip');
|
|
6
5
|
|
|
7
6
|
const systeminformation = require('systeminformation');
|
|
7
|
+
const { deepmerge } = require('../util/deepmerge');
|
|
8
|
+
const defaultEsEnv = require('./services/elasticsearch/default-es-env');
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {import('../../typings/context').ListrContext} ctx
|
|
13
|
+
* @param {import('../../typings/context').ListrContext['config']['overridenConfiguration']} overridenConfiguration
|
|
14
|
+
* @param {import('../../typings/context').ListrContext['config']['baseConfig']} baseConfig
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
18
|
+
const { configuration, ssl, host } = overridenConfiguration;
|
|
10
19
|
const {
|
|
11
20
|
nginx,
|
|
12
21
|
redis,
|
|
13
|
-
mysql,
|
|
14
22
|
elasticsearch,
|
|
15
23
|
mariadb,
|
|
16
24
|
varnish
|
|
17
25
|
} = configuration;
|
|
18
26
|
|
|
27
|
+
const php = getPhpConfig(configuration, baseConfig);
|
|
19
28
|
const {
|
|
20
29
|
prefix,
|
|
21
30
|
magentoDir,
|
|
31
|
+
containerMagentoDir,
|
|
22
32
|
cacheDir
|
|
23
|
-
} =
|
|
33
|
+
} = baseConfig;
|
|
24
34
|
|
|
25
|
-
const cpuSupportedFlags = await systeminformation.cpuFlags();
|
|
35
|
+
const cpuSupportedFlags = (await systeminformation.cpuFlags()).split(' ');
|
|
26
36
|
|
|
27
37
|
const network = {
|
|
28
38
|
name: `${ prefix }_network`
|
|
29
39
|
};
|
|
30
40
|
|
|
31
41
|
const volumes = {
|
|
32
|
-
|
|
33
|
-
name: `${ prefix }
|
|
42
|
+
mariadb: {
|
|
43
|
+
name: `${ prefix }_mariadb-data`
|
|
34
44
|
},
|
|
35
45
|
redis: {
|
|
36
46
|
name: `${ prefix }_redis-data`
|
|
37
47
|
},
|
|
38
48
|
elasticsearch: {
|
|
39
49
|
name: `${ prefix }_elasticsearch-data`
|
|
50
|
+
},
|
|
51
|
+
composer_home: {
|
|
52
|
+
name: 'composer_home-data'
|
|
40
53
|
}
|
|
41
54
|
};
|
|
42
55
|
|
|
43
|
-
const isLinux =
|
|
44
|
-
const isWsl =
|
|
45
|
-
const isArm = (await getArch()) === 'arm64';
|
|
56
|
+
const isLinux = ctx.platform === 'linux';
|
|
57
|
+
const { isWsl } = ctx;
|
|
46
58
|
const isNotNativeLinux = (!isLinux || isWsl);
|
|
47
59
|
|
|
48
60
|
if (!isLinux) {
|
|
@@ -50,9 +62,17 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
50
62
|
* When CMA is running in non-native linux environment,
|
|
51
63
|
* we need also create named volumes for nginx to avoid performance penalty
|
|
52
64
|
*/
|
|
65
|
+
volumes.php = {
|
|
66
|
+
name: `${ prefix }_project-data`,
|
|
67
|
+
opt: {
|
|
68
|
+
type: 'nfs',
|
|
69
|
+
device: path.join(magentoDir),
|
|
70
|
+
o: 'bind'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
53
73
|
volumes.nginx = {
|
|
54
74
|
name: `${ prefix }_nginx-data`,
|
|
55
|
-
|
|
75
|
+
opt: {
|
|
56
76
|
type: 'nfs',
|
|
57
77
|
device: path.join(cacheDir, 'nginx', 'conf.d'),
|
|
58
78
|
o: 'bind'
|
|
@@ -60,7 +80,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
60
80
|
};
|
|
61
81
|
volumes.appPub = {
|
|
62
82
|
name: `${ prefix }_pub-data`,
|
|
63
|
-
|
|
83
|
+
opt: {
|
|
64
84
|
type: 'nfs',
|
|
65
85
|
device: path.join(magentoDir, 'pub'),
|
|
66
86
|
o: 'bind'
|
|
@@ -68,7 +88,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
68
88
|
};
|
|
69
89
|
volumes.appSetup = {
|
|
70
90
|
name: `${ prefix }_setup-data`,
|
|
71
|
-
|
|
91
|
+
opt: {
|
|
72
92
|
type: 'nfs',
|
|
73
93
|
device: path.join(magentoDir, 'setup'),
|
|
74
94
|
o: 'bind'
|
|
@@ -76,7 +96,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
76
96
|
};
|
|
77
97
|
volumes.sslTerminator = {
|
|
78
98
|
name: `${ prefix }_ssl-terminator-data`,
|
|
79
|
-
|
|
99
|
+
opt: {
|
|
80
100
|
type: 'nfs',
|
|
81
101
|
device: path.join(cacheDir, 'ssl-terminator', 'conf.d'),
|
|
82
102
|
o: 'bind'
|
|
@@ -86,7 +106,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
86
106
|
if (varnish.enabled) {
|
|
87
107
|
volumes.varnish = {
|
|
88
108
|
name: `${ prefix }_varnish-data`,
|
|
89
|
-
|
|
109
|
+
opt: {
|
|
90
110
|
type: 'nfs',
|
|
91
111
|
device: path.join(cacheDir, 'varnish'),
|
|
92
112
|
o: 'bind'
|
|
@@ -96,7 +116,42 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
const getContainers = (ports = {}) => {
|
|
119
|
+
/**
|
|
120
|
+
* @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions>}
|
|
121
|
+
*/
|
|
99
122
|
const dockerConfig = {
|
|
123
|
+
php: {
|
|
124
|
+
_: 'PHP',
|
|
125
|
+
ports: isNotNativeLinux ? [
|
|
126
|
+
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.fpm }:9000`
|
|
127
|
+
] : [],
|
|
128
|
+
forwardedPorts: [
|
|
129
|
+
isNotNativeLinux
|
|
130
|
+
? `127.0.0.1:${ ports.fpm }:9000`
|
|
131
|
+
: `127.0.0.1:${ ports.fpm }`
|
|
132
|
+
],
|
|
133
|
+
network: isNotNativeLinux ? network.name : 'host',
|
|
134
|
+
mountVolumes: [
|
|
135
|
+
`${ isLinux ? magentoDir : volumes.php.name }:${containerMagentoDir}`,
|
|
136
|
+
`${ volumes.composer_home.name }:/composer/home`,
|
|
137
|
+
`${ php.iniPath }:/usr/local/etc/php/php.ini`,
|
|
138
|
+
`${ php.fpmConfPath }:/usr/local/etc/php-fpm.d/zz-docker.conf`
|
|
139
|
+
],
|
|
140
|
+
env: {
|
|
141
|
+
COMPOSER_AUTH: process.env.COMPOSER_AUTH || '',
|
|
142
|
+
COMPOSER_HOME: '/composer/home'
|
|
143
|
+
},
|
|
144
|
+
restart: 'on-failure:5',
|
|
145
|
+
image: `local-cma-project:${ prefix }`,
|
|
146
|
+
debugImage: `local-cma-project:${ prefix }.debug`,
|
|
147
|
+
remoteImages: [
|
|
148
|
+
configuration.php.baseImage,
|
|
149
|
+
configuration.php.debugImage
|
|
150
|
+
],
|
|
151
|
+
name: `${ prefix }_php`,
|
|
152
|
+
connectCommand: ['/bin/sh'],
|
|
153
|
+
user: isLinux ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
|
|
154
|
+
},
|
|
100
155
|
sslTerminator: {
|
|
101
156
|
_: 'SSL Terminator (Nginx)',
|
|
102
157
|
ports: isNotNativeLinux ? [
|
|
@@ -117,13 +172,8 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
117
172
|
`${ isLinux ? path.join(cacheDir, 'ssl-terminator', 'conf.d') : volumes.sslTerminator.name }:/etc/nginx/conf.d`
|
|
118
173
|
],
|
|
119
174
|
restart: 'on-failure:5',
|
|
120
|
-
// TODO: use connect instead
|
|
121
175
|
network: isNotNativeLinux ? network.name : 'host',
|
|
122
|
-
image: `nginx:${ nginx.version }`,
|
|
123
|
-
imageDetails: {
|
|
124
|
-
name: 'nginx',
|
|
125
|
-
tag: nginx.version
|
|
126
|
-
},
|
|
176
|
+
image: `${ nginx.version ? `nginx:${ nginx.version }` : nginx.image }`,
|
|
127
177
|
name: `${ prefix }_ssl-terminator`,
|
|
128
178
|
command: "nginx -g 'daemon off;'"
|
|
129
179
|
},
|
|
@@ -145,21 +195,17 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
145
195
|
*/
|
|
146
196
|
mountVolumes: isLinux ? [
|
|
147
197
|
`${ cacheDir }/nginx/conf.d:/etc/nginx/conf.d`,
|
|
148
|
-
`${ path.join(magentoDir, 'pub') }:${path.join(
|
|
149
|
-
`${ path.join(magentoDir, 'setup') }:${path.join(
|
|
198
|
+
`${ path.join(magentoDir, 'pub') }:${path.join(containerMagentoDir, 'pub')}`,
|
|
199
|
+
`${ path.join(magentoDir, 'setup') }:${path.join(containerMagentoDir, 'setup')}`
|
|
150
200
|
] : [
|
|
151
201
|
`${ volumes.nginx.name }:/etc/nginx/conf.d`,
|
|
152
|
-
`${ volumes.appPub.name }:${path.join(
|
|
153
|
-
`${ volumes.appSetup.name }:${path.join(
|
|
202
|
+
`${ volumes.appPub.name }:${path.join(containerMagentoDir, 'pub')}`,
|
|
203
|
+
`${ volumes.appSetup.name }:${path.join(containerMagentoDir, 'setup')}`
|
|
154
204
|
],
|
|
155
205
|
restart: 'on-failure:5',
|
|
156
206
|
// TODO: use connect instead
|
|
157
207
|
network: isNotNativeLinux ? network.name : 'host',
|
|
158
|
-
image: `nginx:${ nginx.version }`,
|
|
159
|
-
imageDetails: {
|
|
160
|
-
name: 'nginx',
|
|
161
|
-
tag: nginx.version
|
|
162
|
-
},
|
|
208
|
+
image: `${ nginx.version ? `nginx:${ nginx.version }` : nginx.image }`,
|
|
163
209
|
name: `${ prefix }_nginx`,
|
|
164
210
|
command: "nginx -g 'daemon off;'"
|
|
165
211
|
},
|
|
@@ -173,56 +219,38 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
173
219
|
mounts: [`source=${ volumes.redis.name },target=/data`],
|
|
174
220
|
// TODO: use connect instead
|
|
175
221
|
network: network.name,
|
|
176
|
-
image: `redis:${ redis.version }`,
|
|
177
|
-
imageDetails: {
|
|
178
|
-
name: 'redis',
|
|
179
|
-
tag: redis.version
|
|
180
|
-
},
|
|
222
|
+
image: `${ redis.version ? `redis:${ redis.version }` : redis.image }`,
|
|
181
223
|
name: `${ prefix }_redis`,
|
|
182
224
|
connectCommand: ['redis-cli']
|
|
183
225
|
},
|
|
184
|
-
|
|
185
|
-
_:
|
|
226
|
+
mariadb: {
|
|
227
|
+
_: 'MariaDB',
|
|
186
228
|
healthCheck: {
|
|
187
229
|
cmd: 'mysqladmin ping --silent'
|
|
188
230
|
},
|
|
189
|
-
ports: [`127.0.0.1:${ ports.
|
|
190
|
-
forwardedPorts: [`127.0.0.1:${ ports.
|
|
191
|
-
|
|
231
|
+
ports: [`127.0.0.1:${ ports.mariadb }:3306`],
|
|
232
|
+
forwardedPorts: [`127.0.0.1:${ ports.mariadb }:3306`],
|
|
233
|
+
mountVolumes: [
|
|
234
|
+
`${ volumes.mariadb.name }:/var/lib/mysql`,
|
|
235
|
+
`${ path.join(baseConfig.cacheDir, 'mariadb.cnf') }:/etc/mysql/my.cnf`
|
|
236
|
+
],
|
|
192
237
|
env: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
238
|
+
MARIADB_PORT: 3306,
|
|
239
|
+
MARIADB_ROOT_PASSWORD: 'scandipwa',
|
|
240
|
+
MARIADB_USER: 'magento',
|
|
241
|
+
MARIADB_PASSWORD: 'magento',
|
|
242
|
+
MARIADB_DATABASE: 'magento'
|
|
198
243
|
},
|
|
199
|
-
/**
|
|
200
|
-
* When database dump contains functions, MySQL can throw and error "access denied for those functions"
|
|
201
|
-
* so to overcome this issue, we need to enable trust option for these functions to avoid errors during migrations.
|
|
202
|
-
*
|
|
203
|
-
* Documentation reference: https://dev.mysql.com/doc/refman/5.7/en/stored-programs-logging.html
|
|
204
|
-
*/
|
|
205
244
|
command: [
|
|
206
|
-
'--log_bin_trust_function_creators=1'
|
|
207
|
-
'--default-authentication-plugin=mysql_native_password',
|
|
208
|
-
'--max_allowed_packet=1GB',
|
|
209
|
-
'--bind-address=0.0.0.0'
|
|
245
|
+
'--log_bin_trust_function_creators=1'
|
|
210
246
|
]
|
|
211
|
-
.concat(!isArm ? ['--secure-file-priv=NULL'] : [])
|
|
212
247
|
.join(' '),
|
|
213
248
|
securityOptions: [
|
|
214
249
|
'seccomp=unconfined'
|
|
215
250
|
],
|
|
216
251
|
network: network.name,
|
|
217
|
-
image:
|
|
218
|
-
|
|
219
|
-
name: 'mysql',
|
|
220
|
-
tag: mysql.version
|
|
221
|
-
} : {
|
|
222
|
-
name: 'mariadb',
|
|
223
|
-
tag: mariadb.version
|
|
224
|
-
},
|
|
225
|
-
name: !isArm ? `${ prefix }_mysql` : `${ prefix }_mariadb`
|
|
252
|
+
image: `${ mariadb.version ? `mariadb:${ mariadb.version }` : mariadb.image }`,
|
|
253
|
+
name: `${ prefix }_mariadb`
|
|
226
254
|
},
|
|
227
255
|
elasticsearch: {
|
|
228
256
|
_: 'ElasticSearch',
|
|
@@ -232,20 +260,14 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
232
260
|
ports: [`127.0.0.1:${ ports.elasticsearch }:9200`],
|
|
233
261
|
forwardedPorts: [`127.0.0.1:${ ports.elasticsearch }:9200`],
|
|
234
262
|
mounts: [`source=${ volumes.elasticsearch.name },target=/usr/share/elasticsearch/data`],
|
|
235
|
-
env:
|
|
236
|
-
|
|
237
|
-
'xpack.security.enabled': false,
|
|
238
|
-
'discovery.type': 'single-node',
|
|
239
|
-
ES_JAVA_OPTS: '"-Xms512m -Xmx512m"',
|
|
263
|
+
env: deepmerge(
|
|
264
|
+
{
|
|
240
265
|
// https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-settings.html
|
|
241
|
-
|
|
242
|
-
|
|
266
|
+
'xpack.ml.enabled': ['sse4.2', 'sse4_2'].some((sse42Flag) => cpuSupportedFlags.includes(sse42Flag))
|
|
267
|
+
}, elasticsearch.env || defaultEsEnv
|
|
268
|
+
),
|
|
243
269
|
network: network.name,
|
|
244
|
-
image: `elasticsearch:${ elasticsearch.version }`,
|
|
245
|
-
imageDetails: {
|
|
246
|
-
name: 'elasticsearch',
|
|
247
|
-
tag: elasticsearch.version
|
|
248
|
-
},
|
|
270
|
+
image: `${ elasticsearch.version ? `elasticsearch:${ elasticsearch.version }` : elasticsearch.image }`,
|
|
249
271
|
name: `${ prefix }_elasticsearch`
|
|
250
272
|
}
|
|
251
273
|
};
|
|
@@ -256,14 +278,10 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
256
278
|
);
|
|
257
279
|
}
|
|
258
280
|
|
|
259
|
-
if (varnish.enabled) {
|
|
281
|
+
if (!ctx.debug && varnish.enabled) {
|
|
260
282
|
dockerConfig.varnish = {
|
|
261
283
|
_: 'Varnish',
|
|
262
|
-
image: `varnish:${ varnish.version }`,
|
|
263
|
-
imageDetails: {
|
|
264
|
-
name: 'varnish',
|
|
265
|
-
tag: varnish.version
|
|
266
|
-
},
|
|
284
|
+
image: `${ varnish.version ? `varnish:${ varnish.version }` : varnish.image }`,
|
|
267
285
|
name: `${ prefix }_varnish`,
|
|
268
286
|
mountVolumes: [
|
|
269
287
|
`${ isLinux ? path.join(cacheDir, 'varnish') : volumes.varnish.name }:/etc/varnish`
|
|
@@ -8,7 +8,9 @@ const getProjectConfiguration = () => ({
|
|
|
8
8
|
task: async (ctx) => {
|
|
9
9
|
const { magentoVersion } = ctx;
|
|
10
10
|
|
|
11
|
-
ctx.config = await getConfigFromMagentoVersion(
|
|
11
|
+
ctx.config = await getConfigFromMagentoVersion(ctx, {
|
|
12
|
+
magentoVersion
|
|
13
|
+
});
|
|
12
14
|
}
|
|
13
15
|
});
|
|
14
16
|
|
package/lib/config/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const {
|
|
|
5
5
|
defaultConfiguration
|
|
6
6
|
} = require('./versions');
|
|
7
7
|
const getPhpConfig = require('./php-config');
|
|
8
|
-
const getComposerConfig = require('./composer');
|
|
9
8
|
const { getMagentoConfig } = require('./magento-config');
|
|
10
9
|
const resolveConfigurationWithOverrides = require('../util/resolve-configuration-with-overrides');
|
|
11
10
|
const { getPrefix, folderName } = require('../util/prefix');
|
|
@@ -15,11 +14,12 @@ const platforms = ['linux', 'darwin'];
|
|
|
15
14
|
const darwinMinimalVersion = '10.5';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
|
-
* @returns {
|
|
17
|
+
* @returns {import('../../typings/context').ListrContext['config']['baseConfig']}
|
|
19
18
|
*/
|
|
20
19
|
const getBaseConfig = (projectPath = process.cwd(), prefix = folderName) => ({
|
|
21
20
|
prefix: getPrefix(prefix),
|
|
22
21
|
magentoDir: projectPath,
|
|
22
|
+
containerMagentoDir: projectPath,
|
|
23
23
|
templateDir: path.join(__dirname, 'templates'),
|
|
24
24
|
cacheDir: path.join(projectPath, 'node_modules', '.create-magento-app-cache')
|
|
25
25
|
});
|
|
@@ -27,14 +27,19 @@ const getBaseConfig = (projectPath = process.cwd(), prefix = folderName) => ({
|
|
|
27
27
|
const baseConfig = getBaseConfig();
|
|
28
28
|
|
|
29
29
|
const magento = {
|
|
30
|
-
binPath: path.join(baseConfig.magentoDir, 'bin', 'magento')
|
|
30
|
+
binPath: path.join(baseConfig.magentoDir, 'bin', 'magento'),
|
|
31
|
+
containerBinPath: path.join(baseConfig.containerMagentoDir, 'bin', 'magento')
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
module.exports = {
|
|
34
35
|
/**
|
|
35
36
|
* @param {string} magentoVersion
|
|
36
37
|
*/
|
|
37
|
-
async getConfigFromMagentoVersion(
|
|
38
|
+
async getConfigFromMagentoVersion(ctx, {
|
|
39
|
+
magentoVersion,
|
|
40
|
+
projectPath = process.cwd(),
|
|
41
|
+
prefix = folderName
|
|
42
|
+
}) {
|
|
38
43
|
const newBaseConfig = getBaseConfig(projectPath, prefix);
|
|
39
44
|
const configurations = getConfigurations(newBaseConfig);
|
|
40
45
|
if (!configurations[magentoVersion]) {
|
|
@@ -52,8 +57,7 @@ module.exports = {
|
|
|
52
57
|
|
|
53
58
|
return {
|
|
54
59
|
php: getPhpConfig(overridenConfiguration.configuration, newBaseConfig),
|
|
55
|
-
docker: await getDockerConfig(overridenConfiguration, newBaseConfig),
|
|
56
|
-
composer: getComposerConfig(overridenConfiguration.configuration, newBaseConfig),
|
|
60
|
+
docker: await getDockerConfig(ctx, overridenConfiguration, newBaseConfig),
|
|
57
61
|
magentoConfiguration: getMagentoConfig(overridenConfiguration.magento),
|
|
58
62
|
baseConfig: newBaseConfig,
|
|
59
63
|
overridenConfiguration,
|
|
@@ -65,7 +69,6 @@ module.exports = {
|
|
|
65
69
|
getBaseConfig,
|
|
66
70
|
magento,
|
|
67
71
|
platforms,
|
|
68
|
-
docker: getDockerConfig(defaultConfiguration, baseConfig),
|
|
69
72
|
darwinMinimalVersion,
|
|
70
73
|
defaultConfiguration
|
|
71
74
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const magento23RequiredPHPExtensions = require('./magento-2.3');
|
|
2
|
+
const magento24RequiredPHPExtensions = require('./magento-2.4');
|
|
3
|
+
|
|
4
|
+
const { phpExtensionInstallationInstructions } = require('../../php/extensions');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {string[]} requiredPHPExtensions
|
|
8
|
+
* @returns {Record<string, import('../../../../typings/index').PHPExtensionInstallationInstruction>}
|
|
9
|
+
*/
|
|
10
|
+
const mapMagentoRequiredExtensionsToInstructions = (requiredPHPExtensions) => requiredPHPExtensions.map((extensionName) => {
|
|
11
|
+
if (phpExtensionInstallationInstructions[extensionName]) {
|
|
12
|
+
return phpExtensionInstallationInstructions[extensionName];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (const [extensionName, extensionData] of Object.entries(phpExtensionInstallationInstructions)) {
|
|
16
|
+
if (extensionData.alternativeName && extensionData.alternativeName.includes(extensionName)) {
|
|
17
|
+
return extensionData;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
name: extensionName
|
|
23
|
+
};
|
|
24
|
+
}).reduce((acc, val) => ({ ...acc, [val.name]: val }), {});
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
magento23PHPExtensionList: mapMagentoRequiredExtensionsToInstructions(magento23RequiredPHPExtensions),
|
|
28
|
+
magento24PHPExtensionList: mapMagentoRequiredExtensionsToInstructions(magento24RequiredPHPExtensions)
|
|
29
|
+
};
|