@scandipwa/magento-scripts 1.16.1 → 2.0.0-alpha.10
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/exec.js +71 -0
- package/index.js +1 -1
- package/lib/commands/cli.js +4 -6
- package/lib/commands/execute.js +3 -33
- 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 +103 -85
- 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 +6 -6
- 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 +9 -4
- 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-p4.js +44 -0
- 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-p3.js +46 -0
- package/lib/config/versions/magento-2.4.3.js +7 -7
- package/lib/config/versions/magento-2.4.4-p1.js +46 -0
- package/lib/config/versions/magento-2.4.4.js +9 -2
- package/lib/config/versions/magento-2.4.5.js +46 -0
- 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 +132 -0
- package/lib/tasks/docker/containers/container-api.js +163 -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.js +97 -0
- 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/enable-magento-composer-plugins.js +85 -30
- package/lib/tasks/magento/install-magento-project.js +32 -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 +3 -3
- 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 +130 -3
- package/lib/tasks/php/php-container.js +112 -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 +18 -13
- 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/execute-in-container.js +63 -0
- 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 +11 -10
- package/typings/context.d.ts +7 -13
- package/typings/index.d.ts +67 -85
- 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/execute/index.js +0 -23
- 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
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
|
-
const
|
|
3
|
+
const sodium = require('../php/extensions/sodium');
|
|
4
|
+
const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
|
|
5
|
+
const { php81 } = require('../php/versions');
|
|
4
6
|
const { sslTerminator } = require('../ssl-terminator');
|
|
5
7
|
const { varnish70 } = require('../varnish/varnish-7-0');
|
|
8
|
+
const { repo } = require('../php/base-repo');
|
|
6
9
|
|
|
7
10
|
module.exports = ({ templateDir } = {}) => ({
|
|
8
11
|
magentoVersion: '2.4.4',
|
|
9
12
|
isDefault: true,
|
|
10
13
|
configuration: {
|
|
11
|
-
php: php81({
|
|
14
|
+
php: php81({
|
|
15
|
+
templateDir,
|
|
16
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
17
|
+
baseImage: `${ repo }:php-8.1-magento-2.4`
|
|
18
|
+
}),
|
|
12
19
|
nginx: {
|
|
13
20
|
version: '1.18.0',
|
|
14
21
|
configTemplate: path.join(templateDir || '', 'nginx.template.conf')
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
|
+
const sodium = require('../php/extensions/sodium');
|
|
4
|
+
const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
|
|
5
|
+
const { php81 } = require('../php/versions');
|
|
6
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
7
|
+
const { varnish70 } = require('../varnish/varnish-7-0');
|
|
8
|
+
const { repo } = require('../php/base-repo');
|
|
9
|
+
|
|
10
|
+
module.exports = ({ templateDir } = {}) => ({
|
|
11
|
+
magentoVersion: '2.4.5',
|
|
12
|
+
isDefault: true,
|
|
13
|
+
configuration: {
|
|
14
|
+
php: php81({
|
|
15
|
+
templateDir,
|
|
16
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
17
|
+
baseImage: `${ repo }:php-8.1-magento-2.4`
|
|
18
|
+
}),
|
|
19
|
+
nginx: {
|
|
20
|
+
version: '1.18.0',
|
|
21
|
+
configTemplate: path.join(templateDir || '', 'nginx.template.conf')
|
|
22
|
+
},
|
|
23
|
+
redis: {
|
|
24
|
+
version: '6.0'
|
|
25
|
+
},
|
|
26
|
+
mysql: {
|
|
27
|
+
version: '8.0'
|
|
28
|
+
},
|
|
29
|
+
mariadb: {
|
|
30
|
+
version: '10.4'
|
|
31
|
+
},
|
|
32
|
+
elasticsearch: {
|
|
33
|
+
version: '7.17.5'
|
|
34
|
+
},
|
|
35
|
+
composer: {
|
|
36
|
+
version: '2'
|
|
37
|
+
},
|
|
38
|
+
varnish: varnish70({ templateDir }),
|
|
39
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
40
|
+
},
|
|
41
|
+
magento: defaultMagentoConfig,
|
|
42
|
+
host: 'localhost',
|
|
43
|
+
ssl: {
|
|
44
|
+
enabled: false
|
|
45
|
+
}
|
|
46
|
+
});
|
package/lib/tasks/cleanup.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const { removeCacheFolder } = require('./cache');
|
|
2
2
|
const { stopServices } = require('./docker');
|
|
3
|
-
const { removeVolumes } = require('./docker/
|
|
3
|
+
const { removeVolumes } = require('./docker/volume/tasks');
|
|
4
4
|
const {
|
|
5
5
|
uninstallMagento,
|
|
6
6
|
removeMagento
|
|
7
7
|
} = require('./magento');
|
|
8
8
|
const getMagentoVersionConfig = require('../config/get-magento-version-config');
|
|
9
|
-
const { stopPhpFpm } = require('./php-fpm');
|
|
9
|
+
// const { stopPhpFpm } = require('./php-fpm');
|
|
10
10
|
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
11
11
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ const cleanup = () => ({
|
|
|
19
19
|
checkConfigurationFile(),
|
|
20
20
|
getMagentoVersionConfig(),
|
|
21
21
|
getProjectConfiguration(),
|
|
22
|
-
stopPhpFpm(),
|
|
22
|
+
// stopPhpFpm(),
|
|
23
23
|
stopServices(),
|
|
24
24
|
removeVolumes(),
|
|
25
25
|
removeCacheFolder(),
|
|
@@ -1,127 +1,33 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const semver = require('semver');
|
|
4
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
5
|
-
const downloadFile = require('../../util/download-file');
|
|
6
|
-
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
7
|
-
const pathExists = require('../../util/path-exists');
|
|
8
1
|
const safeRegexExtract = require('../../util/safe-regex-extract');
|
|
9
|
-
const installPrestissimo = require('./install-prestissimo');
|
|
10
2
|
const UnknownError = require('../../errors/unknown-error');
|
|
11
|
-
const
|
|
3
|
+
const { runContainerImage } = require('../../util/run-container-image');
|
|
12
4
|
|
|
13
5
|
/**
|
|
14
|
-
* @param {import('../../../typings/context').ListrContext
|
|
6
|
+
* @param {import('../../../typings/context').ListrContext} ctx
|
|
15
7
|
* @returns {Promise<string>}
|
|
16
8
|
*/
|
|
17
|
-
const getComposerVersion = async (
|
|
18
|
-
const
|
|
9
|
+
const getComposerVersion = async (ctx) => {
|
|
10
|
+
const { php } = ctx.config.docker.getContainers(ctx.ports);
|
|
11
|
+
const composerVersionOutput = await runContainerImage(php.image, 'composer --version --no-ansi');
|
|
19
12
|
|
|
20
13
|
const composerVersion = safeRegexExtract({
|
|
21
14
|
string: composerVersionOutput,
|
|
22
15
|
regex: /composer.+(\d+\.\d+\.\d+)/i,
|
|
23
16
|
onNoMatch: () => {
|
|
24
|
-
throw new UnknownError(`
|
|
25
|
-
No composer version found in composer version output!\n\n${composerVersionOutput}
|
|
26
|
-
|
|
27
|
-
Follow steps below to resolve this issue:
|
|
28
|
-
1. Check ${logger.style.file(path.relative(process.cwd(), composer.binPath))} file content, inside this file should be Composer PHP code.
|
|
29
|
-
2. If file content is not correct, try deleting this file and run ${logger.style.command('start')} command again, CMA will try re-download this file.
|
|
30
|
-
3. If steps above didn't help, manually download Composer version ${composer.version} from ${logger.style.code('https://getcomposer.org/download/')} and put it inside cache directory ${logger.style.file(path.relative(process.cwd(), composer.dirPath))} with ${logger.style.code('composer.phar')} file name.
|
|
31
|
-
`);
|
|
17
|
+
throw new UnknownError(`No composer version found in composer version output!\n\n${composerVersionOutput}`);
|
|
32
18
|
}
|
|
33
19
|
});
|
|
34
20
|
|
|
35
21
|
return composerVersion;
|
|
36
22
|
};
|
|
37
23
|
|
|
38
|
-
/**
|
|
39
|
-
* @param {import('../../../typings/context').ListrContext['config']} param0
|
|
40
|
-
*/
|
|
41
|
-
const createComposerDir = async ({ composer }) => {
|
|
42
|
-
const dirExists = await pathExists(composer.dirPath);
|
|
43
|
-
if (!dirExists) {
|
|
44
|
-
await fs.promises.mkdir(composer.dirPath, { recursive: true });
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @param {import('../../../typings/context').ListrContext['config']} param0
|
|
50
|
-
*/
|
|
51
|
-
const downloadComposerBinary = async ({ composer }) => {
|
|
52
|
-
const composerVersion = /^\d$/.test(composer.version)
|
|
53
|
-
? `latest-${composer.version}.x`
|
|
54
|
-
: composer.version;
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
await downloadFile(`https://getcomposer.org/download/${composerVersion}/composer.phar`, {
|
|
58
|
-
destination: composer.binPath
|
|
59
|
-
});
|
|
60
|
-
} catch (e) {
|
|
61
|
-
throw new UnknownError(
|
|
62
|
-
`Unexpected issue, while installing composer.
|
|
63
|
-
Please see the error log below.\n\n${e}`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
24
|
/**
|
|
69
25
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
70
26
|
*/
|
|
71
|
-
const
|
|
72
|
-
title: '
|
|
27
|
+
const getComposerVersionTask = () => ({
|
|
28
|
+
title: 'Retrieving Composer version',
|
|
73
29
|
task: async (ctx, task) => {
|
|
74
|
-
const
|
|
75
|
-
const hasComposerInCache = await pathExists(composer.binPath);
|
|
76
|
-
|
|
77
|
-
if (!hasComposerInCache) {
|
|
78
|
-
task.title = 'Installing Composer';
|
|
79
|
-
await createComposerDir({ composer });
|
|
80
|
-
await downloadComposerBinary({ composer });
|
|
81
|
-
} else {
|
|
82
|
-
const currentComposerVersion = await getComposerVersion({ composer, php });
|
|
83
|
-
const expectedComposerVersion = /^\d$/.test(composer.version)
|
|
84
|
-
? `${composer.version}.x`
|
|
85
|
-
: composer.version;
|
|
86
|
-
|
|
87
|
-
if (!semver.satisfies(currentComposerVersion, expectedComposerVersion)) {
|
|
88
|
-
const continueComposerBinaryVersionSwitch = await task.prompt({
|
|
89
|
-
type: 'Select',
|
|
90
|
-
message: `You have Composer ${logger.style.misc(`${currentComposerVersion}`)} while your Magento version requires ${logger.style.misc(expectedComposerVersion)}!`,
|
|
91
|
-
choices: [
|
|
92
|
-
{
|
|
93
|
-
message: `Continue with current installed version (${logger.style.misc(`${currentComposerVersion}`)})`,
|
|
94
|
-
name: 'continue'
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
message: 'Install correct version and continue (you will probably have to fix composer dependencies versions)',
|
|
98
|
-
name: 'install-and-continue'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
message: 'Exit installation.',
|
|
102
|
-
name: 'exit'
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
switch (continueComposerBinaryVersionSwitch) {
|
|
108
|
-
case 'install-and-continue': {
|
|
109
|
-
await downloadComposerBinary({ composer });
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
case 'exit': {
|
|
113
|
-
throw new KnownError(`Current composer version ${logger.style.misc(`v${currentComposerVersion}`)} is not compatible with version ${logger.style.misc(expectedComposerVersion)}!`);
|
|
114
|
-
}
|
|
115
|
-
case 'continue':
|
|
116
|
-
default: {
|
|
117
|
-
ctx.continueWithExistingComposerVersion = true;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const composerVersion = await getComposerVersion({ composer, php });
|
|
30
|
+
const composerVersion = await getComposerVersion(ctx);
|
|
125
31
|
task.title = `Using Composer version ${composerVersion}`;
|
|
126
32
|
ctx.composerVersion = composerVersion;
|
|
127
33
|
},
|
|
@@ -130,4 +36,8 @@ const installComposer = () => ({
|
|
|
130
36
|
}
|
|
131
37
|
});
|
|
132
38
|
|
|
133
|
-
module.exports = {
|
|
39
|
+
module.exports = {
|
|
40
|
+
getComposerVersionTask,
|
|
41
|
+
// installPrestissimo,
|
|
42
|
+
getComposerVersion
|
|
43
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const mysql2 = require('mysql2/promise');
|
|
2
|
+
const UnknownError = require('../../errors/unknown-error');
|
|
3
|
+
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
4
|
+
const sleep = require('../../util/sleep');
|
|
5
|
+
const { createMagentoDatabase } = require('./create-magento-database');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
9
|
+
*/
|
|
10
|
+
const waitForDatabaseInitialization = () => ({
|
|
11
|
+
title: 'Waiting for Database to initialize',
|
|
12
|
+
task: async (ctx, task) => {
|
|
13
|
+
const { mariadb } = ctx.config.docker.getContainers();
|
|
14
|
+
|
|
15
|
+
let databaseReadyForConnections = false;
|
|
16
|
+
|
|
17
|
+
while (!databaseReadyForConnections) {
|
|
18
|
+
const databaseOutput = await execAsyncSpawn(`docker logs ${mariadb.name}`);
|
|
19
|
+
if (databaseOutput.includes('ready for connections')) {
|
|
20
|
+
databaseReadyForConnections = true;
|
|
21
|
+
break;
|
|
22
|
+
} else if (databaseOutput.includes('Initializing database files')) {
|
|
23
|
+
task.output = `${mariadb._} is initializing database files!
|
|
24
|
+
Please wait, this will take some time and do not restart the ${mariadb._} container until initialization is finished!`;
|
|
25
|
+
|
|
26
|
+
let databaseFinishedInitialization = false;
|
|
27
|
+
while (!databaseFinishedInitialization) {
|
|
28
|
+
const databaseOutput2 = await execAsyncSpawn(`docker logs ${mariadb.name}`);
|
|
29
|
+
if (databaseOutput2.includes('init process done.') && !databaseFinishedInitialization) {
|
|
30
|
+
databaseFinishedInitialization = true;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
await sleep(2000);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
await sleep(2000);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
options: {
|
|
41
|
+
bottomBar: 10
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
47
|
+
*/
|
|
48
|
+
const gettingDatabaseConnection = () => ({
|
|
49
|
+
title: 'Getting Database connection',
|
|
50
|
+
task: async (ctx, task) => {
|
|
51
|
+
const { config: { docker }, ports } = ctx;
|
|
52
|
+
const { mariadb } = docker.getContainers(ctx.ports);
|
|
53
|
+
let tries = 0;
|
|
54
|
+
const maxTries = 20;
|
|
55
|
+
const errors = [];
|
|
56
|
+
|
|
57
|
+
while (tries < maxTries) {
|
|
58
|
+
tries++;
|
|
59
|
+
try {
|
|
60
|
+
const connection = await mysql2.createConnection({
|
|
61
|
+
host: '127.0.0.1',
|
|
62
|
+
port: ports.mariadb,
|
|
63
|
+
user: mariadb.env.MARIADB_USER,
|
|
64
|
+
password: mariadb.env.MARIADB_PASSWORD,
|
|
65
|
+
database: mariadb.env.MARIADB_DATABASE
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
ctx.databaseConnection = connection;
|
|
69
|
+
break;
|
|
70
|
+
} catch (e) {
|
|
71
|
+
errors.push(e);
|
|
72
|
+
}
|
|
73
|
+
await sleep(1000);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (tries === maxTries) {
|
|
77
|
+
throw new UnknownError(`Unable to connect to ${ mariadb._ } server. Check your server configuration!\n\n${ errors.join(' ') }`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
task.title = `${ mariadb._ } server connected!`;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
86
|
+
*/
|
|
87
|
+
const terminatingExistingConnection = () => ({
|
|
88
|
+
title: 'Terminating existing Database connection',
|
|
89
|
+
skip: (ctx) => !ctx.databaseConnection,
|
|
90
|
+
task: (ctx) => {
|
|
91
|
+
ctx.databaseConnection.destroy();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
97
|
+
*/
|
|
98
|
+
const connectToDatabase = () => ({
|
|
99
|
+
title: 'Connecting to Database server',
|
|
100
|
+
skip: (ctx) => ctx.skipSetup,
|
|
101
|
+
task: (ctx, task) => task.newListr([
|
|
102
|
+
waitForDatabaseInitialization(),
|
|
103
|
+
createMagentoDatabase(),
|
|
104
|
+
terminatingExistingConnection(),
|
|
105
|
+
gettingDatabaseConnection()
|
|
106
|
+
], {
|
|
107
|
+
concurrent: false,
|
|
108
|
+
rendererOptions: {
|
|
109
|
+
collapse: true
|
|
110
|
+
}
|
|
111
|
+
}),
|
|
112
|
+
options: {
|
|
113
|
+
bottomBar: 10
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
module.exports = connectToDatabase;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Will create database 'magento' in MariaDB if it does not exist for some reason
|
|
5
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
6
|
+
*/
|
|
7
|
+
const createMagentoDatabase = () => ({
|
|
8
|
+
title: 'Creating Magento database',
|
|
9
|
+
task: async (ctx, task) => {
|
|
10
|
+
const { mariadb } = ctx.config.docker.getContainers();
|
|
11
|
+
task.title = `Creating Magento database in ${ mariadb._ }`;
|
|
12
|
+
await execAsyncSpawn(`docker exec ${mariadb.name} mysql -umagento -pmagento -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
createMagentoDatabase
|
|
18
|
+
};
|
|
@@ -6,9 +6,9 @@ const { isTableExists } = require('../../util/database');
|
|
|
6
6
|
const dumpThemeConfig = () => ({
|
|
7
7
|
title: 'Dumping themes and theme configuration',
|
|
8
8
|
task: async (ctx, task) => {
|
|
9
|
-
const {
|
|
9
|
+
const { databaseConnection } = ctx;
|
|
10
10
|
if (await isTableExists('magento', 'theme', ctx)) {
|
|
11
|
-
const [themes] = await
|
|
11
|
+
const [themes] = await databaseConnection.query('select * from theme;');
|
|
12
12
|
if (themes.length === 0) {
|
|
13
13
|
ctx.themeDump = {
|
|
14
14
|
themes: [],
|
|
@@ -17,7 +17,7 @@ const dumpThemeConfig = () => ({
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (await isTableExists('magento', 'core_config_data', ctx)) {
|
|
20
|
-
const [themeIdConfig] = await
|
|
20
|
+
const [themeIdConfig] = await databaseConnection.query('select * from core_config_data where path = \'design/theme/theme_id\';');
|
|
21
21
|
if (themeIdConfig.length !== 0) {
|
|
22
22
|
ctx.themeDump = {
|
|
23
23
|
themes,
|
|
@@ -8,14 +8,14 @@ const varnishConfigSetup = require('../magento/setup-magento/varnish-config');
|
|
|
8
8
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
9
9
|
*/
|
|
10
10
|
const enableForeignKeyCheck = () => ({
|
|
11
|
-
task: ({
|
|
11
|
+
task: ({ databaseConnection }) => databaseConnection.query('SET FOREIGN_KEY_CHECKS = 0;')
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
16
16
|
*/
|
|
17
17
|
const disableForeignKeyCheck = () => ({
|
|
18
|
-
task: ({
|
|
18
|
+
task: ({ databaseConnection }) => databaseConnection.query('SET FOREIGN_KEY_CHECKS = 1;')
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -4,7 +4,7 @@ const KnownError = require('../../errors/known-error');
|
|
|
4
4
|
const UnknownError = require('../../errors/unknown-error');
|
|
5
5
|
const { execAsyncSpawn, execCommandTask } = require('../../util/exec-async-command');
|
|
6
6
|
const pathExists = require('../../util/path-exists');
|
|
7
|
-
const
|
|
7
|
+
const connectToDatabase = require('./connect-to-database');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
@@ -13,10 +13,10 @@ const copyDatabaseDumpIntoContainer = () => ({
|
|
|
13
13
|
title: 'Copying database dump into container',
|
|
14
14
|
task: async (ctx, task) => {
|
|
15
15
|
const { config: { docker }, ports } = ctx;
|
|
16
|
-
const {
|
|
16
|
+
const { mariadb } = docker.getContainers(ports);
|
|
17
17
|
|
|
18
18
|
return task.newListr(
|
|
19
|
-
execCommandTask(`docker cp ${ctx.importDb} ${
|
|
19
|
+
execCommandTask(`docker cp ${ctx.importDb} ${mariadb.name}:/dump.sql`, {
|
|
20
20
|
logOutput: true
|
|
21
21
|
})
|
|
22
22
|
);
|
|
@@ -29,10 +29,10 @@ const copyDatabaseDumpIntoContainer = () => ({
|
|
|
29
29
|
const runSetGlobalLogBinTrustFunctionCreatorsCommand = () => ({
|
|
30
30
|
task: async (ctx, task) => {
|
|
31
31
|
const { config: { docker }, ports } = ctx;
|
|
32
|
-
const {
|
|
32
|
+
const { mariadb } = docker.getContainers(ports);
|
|
33
33
|
|
|
34
34
|
return task.newListr(
|
|
35
|
-
execCommandTask(`docker exec ${
|
|
35
|
+
execCommandTask(`docker exec ${mariadb.name} bash -c 'mysql -uroot -p${mariadb.env.MARIADB_ROOT_PASSWORD} -e "SET GLOBAL log_bin_trust_function_creators = 1;"'`)
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -63,8 +63,8 @@ Note that you will lose your existing database!`,
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
if (deleteDatabaseMagentoChoice === 'delete') {
|
|
66
|
-
await ctx.
|
|
67
|
-
await ctx.
|
|
66
|
+
await ctx.databaseConnection.query('DROP DATABASE IF EXISTS magento;');
|
|
67
|
+
await ctx.databaseConnection.query('CREATE DATABASE magento;');
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
task.skip();
|
|
@@ -77,28 +77,28 @@ Note that you will lose your existing database!`,
|
|
|
77
77
|
const executeImportDumpSQL = () => ({
|
|
78
78
|
task: async (ctx, task) => {
|
|
79
79
|
const { config: { docker }, ports } = ctx;
|
|
80
|
-
const {
|
|
80
|
+
const { mariadb } = docker.getContainers(ports);
|
|
81
81
|
|
|
82
|
-
const
|
|
82
|
+
const userCredentialsForMariaDBCLI = await task.prompt({
|
|
83
83
|
type: 'Select',
|
|
84
|
-
message:
|
|
84
|
+
message: `Which user do you want to use to import db in ${ mariadb._ } client?`,
|
|
85
85
|
choices: [
|
|
86
86
|
{
|
|
87
|
-
name: `--user=root --password=${
|
|
87
|
+
name: `--user=root --password=${mariadb.env.MARIADB_ROOT_PASSWORD}`,
|
|
88
88
|
message: `root (${logger.style.command('Probably safest option')})`
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
name: `--user=${
|
|
92
|
-
message: `${
|
|
91
|
+
name: `--user=${mariadb.env.MARIADB_USER} --password=${mariadb.env.MARIADB_PASSWORD}`,
|
|
92
|
+
message: `${mariadb.env.MARIADB_USER}`
|
|
93
93
|
}
|
|
94
94
|
]
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
const importCommand = `docker exec ${
|
|
97
|
+
const importCommand = `docker exec ${mariadb.name} bash -c "mysql ${userCredentialsForMariaDBCLI} magento < ./dump.sql"`;
|
|
98
98
|
|
|
99
99
|
const startImportTime = Date.now();
|
|
100
100
|
const tickInterval = setInterval(() => {
|
|
101
|
-
task.title = `Importing Database Dump To
|
|
101
|
+
task.title = `Importing Database Dump To ${ mariadb._ }, ${Math.floor((Date.now() - startImportTime) / 1000)}s in progress...`;
|
|
102
102
|
}, 1000);
|
|
103
103
|
|
|
104
104
|
try {
|
|
@@ -111,12 +111,55 @@ const executeImportDumpSQL = () => ({
|
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
} catch (e) {
|
|
114
|
-
if (e.includes('Unknown collation: \'utf8mb4_0900_ai_ci\'')) {
|
|
115
|
-
|
|
114
|
+
if (e.message.includes('Unknown collation: \'utf8mb4_0900_ai_ci\'')) {
|
|
115
|
+
const confirmFixingCollation = await task.prompt({
|
|
116
|
+
type: 'Select',
|
|
117
|
+
message: `We got the following error while trying to import ${logger.style.file('dump.sql')}!
|
|
118
|
+
|
|
119
|
+
${e.message}
|
|
120
|
+
|
|
121
|
+
To fix this error we suggest running the following commands:
|
|
122
|
+
${logger.style.command('sed -i \'s/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g\' dump.sql')}
|
|
123
|
+
`,
|
|
124
|
+
choices: [
|
|
125
|
+
{
|
|
126
|
+
name: 'yes',
|
|
127
|
+
message: 'Yes, run the following commands, I reaaaalllyy want dump to work! (this will not edit original dump.sql)'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'no',
|
|
131
|
+
message: 'Okay, I got it. Will try to fix myself'
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
if (confirmFixingCollation === 'yes') {
|
|
137
|
+
task.output = 'Running fix command...';
|
|
138
|
+
await execAsyncSpawn(`docker exec ${mariadb.name} bash -c "sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' dump.sql"`);
|
|
139
|
+
|
|
140
|
+
task.output = 'Trying to import dump again...';
|
|
141
|
+
try {
|
|
142
|
+
await execAsyncSpawn(
|
|
143
|
+
importCommand,
|
|
144
|
+
{
|
|
145
|
+
callback: (t) => {
|
|
146
|
+
task.output = t;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
return;
|
|
152
|
+
} catch (e) {
|
|
153
|
+
throw new KnownError(`Fixing ${logger.style.file('dump.sql')} collations did not helped, we got the following error:
|
|
154
|
+
${e.message}`);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
throw new KnownError(`Database dump import unsuccessful!
|
|
116
158
|
|
|
117
|
-
${e}
|
|
159
|
+
${e.message}
|
|
118
160
|
|
|
119
161
|
You can try replacing all occurrences of ${logger.style.misc('utf8mb4_0900_ai_ci')} with ${logger.style.misc('utf8mb4_general_ci')} in your ${logger.style.file(ctx.importDb)} file!`);
|
|
162
|
+
}
|
|
120
163
|
}
|
|
121
164
|
|
|
122
165
|
throw new UnknownError(`Unexpected error during dump import.\n\n${e}`);
|
|
@@ -132,8 +175,8 @@ You can try replacing all occurrences of ${logger.style.misc('utf8mb4_0900_ai_ci
|
|
|
132
175
|
/**
|
|
133
176
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
134
177
|
*/
|
|
135
|
-
const
|
|
136
|
-
title: 'Importing Database Dump
|
|
178
|
+
const importDumpToDatabase = () => ({
|
|
179
|
+
title: 'Importing Database Dump',
|
|
137
180
|
task: async (ctx, task) => {
|
|
138
181
|
if (!await pathExists(ctx.importDb)) {
|
|
139
182
|
throw new KnownError(`Dump file at ${ctx.importDb} does not exist. Please provide correct relative path to the file`);
|
|
@@ -144,7 +187,7 @@ const importDumpToMySQL = () => ({
|
|
|
144
187
|
deleteDatabaseBeforeImportingDumpPrompt(),
|
|
145
188
|
runSetGlobalLogBinTrustFunctionCreatorsCommand(),
|
|
146
189
|
executeImportDumpSQL(),
|
|
147
|
-
|
|
190
|
+
connectToDatabase(),
|
|
148
191
|
{
|
|
149
192
|
task: () => {
|
|
150
193
|
task.title = 'Database imported!';
|
|
@@ -158,4 +201,4 @@ const importDumpToMySQL = () => ({
|
|
|
158
201
|
}
|
|
159
202
|
});
|
|
160
203
|
|
|
161
|
-
module.exports =
|
|
204
|
+
module.exports = importDumpToDatabase;
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const databaseDumpCommandWithOptions = [
|
|
2
2
|
'mysqldump',
|
|
3
3
|
'magento',
|
|
4
4
|
'--skip-lock-tables',
|
|
@@ -9,4 +9,4 @@ const mysqlDumpCommandWithOptions = [
|
|
|
9
9
|
'--no-tablespaces'
|
|
10
10
|
];
|
|
11
11
|
|
|
12
|
-
module.exports =
|
|
12
|
+
module.exports = databaseDumpCommandWithOptions;
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const mergeFiles = require('merge-files');
|
|
2
2
|
const { orderTables, customerTables } = require('../../magento-tables');
|
|
3
3
|
const { execAsyncSpawn } = require('../../../../util/exec-async-command');
|
|
4
|
-
const
|
|
4
|
+
const databaseDumpCommandWithOptions = require('./database-dump-command');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @type {() => import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh').NodeSSH }>}
|
|
@@ -25,7 +25,7 @@ const readymageSSH = () => ({
|
|
|
25
25
|
*/
|
|
26
26
|
await ssh.execCommand(
|
|
27
27
|
[
|
|
28
|
-
...
|
|
28
|
+
...databaseDumpCommandWithOptions,
|
|
29
29
|
...[...orderTables, ...customerTables].map((table) => `--ignore-table=magento.${table}`),
|
|
30
30
|
'--result-file=dump-0.sql'
|
|
31
31
|
].join(' ')
|
|
@@ -33,7 +33,7 @@ const readymageSSH = () => ({
|
|
|
33
33
|
|
|
34
34
|
await ssh.execCommand(
|
|
35
35
|
[
|
|
36
|
-
...
|
|
36
|
+
...databaseDumpCommandWithOptions,
|
|
37
37
|
'--no-data',
|
|
38
38
|
'--result-file=dump-1.sql',
|
|
39
39
|
...[...orderTables, ...customerTables]
|
|
@@ -41,7 +41,7 @@ const readymageSSH = () => ({
|
|
|
41
41
|
);
|
|
42
42
|
} else {
|
|
43
43
|
task.output = 'Making remote database dump file with customers data...';
|
|
44
|
-
await ssh.execCommand([...
|
|
44
|
+
await ssh.execCommand([...databaseDumpCommandWithOptions, '--result-file=dump.sql'].join(' '));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (!noCompress) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const mergeFiles = require('merge-files');
|
|
2
2
|
const { orderTables, customerTables } = require('../../magento-tables');
|
|
3
3
|
const { execAsyncSpawn } = require('../../../../util/exec-async-command');
|
|
4
|
-
const
|
|
4
|
+
const databaseDumpCommandWithOptions = require('./database-dump-command');
|
|
5
5
|
const KnownError = require('../../../../errors/known-error');
|
|
6
6
|
/**
|
|
7
7
|
* @type {() => import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh').NodeSSH }>}
|
|
@@ -27,7 +27,7 @@ Do not enter "--result-file" option, we need to control that part.
|
|
|
27
27
|
|
|
28
28
|
(documentation reference available here: https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)
|
|
29
29
|
`,
|
|
30
|
-
initial:
|
|
30
|
+
initial: databaseDumpCommandWithOptions.join(' ')
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
if (dumpCommand.includes('--result-file')) {
|