@scandipwa/magento-scripts 1.15.6 → 1.16.0-alpha.1
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/execute.js +4 -1
- package/lib/commands/logs.js +3 -0
- package/lib/config/dependencies-for-platforms.js +19 -4
- package/lib/config/docker.js +20 -1
- package/lib/config/php/extensions/index.js +2 -1
- package/lib/config/php/extensions/xdebug.js +9 -0
- package/lib/config/php/releases/index.js +6 -0
- package/lib/config/php/releases/php-7.2.js +25 -0
- package/lib/config/php/releases/php-7.3.js +25 -0
- package/lib/config/php/releases/php-7.4.js +23 -0
- package/lib/config/php/releases/php-8.1.js +25 -0
- package/lib/config/php-config.js +2 -2
- package/lib/config/templates/ssl-terminator.template.conf +6 -0
- package/lib/config/versions/magento-2.3.0.js +2 -21
- package/lib/config/versions/magento-2.3.1.js +2 -21
- package/lib/config/versions/magento-2.3.2-p2.js +2 -21
- package/lib/config/versions/magento-2.3.2.js +2 -21
- package/lib/config/versions/magento-2.3.3-p1.js +2 -21
- package/lib/config/versions/magento-2.3.3.js +2 -21
- package/lib/config/versions/magento-2.3.4-p2.js +2 -21
- package/lib/config/versions/magento-2.3.4.js +2 -21
- package/lib/config/versions/magento-2.3.5-p1.js +2 -21
- package/lib/config/versions/magento-2.3.5-p2.js +2 -21
- package/lib/config/versions/magento-2.3.5.js +2 -21
- package/lib/config/versions/magento-2.3.6-p1.js +2 -21
- package/lib/config/versions/magento-2.3.6.js +2 -21
- package/lib/config/versions/magento-2.3.7-p1.js +2 -19
- package/lib/config/versions/magento-2.3.7-p2.js +2 -19
- package/lib/config/versions/magento-2.3.7-p3.js +2 -19
- package/lib/config/versions/magento-2.3.7.js +2 -19
- package/lib/config/versions/magento-2.4.0-p1.js +2 -19
- package/lib/config/versions/magento-2.4.0.js +2 -19
- package/lib/config/versions/magento-2.4.1-p1.js +6 -19
- package/lib/config/versions/magento-2.4.1.js +2 -19
- package/lib/config/versions/magento-2.4.2-p1.js +6 -20
- package/lib/config/versions/magento-2.4.2-p2.js +6 -19
- package/lib/config/versions/magento-2.4.2.js +6 -19
- package/lib/config/versions/magento-2.4.3-p1.js +6 -19
- package/lib/config/versions/magento-2.4.3-p2.js +6 -19
- package/lib/config/versions/magento-2.4.3.js +6 -19
- package/lib/config/versions/magento-2.4.4.js +2 -22
- package/lib/tasks/composer/install-prestissimo.js +52 -2
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +1 -3
- package/lib/tasks/file-system/create-ssl-terminator-config.js +3 -3
- package/lib/tasks/import-dump.js +13 -5
- package/lib/tasks/magento/enable-magento-composer-plugins.js +1 -1
- package/lib/tasks/magento/index.js +1 -1
- package/lib/tasks/magento/{install-magento.js → install-magento-project.js} +5 -4
- package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +13 -9
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +1 -1
- package/lib/tasks/magento/setup-magento/create-admin.js +1 -1
- package/lib/tasks/magento/setup-magento/disable-2fa.js +1 -1
- package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +1 -1
- package/lib/tasks/magento/setup-magento/disable-page-builder.js +1 -1
- package/lib/tasks/magento/setup-magento/flush-redis-config.js +1 -1
- package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +1 -1
- package/lib/tasks/magento/setup-magento/index-products.js +1 -1
- package/lib/tasks/magento/setup-magento/index.js +5 -4
- package/lib/tasks/magento/setup-magento/install-magento.js +4 -2
- package/lib/tasks/magento/setup-magento/migrate-database.js +25 -10
- package/lib/tasks/magento/setup-magento/set-base-url.js +1 -1
- package/lib/tasks/magento/setup-magento/set-deployment-mode.js +1 -1
- package/lib/tasks/magento/setup-magento/set-url-rewrite.js +1 -3
- package/lib/tasks/magento/setup-magento/upgrade-magento.js +1 -1
- package/lib/tasks/magento/setup-magento/urn-highlighter.js +4 -4
- package/lib/tasks/magento/setup-magento/varnish-config.js +1 -2
- package/lib/tasks/magento/setup-magento/waiting-for-redis.js +1 -1
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +1 -1
- package/lib/tasks/php/bundled-extensions.js +0 -1
- package/lib/tasks/php/extensions/index.js +3 -5
- package/lib/tasks/php/update-env-php.js +34 -2
- package/lib/tasks/php/update-env.php +22 -8
- package/lib/tasks/requirements/dependency/mac.js +102 -25
- package/lib/tasks/requirements/phpbrew/install.js +4 -74
- package/lib/tasks/start.js +2 -2
- package/lib/tasks/status/index.js +7 -3
- package/lib/tasks/theme/link-theme.js +0 -2
- package/lib/tasks/theme/setup-themes.js +1 -5
- package/lib/util/exec-async-command.js +20 -12
- package/lib/util/install-dependencies-task.js +4 -6
- package/lib/util/is-running-root.js +3 -1
- package/package.json +2 -2
- package/typings/context.d.ts +1 -0
- package/lib/tasks/theme/setup-persisted-query.js +0 -63
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
1
5
|
const semver = require('semver');
|
|
6
|
+
const { baseConfig } = require('../../config');
|
|
7
|
+
const getJsonfileData = require('../../util/get-jsonfile-data');
|
|
8
|
+
const pathExists = require('../../util/path-exists');
|
|
2
9
|
const runComposerCommand = require('../../util/run-composer');
|
|
3
10
|
|
|
11
|
+
const globalComposerJsonPath = path.join(os.homedir(), '.config', 'composer', 'composer.json');
|
|
12
|
+
const localComposerJsonPath = path.join(baseConfig.magentoDir, 'composer.json');
|
|
13
|
+
const prestissimoPluginName = 'hirak/prestissimo';
|
|
14
|
+
|
|
4
15
|
/**
|
|
5
16
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
6
17
|
*/
|
|
@@ -10,10 +21,49 @@ const prestissimoInstall = () => ({
|
|
|
10
21
|
const { magentoVersion, composerVersion } = ctx;
|
|
11
22
|
|
|
12
23
|
if (semver.satisfies(composerVersion, '^2')) {
|
|
24
|
+
if (await pathExists(globalComposerJsonPath) && semver.satisfies(composerVersion, '^2.2.0')) {
|
|
25
|
+
const globalComposerJsonData = await getJsonfileData(globalComposerJsonPath);
|
|
26
|
+
const hasPrestissimoInstalled = globalComposerJsonData
|
|
27
|
+
&& globalComposerJsonData.require
|
|
28
|
+
&& !!globalComposerJsonData.require[prestissimoPluginName];
|
|
29
|
+
|
|
30
|
+
if (await pathExists(localComposerJsonPath)) {
|
|
31
|
+
const localComposerJsonData = await getJsonfileData(localComposerJsonPath);
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
hasPrestissimoInstalled
|
|
35
|
+
&& localComposerJsonData
|
|
36
|
+
&& localComposerJsonData.config
|
|
37
|
+
&& localComposerJsonData.config['allow-plugins']
|
|
38
|
+
&& typeof localComposerJsonData.config['allow-plugins'][prestissimoPluginName] !== 'boolean'
|
|
39
|
+
) {
|
|
40
|
+
const disableConfirmation = await task.prompt({
|
|
41
|
+
type: 'Select',
|
|
42
|
+
message: `We noticed that you have Composer ${ctx.composerVersion}, but you have ${logger.style.code(prestissimoPluginName)} installed, which is used only in Composer 1.
|
|
43
|
+
Would you like to disable it in your project?`,
|
|
44
|
+
choices: [
|
|
45
|
+
{
|
|
46
|
+
name: 'disable',
|
|
47
|
+
message: 'Disable it, thanks'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'skip',
|
|
51
|
+
message: 'Skip this step'
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (disableConfirmation === 'disable') {
|
|
57
|
+
localComposerJsonData.config['allow-plugins'][prestissimoPluginName] = false;
|
|
58
|
+
await fs.promises.writeFile(localComposerJsonPath, JSON.stringify(localComposerJsonData, null, 4), 'utf-8');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
13
63
|
task.skip();
|
|
14
64
|
return;
|
|
15
65
|
}
|
|
16
|
-
const { code } = await runComposerCommand(
|
|
66
|
+
const { code } = await runComposerCommand(`global show ${prestissimoPluginName}`, {
|
|
17
67
|
throwNonZeroCode: false,
|
|
18
68
|
magentoVersion
|
|
19
69
|
});
|
|
@@ -23,7 +73,7 @@ const prestissimoInstall = () => ({
|
|
|
23
73
|
return;
|
|
24
74
|
}
|
|
25
75
|
|
|
26
|
-
await runComposerCommand(
|
|
76
|
+
await runComposerCommand(`global require ${prestissimoPluginName}`, {
|
|
27
77
|
magentoVersion,
|
|
28
78
|
callback: (t) => {
|
|
29
79
|
task.output = t;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { loadXmlFile, buildXmlFile } = require('../../../../config/xml-parser');
|
|
2
2
|
const pathExists = require('../../../../util/path-exists');
|
|
3
|
-
const { getPhpConfig } = require('../php-config/php-config');
|
|
4
3
|
const { setupXMLStructure } = require('../setup-xml-structure');
|
|
5
4
|
const setupComposerSettings = require('./composer-settings-config');
|
|
6
5
|
const setupFormatOnSave = require('./format-setting-config');
|
|
@@ -17,7 +16,6 @@ const setupWorkspaceConfig = () => ({
|
|
|
17
16
|
title: 'Set up Workspace configuration',
|
|
18
17
|
task: async (ctx, task) => {
|
|
19
18
|
const workspaceConfig = getWorkspaceConfig(ctx.config.overridenConfiguration);
|
|
20
|
-
const phpConfig = getPhpConfig(ctx.config.overridenConfiguration);
|
|
21
19
|
if (await pathExists(workspaceConfig.path)) {
|
|
22
20
|
const workspaceConfiguration = setupXMLStructure(await loadXmlFile(workspaceConfig.path));
|
|
23
21
|
const workspaceConfigs = workspaceConfiguration.project.component;
|
|
@@ -29,7 +27,7 @@ const setupWorkspaceConfig = () => ({
|
|
|
29
27
|
]);
|
|
30
28
|
|
|
31
29
|
if (hasChanges.includes(true)) {
|
|
32
|
-
await buildXmlFile(
|
|
30
|
+
await buildXmlFile(workspaceConfig.path, workspaceConfiguration);
|
|
33
31
|
} else {
|
|
34
32
|
task.skip();
|
|
35
33
|
}
|
|
@@ -38,9 +38,9 @@ const createSSLTerminatorConfig = () => ({
|
|
|
38
38
|
throw new KnownError('ssl.ssl_certificate_key file does not exist!');
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
if (!await pathExists(
|
|
43
|
-
await fs.promises.mkdir(
|
|
41
|
+
const sslTerminatorCacheDir = path.join(baseConfig.cacheDir, 'ssl-terminator', 'conf.d');
|
|
42
|
+
if (!await pathExists(sslTerminatorCacheDir)) {
|
|
43
|
+
await fs.promises.mkdir(sslTerminatorCacheDir, { recursive: true });
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
await fs.promises.copyFile(
|
package/lib/tasks/import-dump.js
CHANGED
|
@@ -31,12 +31,20 @@ const importDump = () => ({
|
|
|
31
31
|
configureProject(),
|
|
32
32
|
{
|
|
33
33
|
title: 'Installing Magento',
|
|
34
|
-
// skip setup if env.php and config.php are present in app/etc folder
|
|
35
|
-
skip: () =>
|
|
34
|
+
// skip setup if env.php and config.php are present in app/etc folder and db is not empty
|
|
35
|
+
skip: async (ctx) => {
|
|
36
|
+
const isFsMatching = await matchFilesystem(path.join(process.cwd(), 'app', 'etc'), ['config.php', 'env.php']);
|
|
37
|
+
const { mysqlConnection } = ctx;
|
|
38
|
+
const [[{ tableCount }]] = await mysqlConnection.query(`
|
|
39
|
+
SELECT count(*) AS tableCount
|
|
40
|
+
FROM INFORMATION_SCHEMA.TABLES
|
|
41
|
+
WHERE TABLE_SCHEMA = 'magento';
|
|
42
|
+
`);
|
|
43
|
+
|
|
44
|
+
return tableCount !== 0 || !isFsMatching;
|
|
45
|
+
},
|
|
36
46
|
task: (subCtx, subTask) => subTask.newListr(
|
|
37
|
-
setupMagento({
|
|
38
|
-
onlyInstallMagento: true
|
|
39
|
-
})
|
|
47
|
+
setupMagento({ onlyInstallMagento: true })
|
|
40
48
|
)
|
|
41
49
|
},
|
|
42
50
|
dumpThemeConfig(),
|
|
@@ -75,7 +75,7 @@ const enableMagentoComposerPlugins = () => ({
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
task.title = 'Checking allowed
|
|
78
|
+
task.title = 'Checking allowed Composer plugins...';
|
|
79
79
|
|
|
80
80
|
const composerPlugins = await getInstalledComposerPlugins();
|
|
81
81
|
const composerJsonData = await getJsonfileData(composerJsonPath);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
2
|
+
installMagentoProject: require('./install-magento-project'),
|
|
3
3
|
setupMagento: require('./setup-magento'),
|
|
4
4
|
uninstallMagento: require('./uninstall-magento'),
|
|
5
5
|
removeMagento: require('./remove-magento')
|
|
@@ -8,6 +8,7 @@ const getJsonFileData = require('../../util/get-jsonfile-data');
|
|
|
8
8
|
const rmdirSafe = require('../../util/rmdir-safe');
|
|
9
9
|
const KnownError = require('../../errors/known-error');
|
|
10
10
|
const UnknownError = require('../../errors/unknown-error');
|
|
11
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
11
12
|
|
|
12
13
|
const magentoProductEnterpriseEdition = 'magento/product-enterprise-edition';
|
|
13
14
|
const magentoProductCommunityEdition = 'magento/product-community-edition';
|
|
@@ -124,9 +125,9 @@ const createMagentoProject = async ({
|
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
/**
|
|
127
|
-
* @
|
|
128
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
128
129
|
*/
|
|
129
|
-
const
|
|
130
|
+
const installMagentoProject = () => ({
|
|
130
131
|
title: 'Installing Magento',
|
|
131
132
|
task: async (ctx, task) => {
|
|
132
133
|
const { magentoVersion, config: { baseConfig, overridenConfiguration }, verbose } = ctx;
|
|
@@ -190,7 +191,7 @@ const installMagento = () => ({
|
|
|
190
191
|
} catch (e) {
|
|
191
192
|
if (e.message.includes('man-in-the-middle attack')) {
|
|
192
193
|
throw new KnownError(`Probably you haven't setup pubkeys in composer.
|
|
193
|
-
Please run composer diagnose in cli to get mode.\n\n${e}`);
|
|
194
|
+
Please run ${logger.style.command('composer diagnose')} in cli to get mode.\n\n${e}`);
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
throw new UnknownError(`Unexpected error during composer install.\n\n${e}`);
|
|
@@ -202,4 +203,4 @@ Please run composer diagnose in cli to get mode.\n\n${e}`);
|
|
|
202
203
|
}
|
|
203
204
|
});
|
|
204
205
|
|
|
205
|
-
module.exports =
|
|
206
|
+
module.exports = installMagentoProject;
|
|
@@ -2,21 +2,25 @@ const envPhpToJson = require('../../../util/env-php-json');
|
|
|
2
2
|
const magentoTask = require('../../../util/magento-task');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
5
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
6
6
|
*/
|
|
7
7
|
const disableFullPageCache = () => ({
|
|
8
8
|
title: 'Adjusting full_page cache setting',
|
|
9
9
|
task: async ({ magentoVersion, config }, task) => {
|
|
10
10
|
const { cache_types } = await envPhpToJson(process.cwd(), { magentoVersion });
|
|
11
|
+
if (cache_types && typeof cache_types.full_page === 'number') {
|
|
12
|
+
if (cache_types.full_page !== 0 && !config.overridenConfiguration.configuration.varnish.enabled) {
|
|
13
|
+
task.title = 'Disabling full_page cache in Magento';
|
|
14
|
+
return task.newListr(magentoTask('cache:disable full_page'));
|
|
15
|
+
}
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return task.newListr(magentoTask('cache:enable full_page'));
|
|
17
|
+
if (config.overridenConfiguration.configuration.varnish.enabled && cache_types.full_page !== 1) {
|
|
18
|
+
task.title = 'Enabling full_page cache in Magento (Varnish is enabled)';
|
|
19
|
+
return task.newListr(magentoTask('cache:enable full_page'));
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
task.skip('full_page cache type is not set in env.php');
|
|
23
|
+
return;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
task.skip();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { updateTableValues, isTableExists } = require('../../../util/database');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
module.exports = () => ({
|
|
7
7
|
title: 'Configuring Elasticsearch',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
module.exports = () => ({
|
|
7
7
|
title: 'Creating admin user',
|
|
@@ -2,7 +2,7 @@ const configPhpToJson = require('../../../util/config-php-json');
|
|
|
2
2
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
5
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
6
6
|
*/
|
|
7
7
|
module.exports = () => ({
|
|
8
8
|
title: 'Disabling 2fa for admin',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
const disableMaintenanceMode = () => ({
|
|
7
7
|
title: 'Disabling maintenance mode',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const magentoTask = require('../../../util/magento-task');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
const disablePageBuilder = () => ({
|
|
7
7
|
title: 'Disabling page builder in Magento',
|
|
@@ -5,7 +5,7 @@ const UnknownError = require('../../../errors/unknown-error');
|
|
|
5
5
|
const isLinux = os.platform() === 'linux';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
8
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
9
9
|
*/
|
|
10
10
|
module.exports = () => ({
|
|
11
11
|
title: 'Flushing Magento redis cache',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { updateTableValues } = require('../../../util/database');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
const increaseAdminSessionLifetime = () => ({
|
|
7
7
|
title: 'Increase admin session lifetime to 1 month',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const magentoTask = require('../../../util/magento-task');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
const indexProducts = () => ({
|
|
7
7
|
task: (ctx, task) => task.newListr(
|
|
@@ -7,14 +7,16 @@ const setBaseUrl = require('./set-base-url');
|
|
|
7
7
|
const disableMaintenanceMode = require('./disable-maintenance-mode');
|
|
8
8
|
const disable2fa = require('./disable-2fa');
|
|
9
9
|
const setUrlRewrite = require('./set-url-rewrite');
|
|
10
|
-
const updateEnvPHP = require('../../php/update-env-php');
|
|
11
10
|
const increaseAdminSessionLifetime = require('./increase-admin-session-lifetime');
|
|
12
11
|
const magentoTask = require('../../../util/magento-task');
|
|
13
12
|
const urnHighlighter = require('./urn-highlighter');
|
|
14
13
|
const waitingForVarnish = require('./waiting-for-varnish');
|
|
14
|
+
const adjustFullPageCache = require('./adjust-full-page-cache');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @
|
|
17
|
+
* @param {Object} [options]
|
|
18
|
+
* @param {Boolean} options.onlyInstallMagento
|
|
19
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
18
20
|
*/
|
|
19
21
|
const setupMagento = (options = {}) => ({
|
|
20
22
|
title: 'Setting up Magento',
|
|
@@ -24,7 +26,6 @@ const setupMagento = (options = {}) => ({
|
|
|
24
26
|
return task.newListr([
|
|
25
27
|
flushRedisConfig(),
|
|
26
28
|
waitingForRedis(),
|
|
27
|
-
updateEnvPHP(),
|
|
28
29
|
migrateDatabase({ onlyInstallMagento: true })
|
|
29
30
|
]);
|
|
30
31
|
}
|
|
@@ -32,7 +33,6 @@ const setupMagento = (options = {}) => ({
|
|
|
32
33
|
return task.newListr([
|
|
33
34
|
flushRedisConfig(),
|
|
34
35
|
waitingForRedis(),
|
|
35
|
-
updateEnvPHP(),
|
|
36
36
|
migrateDatabase(),
|
|
37
37
|
{
|
|
38
38
|
title: 'Configuring Magento settings',
|
|
@@ -49,6 +49,7 @@ const setupMagento = (options = {}) => ({
|
|
|
49
49
|
disableMaintenanceMode(),
|
|
50
50
|
disable2fa(),
|
|
51
51
|
urnHighlighter(),
|
|
52
|
+
adjustFullPageCache(),
|
|
52
53
|
magentoTask('cache:flush'),
|
|
53
54
|
waitingForVarnish()
|
|
54
55
|
], {
|
|
@@ -7,7 +7,9 @@ const envPhpToJson = require('../../../util/env-php-json');
|
|
|
7
7
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @param {Object} [param0]
|
|
11
|
+
* @param {Boolean} param0.isDbEmpty
|
|
12
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
11
13
|
*/
|
|
12
14
|
const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
13
15
|
title: 'Installing magento',
|
|
@@ -82,7 +84,7 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
82
84
|
--db-user='${ env.MYSQL_USER }' \
|
|
83
85
|
--db-password='${ env.MYSQL_PASSWORD }' \
|
|
84
86
|
--backend-frontname='${ magentoConfiguration.adminuri }' \
|
|
85
|
-
--no-interaction
|
|
87
|
+
--no-interaction`;
|
|
86
88
|
|
|
87
89
|
await runMagentoCommand(command, {
|
|
88
90
|
magentoVersion,
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const installMagentoProject = require('../install-magento-project');
|
|
1
3
|
const magentoTask = require('../../../util/magento-task');
|
|
2
4
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
3
5
|
const configureElasticsearch = require('./configure-elasticsearch');
|
|
4
6
|
const installMagento = require('./install-magento');
|
|
5
7
|
const upgradeMagento = require('./upgrade-magento');
|
|
6
8
|
const varnishConfigSetup = require('./varnish-config');
|
|
9
|
+
const pathExists = require('../../../util/path-exists');
|
|
10
|
+
const updateEnvPHP = require('../../php/update-env-php');
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
|
-
* @
|
|
13
|
+
* @param {Object} [options]
|
|
14
|
+
* @param {Boolean} options.onlyInstallMagento
|
|
15
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
10
16
|
*/
|
|
11
17
|
const migrateDatabase = (options = {}) => ({
|
|
12
18
|
title: 'Migrating database',
|
|
@@ -22,7 +28,11 @@ const migrateDatabase = (options = {}) => ({
|
|
|
22
28
|
WHERE TABLE_SCHEMA = 'magento';
|
|
23
29
|
`);
|
|
24
30
|
|
|
25
|
-
if (
|
|
31
|
+
if (
|
|
32
|
+
tableCount === 0
|
|
33
|
+
|| !(await pathExists(path.join(process.cwd(), 'app', 'etc', 'env.php'))
|
|
34
|
+
|| (!await pathExists(path.join(process.cwd(), 'app', 'etc', 'config.php'))))
|
|
35
|
+
) {
|
|
26
36
|
if (options.onlyInstallMagento) {
|
|
27
37
|
ctx.isSetupUpgradeNeeded = false;
|
|
28
38
|
return task.newListr(
|
|
@@ -32,10 +42,11 @@ const migrateDatabase = (options = {}) => ({
|
|
|
32
42
|
|
|
33
43
|
return task.newListr([
|
|
34
44
|
installMagento({ isDbEmpty: true }),
|
|
35
|
-
|
|
36
|
-
magentoTask('cache:enable'),
|
|
45
|
+
updateEnvPHP(),
|
|
37
46
|
varnishConfigSetup(),
|
|
38
|
-
configureElasticsearch()
|
|
47
|
+
configureElasticsearch(),
|
|
48
|
+
upgradeMagento(),
|
|
49
|
+
magentoTask('cache:enable')
|
|
39
50
|
], {
|
|
40
51
|
concurrent: false,
|
|
41
52
|
exitOnError: true,
|
|
@@ -45,6 +56,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
45
56
|
}
|
|
46
57
|
});
|
|
47
58
|
}
|
|
59
|
+
|
|
48
60
|
const { code } = await runMagentoCommand('setup:db:status', {
|
|
49
61
|
magentoVersion,
|
|
50
62
|
throwNonZeroCode: false
|
|
@@ -55,6 +67,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
55
67
|
ctx.isSetupUpgradeNeeded = false;
|
|
56
68
|
// no setup is needed, but still to be sure configure ES
|
|
57
69
|
return task.newListr([
|
|
70
|
+
updateEnvPHP(),
|
|
58
71
|
varnishConfigSetup(),
|
|
59
72
|
configureElasticsearch()
|
|
60
73
|
], {
|
|
@@ -70,16 +83,17 @@ const migrateDatabase = (options = {}) => ({
|
|
|
70
83
|
if (options.onlyInstallMagento) {
|
|
71
84
|
ctx.isSetupUpgradeNeeded = false;
|
|
72
85
|
return task.newListr(
|
|
73
|
-
|
|
86
|
+
installMagentoProject()
|
|
74
87
|
);
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
return task.newListr([
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
magentoTask('cache:enable'),
|
|
91
|
+
installMagentoProject(),
|
|
92
|
+
updateEnvPHP(),
|
|
81
93
|
varnishConfigSetup(),
|
|
82
|
-
configureElasticsearch()
|
|
94
|
+
configureElasticsearch(),
|
|
95
|
+
upgradeMagento(),
|
|
96
|
+
magentoTask('cache:enable')
|
|
83
97
|
], {
|
|
84
98
|
concurrent: false,
|
|
85
99
|
exitOnError: true,
|
|
@@ -91,6 +105,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
91
105
|
}
|
|
92
106
|
case 2: {
|
|
93
107
|
return task.newListr([
|
|
108
|
+
updateEnvPHP(),
|
|
94
109
|
varnishConfigSetup(),
|
|
95
110
|
configureElasticsearch(),
|
|
96
111
|
upgradeMagento()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { updateTableValues } = require('../../../util/database');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
module.exports = () => ({
|
|
7
7
|
title: 'Setting baseurl and secure baseurl',
|
|
@@ -2,7 +2,7 @@ const magentoTask = require('../../../util/magento-task');
|
|
|
2
2
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
5
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
6
6
|
*/
|
|
7
7
|
module.exports = () => ({
|
|
8
8
|
title: 'Switching Magento mode',
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
// const runMagentoCommand = require('../../../util/run-magento');
|
|
2
|
-
|
|
3
1
|
const { updateTableValues } = require('../../../util/database');
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
7
5
|
*/
|
|
8
6
|
const setUrlRewrite = () => ({
|
|
9
7
|
title: 'Setting up url-rewrites',
|
|
@@ -3,7 +3,7 @@ const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
|
3
3
|
const KnownError = require('../../../errors/known-error');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
7
7
|
*/
|
|
8
8
|
const upgradeMagento = () => ({
|
|
9
9
|
skip: (ctx) => {
|
|
@@ -4,18 +4,18 @@ const magentoTask = require('../../../util/magento-task');
|
|
|
4
4
|
const pathExists = require('../../../util/path-exists');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
8
8
|
*
|
|
9
9
|
* @reference https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-urn.html
|
|
10
10
|
*/
|
|
11
11
|
const urnHighlighter = () => ({
|
|
12
12
|
title: 'Generating URN highlighter',
|
|
13
13
|
task: async (ctx, task) => {
|
|
14
|
-
if (!await pathExists(path.
|
|
15
|
-
await fs.promises.mkdir(path.
|
|
14
|
+
if (!await pathExists(path.join(process.cwd(), './.idea'))) {
|
|
15
|
+
await fs.promises.mkdir(path.join(process.cwd(), './.idea'));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
if (await pathExists(path.
|
|
18
|
+
if (await pathExists(path.join(process.cwd(), './.idea/misc.xml'))) {
|
|
19
19
|
task.skip();
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
@@ -3,7 +3,7 @@ const { updateTableValues } = require('../../../util/database');
|
|
|
3
3
|
const getIsWsl = require('../../../util/is-wsl');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
7
7
|
*/
|
|
8
8
|
const varnishConfigSetup = () => ({
|
|
9
9
|
title: 'Varnish setup',
|
|
@@ -24,7 +24,6 @@ const varnishConfigSetup = () => ({
|
|
|
24
24
|
|
|
25
25
|
const isLinux = os.platform() === 'linux';
|
|
26
26
|
const isWsl = await getIsWsl();
|
|
27
|
-
// const host = (isLinux && !isWsl) ? 'localhost' : 'host.docker.internal';
|
|
28
27
|
|
|
29
28
|
if (varnishEnabled) {
|
|
30
29
|
await updateTableValues('core_config_data', [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const waitForIt = require('../../../util/wait-for-it');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
module.exports = () => ({
|
|
7
7
|
title: 'Waiting for Redis',
|
|
@@ -3,7 +3,7 @@ const KnownError = require('../../../errors/known-error');
|
|
|
3
3
|
const sleep = require('../../../util/sleep');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
7
7
|
*/
|
|
8
8
|
const waitingForVarnish = () => ({
|
|
9
9
|
title: 'Waiting for Varnish to return code 200',
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
-
const os = require('os');
|
|
5
4
|
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
6
5
|
const pathExists = require('../../../util/path-exists');
|
|
7
6
|
const phpbrewConfig = require('../../../config/phpbrew');
|
|
8
|
-
const { getArch } = require('../../../util/arch');
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Get enabled extensions list with versions
|
|
@@ -13,9 +11,9 @@ const { getArch } = require('../../../util/arch');
|
|
|
13
11
|
* @returns {Promise<{[key: string]: string}}>}
|
|
14
12
|
*/
|
|
15
13
|
const getEnabledExtensions = async ({ php }) => {
|
|
16
|
-
const isArmMac = await getArch() === 'arm64' && os.platform() === 'darwin';
|
|
17
14
|
const output = await execAsyncSpawn(
|
|
18
|
-
`${
|
|
15
|
+
`${ php.binPath } -c ${php.iniPath} -r 'foreach (get_loaded_extensions() as $extension) echo "$extension:" . phpversion($extension) . "\n";'`,
|
|
16
|
+
{ useRosetta2: true }
|
|
19
17
|
);
|
|
20
18
|
|
|
21
19
|
return output
|
|
@@ -49,7 +47,7 @@ const getDisabledExtensions = async ({ php }) => {
|
|
|
49
47
|
}
|
|
50
48
|
);
|
|
51
49
|
|
|
52
|
-
return extensionIniList.filter((f) => f.isFile() && f.name.endsWith('.disabled')).map((f) => f.name.replace('.disabled', ''));
|
|
50
|
+
return extensionIniList.filter((f) => f.isFile() && f.name.endsWith('.disabled')).map((f) => f.name.replace('.ini.disabled', ''));
|
|
53
51
|
};
|
|
54
52
|
|
|
55
53
|
/**
|