@scandipwa/magento-scripts 2.0.0 → 2.0.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/status.js +12 -2
- package/lib/config/dependencies-for-platforms.js +1 -113
- package/lib/config/docker.js +3 -3
- package/lib/config/magento/required-php-extensions/index.js +1 -1
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.10.js +11 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.12.js +11 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.16.js +11 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.17.js +11 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.6.js +11 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.7.js +11 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-7.9.js +11 -0
- package/lib/config/services/elasticsearch/versions/index.js +15 -1
- package/lib/config/services/mariadb/versions/index.js +5 -0
- package/lib/config/services/mariadb/versions/mariadb-10.2.js +8 -0
- package/lib/config/services/mariadb/versions/mariadb-10.3.js +8 -0
- package/lib/config/services/mariadb/versions/mariadb-10.4.js +8 -0
- package/lib/config/{php → services/php}/base-repo.js +0 -0
- package/lib/config/{php → services/php}/extensions/apcu.js +0 -0
- package/lib/config/{php → services/php}/extensions/bcmath.js +0 -0
- package/lib/config/{php → services/php}/extensions/curl.js +0 -0
- package/lib/config/{php → services/php}/extensions/gd.js +0 -0
- package/lib/config/{php → services/php}/extensions/index.js +0 -0
- package/lib/config/{php → services/php}/extensions/intl.js +0 -0
- package/lib/config/{php → services/php}/extensions/opcache.js +0 -0
- package/lib/config/{php → services/php}/extensions/pdo_mysql.js +0 -0
- package/lib/config/{php → services/php}/extensions/soap.js +0 -0
- package/lib/config/{php → services/php}/extensions/sodium.js +0 -0
- package/lib/config/{php → services/php}/extensions/xdebug.js +0 -0
- package/lib/config/{php → services/php}/extensions/xsl.js +0 -0
- package/lib/config/{php → services/php}/extensions/zip.js +0 -0
- package/lib/config/{php → services/php}/versions/index.js +0 -0
- package/lib/config/{php → services/php}/versions/php-7.2.js +0 -0
- package/lib/config/{php → services/php}/versions/php-7.3.js +0 -0
- package/lib/config/{php → services/php}/versions/php-7.4.js +0 -0
- package/lib/config/{php → services/php}/versions/php-8.1.js +0 -0
- package/lib/config/services/redis/index.js +5 -0
- package/lib/config/services/redis/redis-5.0.js +8 -0
- package/lib/config/services/redis/redis-6.0.js +8 -0
- package/lib/config/services/redis/redis-6.2.js +8 -0
- package/lib/config/services/varnish/index.js +5 -0
- package/lib/config/{varnish → services/varnish}/varnish-6-0.js +1 -3
- package/lib/config/{varnish → services/varnish}/varnish-6-6.js +1 -3
- package/lib/config/{varnish → services/varnish}/varnish-7-0.js +1 -3
- package/lib/config/templates/nginx.template.conf +1 -1
- package/lib/config/versions/magento-2.2.10.js +7 -9
- package/lib/config/versions/magento-2.3.0.js +7 -9
- package/lib/config/versions/magento-2.3.1.js +7 -9
- package/lib/config/versions/magento-2.3.2-p1.js +7 -9
- package/lib/config/versions/magento-2.3.2-p2.js +7 -9
- package/lib/config/versions/magento-2.3.2.js +7 -9
- package/lib/config/versions/magento-2.3.3-p1.js +7 -9
- package/lib/config/versions/magento-2.3.3.js +7 -9
- package/lib/config/versions/magento-2.3.4-p1.js +7 -9
- package/lib/config/versions/magento-2.3.4-p2.js +7 -9
- package/lib/config/versions/magento-2.3.4.js +7 -9
- package/lib/config/versions/magento-2.3.5-p1.js +9 -12
- package/lib/config/versions/magento-2.3.5-p2.js +9 -12
- package/lib/config/versions/magento-2.3.5.js +9 -12
- package/lib/config/versions/magento-2.3.6-p1.js +9 -12
- package/lib/config/versions/magento-2.3.6.js +9 -12
- package/lib/config/versions/magento-2.3.7-p1.js +9 -12
- package/lib/config/versions/magento-2.3.7-p2.js +9 -12
- package/lib/config/versions/magento-2.3.7-p3.js +9 -12
- package/lib/config/versions/magento-2.3.7-p4.js +9 -12
- package/lib/config/versions/magento-2.3.7.js +9 -12
- package/lib/config/versions/magento-2.4.0-p1.js +9 -12
- package/lib/config/versions/magento-2.4.0.js +9 -12
- package/lib/config/versions/magento-2.4.1-p1.js +10 -13
- package/lib/config/versions/magento-2.4.1.js +10 -13
- package/lib/config/versions/magento-2.4.2-p1.js +10 -13
- package/lib/config/versions/magento-2.4.2-p2.js +10 -13
- package/lib/config/versions/magento-2.4.2.js +10 -13
- package/lib/config/versions/magento-2.4.3-p1.js +10 -13
- package/lib/config/versions/magento-2.4.3-p2.js +10 -13
- package/lib/config/versions/magento-2.4.3-p3.js +10 -13
- package/lib/config/versions/magento-2.4.3.js +10 -13
- package/lib/config/versions/magento-2.4.4-p1.js +10 -13
- package/lib/config/versions/magento-2.4.4-p2.js +41 -0
- package/lib/config/versions/magento-2.4.4.js +10 -13
- package/lib/config/versions/magento-2.4.5-p1.js +41 -0
- package/lib/config/versions/magento-2.4.5.js +10 -13
- package/lib/tasks/docker/containers/container-api.js +2 -2
- package/lib/tasks/docker/network/tasks.js +19 -14
- package/lib/tasks/docker/project-image-builder.js +3 -1
- package/lib/tasks/docker/system/system-api.js +6 -0
- package/lib/tasks/docker/volume/volume-api.js +1 -1
- package/lib/tasks/file-system/create-phpstorm-config/database-config.js +24 -5
- package/lib/tasks/file-system/create-phpstorm-config/eslint-config.js +25 -13
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/custom-ruleset-path-config.js +18 -7
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/paths.js +4 -0
- package/lib/tasks/magento/setup-magento/flush-redis-config.js +1 -1
- package/lib/tasks/magento/setup-magento/index.js +1 -1
- package/lib/tasks/magento/setup-magento/varnish-config.js +2 -2
- package/lib/tasks/php/update-env-php.js +3 -3
- package/lib/tasks/status/index.js +27 -1
- package/lib/util/connection-string.js +62 -0
- package/package.json +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { defaultMagentoConfig } = require('../magento-config');
|
|
2
|
+
const sodium = require('../services/php/extensions/sodium');
|
|
3
|
+
const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
|
|
4
|
+
const { php81 } = require('../services/php/versions');
|
|
5
|
+
const { sslTerminator } = require('../services/ssl-terminator');
|
|
6
|
+
const { varnish70 } = require('../services/varnish');
|
|
7
|
+
const { repo } = require('../services/php/base-repo');
|
|
8
|
+
const { nginx118 } = require('../services/nginx/versions');
|
|
9
|
+
const { composer2 } = require('../services/composer/versions');
|
|
10
|
+
const { maildev } = require('../services/maildev');
|
|
11
|
+
const { redis62 } = require('../services/redis');
|
|
12
|
+
const { mariadb104 } = require('../services/mariadb/versions');
|
|
13
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions');
|
|
14
|
+
|
|
15
|
+
module.exports = ({ templateDir } = {}) => ({
|
|
16
|
+
magentoVersion: '2.4.5-p1',
|
|
17
|
+
isDefault: true,
|
|
18
|
+
configuration: {
|
|
19
|
+
php: php81({
|
|
20
|
+
templateDir,
|
|
21
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
22
|
+
baseImage: `${ repo }:php-8.1-magento-2.4`
|
|
23
|
+
}),
|
|
24
|
+
nginx: nginx118({ templateDir }),
|
|
25
|
+
redis: redis62(),
|
|
26
|
+
mysql: {
|
|
27
|
+
version: '8.0'
|
|
28
|
+
},
|
|
29
|
+
mariadb: mariadb104(),
|
|
30
|
+
elasticsearch: elasticsearch717(),
|
|
31
|
+
composer: composer2(),
|
|
32
|
+
varnish: varnish70({ templateDir }),
|
|
33
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
34
|
+
maildev: maildev()
|
|
35
|
+
},
|
|
36
|
+
magento: defaultMagentoConfig,
|
|
37
|
+
host: 'localhost',
|
|
38
|
+
ssl: {
|
|
39
|
+
enabled: false
|
|
40
|
+
}
|
|
41
|
+
});
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
2
|
-
const sodium = require('../php/extensions/sodium');
|
|
2
|
+
const sodium = require('../services/php/extensions/sodium');
|
|
3
3
|
const { magento24PHPExtensionList } = require('../magento/required-php-extensions');
|
|
4
|
-
const { php81 } = require('../php/versions');
|
|
4
|
+
const { php81 } = require('../services/php/versions');
|
|
5
5
|
const { sslTerminator } = require('../services/ssl-terminator');
|
|
6
|
-
const { varnish70 } = require('../
|
|
7
|
-
const { repo } = require('../php/base-repo');
|
|
6
|
+
const { varnish70 } = require('../services/varnish');
|
|
7
|
+
const { repo } = require('../services/php/base-repo');
|
|
8
8
|
const { nginx118 } = require('../services/nginx/versions');
|
|
9
9
|
const { composer2 } = require('../services/composer/versions');
|
|
10
10
|
const { maildev } = require('../services/maildev');
|
|
11
|
+
const { redis62 } = require('../services/redis');
|
|
12
|
+
const { mariadb104 } = require('../services/mariadb/versions');
|
|
13
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions');
|
|
11
14
|
|
|
12
15
|
module.exports = ({ templateDir } = {}) => ({
|
|
13
16
|
magentoVersion: '2.4.5',
|
|
@@ -19,18 +22,12 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
19
22
|
baseImage: `${ repo }:php-8.1-magento-2.4`
|
|
20
23
|
}),
|
|
21
24
|
nginx: nginx118({ templateDir }),
|
|
22
|
-
redis:
|
|
23
|
-
version: '6.0'
|
|
24
|
-
},
|
|
25
|
+
redis: redis62(),
|
|
25
26
|
mysql: {
|
|
26
27
|
version: '8.0'
|
|
27
28
|
},
|
|
28
|
-
mariadb:
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
elasticsearch: {
|
|
32
|
-
version: '7.17.5'
|
|
33
|
-
},
|
|
29
|
+
mariadb: mariadb104(),
|
|
30
|
+
elasticsearch: elasticsearch717(),
|
|
34
31
|
composer: composer2(),
|
|
35
32
|
varnish: varnish70({ templateDir }),
|
|
36
33
|
sslTerminator: sslTerminator({ templateDir }),
|
|
@@ -35,8 +35,8 @@ const runCommand = (options) => {
|
|
|
35
35
|
const restartArg = !rm && restart && `--restart=${ restart }`;
|
|
36
36
|
const networkArg = network && `--network=${ network }`;
|
|
37
37
|
const portsArgs = ports && ports.length > 0 && ports.map((port) => `-p=${ port }`);
|
|
38
|
-
const mountsArgs = mounts && mounts.map((mount) => `--mount
|
|
39
|
-
const mountVolumesArgs = mountVolumes && mountVolumes.map((mount) => `-v
|
|
38
|
+
const mountsArgs = mounts && mounts.map((mount) => `--mount="${ mount }"`);
|
|
39
|
+
const mountVolumesArgs = mountVolumes && mountVolumes.map((mount) => `-v="${mount}"`);
|
|
40
40
|
const envArgs = !env ? '' : Object.entries(env).map(([key, value]) => `--env=${ key }='${ value }'`);
|
|
41
41
|
const nameArg = name && `--name=${name}`;
|
|
42
42
|
const entrypointArg = entrypoint && `--entrypoint="${entrypoint}"`;
|
|
@@ -4,6 +4,14 @@ const UnknownError = require('../../../errors/unknown-error');
|
|
|
4
4
|
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
5
5
|
const networkApi = require('./network-api');
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
9
|
+
*/
|
|
10
|
+
const pruneNetworks = () => ({
|
|
11
|
+
title: 'Removing custom networks not used by at least one container',
|
|
12
|
+
task: () => execAsyncSpawn('docker network prune -f')
|
|
13
|
+
});
|
|
14
|
+
|
|
7
15
|
/**
|
|
8
16
|
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
9
17
|
*/
|
|
@@ -22,17 +30,22 @@ const createNetwork = () => ({
|
|
|
22
30
|
driver: 'bridge'
|
|
23
31
|
});
|
|
24
32
|
} catch (e) {
|
|
25
|
-
if (e.includes('could not find an available, non-overlapping IPv4 address pool')) {
|
|
26
|
-
const
|
|
33
|
+
if (e.message.includes('could not find an available, non-overlapping IPv4 address pool')) {
|
|
34
|
+
const doPruneNetworks = await task.prompt({
|
|
27
35
|
type: 'Confirm',
|
|
28
36
|
message: `You don't have available, non-overlapping IPv4 address pool on you system.
|
|
29
37
|
Do you want remove all custom networks not used by at least one container?`
|
|
30
38
|
});
|
|
31
39
|
|
|
32
|
-
if (
|
|
33
|
-
return task.newListr(
|
|
34
|
-
pruneNetworks()
|
|
35
|
-
|
|
40
|
+
if (doPruneNetworks) {
|
|
41
|
+
return task.newListr([
|
|
42
|
+
pruneNetworks(),
|
|
43
|
+
{
|
|
44
|
+
task: () => networkApi.create({
|
|
45
|
+
network: docker.network.name,
|
|
46
|
+
driver: 'bridge'
|
|
47
|
+
})
|
|
48
|
+
}]);
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
throw new KnownError(`Unable to create network for your project.
|
|
@@ -62,14 +75,6 @@ const removeNetwork = () => ({
|
|
|
62
75
|
}
|
|
63
76
|
});
|
|
64
77
|
|
|
65
|
-
/**
|
|
66
|
-
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
67
|
-
*/
|
|
68
|
-
const pruneNetworks = () => ({
|
|
69
|
-
title: 'Removing custom networks not used by at least one container',
|
|
70
|
-
task: () => execAsyncSpawn('docker network prune -f')
|
|
71
|
-
});
|
|
72
|
-
|
|
73
78
|
module.exports = {
|
|
74
79
|
createNetwork,
|
|
75
80
|
removeNetwork,
|
|
@@ -120,10 +120,12 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
120
120
|
.workDir(ctx.config.baseConfig.containerMagentoDir);
|
|
121
121
|
|
|
122
122
|
const imagePathEnv = imageDetails.Config.Env.find((env) => env.startsWith('PATH'));
|
|
123
|
+
const magentoBinDir = path.join(ctx.config.baseConfig.containerMagentoDir, 'bin');
|
|
124
|
+
const vendorBinDir = path.join(ctx.config.baseConfig.containerMagentoDir, 'vendor', 'bin');
|
|
123
125
|
|
|
124
126
|
dockerFileInstructions
|
|
125
127
|
.env({
|
|
126
|
-
PATH: `${ imagePathEnv.split('=').pop() }:${
|
|
128
|
+
PATH: `${ imagePathEnv.split('=').pop() }:${ magentoBinDir }:${vendorBinDir }`
|
|
127
129
|
});
|
|
128
130
|
|
|
129
131
|
return dockerFileInstructions;
|
|
@@ -21,6 +21,12 @@ const df = async (options, execOptions = {}) => {
|
|
|
21
21
|
verboseArg
|
|
22
22
|
].filter(Boolean).join(' ');
|
|
23
23
|
|
|
24
|
+
if (formatToJSON) {
|
|
25
|
+
const result = await execAsyncSpawn(`docker system df ${args}`, execOptions);
|
|
26
|
+
|
|
27
|
+
return JSON.parse(result);
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
return execAsyncSpawn(`docker system df ${args}`, execOptions);
|
|
25
31
|
};
|
|
26
32
|
|
|
@@ -14,7 +14,7 @@ const create = async (options, execOptions = {}) => {
|
|
|
14
14
|
|
|
15
15
|
const driverArg = driver && `--driver=${driver}`;
|
|
16
16
|
const labelArg = label && `--label=${label}`;
|
|
17
|
-
const optArg = opt && Object.entries(opt).map(([name, value]) => `--opt ${name}=
|
|
17
|
+
const optArg = opt && Object.entries(opt).map(([name, value]) => `--opt ${name}="${value}"`).join(' ');
|
|
18
18
|
|
|
19
19
|
const args = [
|
|
20
20
|
driverArg,
|
|
@@ -3,6 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const { baseConfig } = require('../../../config');
|
|
4
4
|
const { loadXmlFile, buildXmlFile } = require('../../../config/xml-parser');
|
|
5
5
|
const UnknownError = require('../../../errors/unknown-error');
|
|
6
|
+
const { connectionStringParser, connectionStringBuilder } = require('../../../util/connection-string');
|
|
6
7
|
const pathExists = require('../../../util/path-exists');
|
|
7
8
|
const setConfigFile = require('../../../util/set-config');
|
|
8
9
|
|
|
@@ -40,7 +41,7 @@ const getToDataSource = (data, defaultData) => {
|
|
|
40
41
|
|
|
41
42
|
return data.project.component['data-source'];
|
|
42
43
|
};
|
|
43
|
-
|
|
44
|
+
// const mariadbVersion = await ctx.databaseConnection.query('SHOW VARIABLES LIKE "%version%";');
|
|
44
45
|
/**
|
|
45
46
|
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
46
47
|
*/
|
|
@@ -153,8 +154,6 @@ const setupDataSourceLocalConfig = () => ({
|
|
|
153
154
|
*/
|
|
154
155
|
const setupDataSourceConfig = () => ({
|
|
155
156
|
task: async (ctx, task) => {
|
|
156
|
-
const jdbcUrl = `jdbc:mysql://localhost:${ctx.ports.mysql}/magento`;
|
|
157
|
-
|
|
158
157
|
if (await pathExists(databaseConfiguration.dataSources.path)) {
|
|
159
158
|
let hasChanges = false;
|
|
160
159
|
const dataSourcesData = await loadXmlFile(databaseConfiguration.dataSources.path);
|
|
@@ -176,6 +175,26 @@ const setupDataSourceConfig = () => ({
|
|
|
176
175
|
}
|
|
177
176
|
);
|
|
178
177
|
|
|
178
|
+
if (dataSource['jdbc-url']) {
|
|
179
|
+
const parsedJDBC = dataSource['jdbc-url'].match(/jdbc:(\S+)/i);
|
|
180
|
+
if (parsedJDBC && parsedJDBC.length > 0) {
|
|
181
|
+
const url = parsedJDBC[1];
|
|
182
|
+
const parsedJDBCUrl = connectionStringParser(url);
|
|
183
|
+
|
|
184
|
+
if (/\S+:undefined/.test(parsedJDBCUrl.host)) {
|
|
185
|
+
hasChanges = true;
|
|
186
|
+
parsedJDBCUrl.host = parsedJDBCUrl.host.split(':').shift();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (parsedJDBCUrl.port !== `${ctx.ports.mariadb}`) {
|
|
190
|
+
hasChanges = true;
|
|
191
|
+
parsedJDBCUrl.port = `${ctx.ports.mariadb}`;
|
|
192
|
+
|
|
193
|
+
dataSource['jdbc-url'] = `jdbc:${connectionStringBuilder(parsedJDBCUrl)}`;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
179
198
|
if (dataSource['@_uuid'] === undefined) {
|
|
180
199
|
hasChanges = true;
|
|
181
200
|
dataSource['@_uuid'] = 'a2eadb3c-6fc9-4d85-b5f4-d8114906ce2f';
|
|
@@ -186,7 +205,7 @@ const setupDataSourceConfig = () => ({
|
|
|
186
205
|
'driver-ref': 'mysql.8',
|
|
187
206
|
synchronize: true,
|
|
188
207
|
'jdbc-driver': 'com.mysql.cj.jdbc.Driver',
|
|
189
|
-
'jdbc-url':
|
|
208
|
+
'jdbc-url': `jdbc:mysql://localhost:${ctx.ports.mariadb}/magento`,
|
|
190
209
|
'working-dir': '$ProjectFileDir$',
|
|
191
210
|
'@_source': 'LOCAL'
|
|
192
211
|
};
|
|
@@ -222,7 +241,7 @@ const setupDataSourceConfig = () => ({
|
|
|
222
241
|
overwrite: true,
|
|
223
242
|
templateArgs: {
|
|
224
243
|
databaseConfiguration,
|
|
225
|
-
jdbcUrl
|
|
244
|
+
jdbcUrl: `jdbc:mysql://localhost:${ctx.ports.mariadb}/magento`
|
|
226
245
|
}
|
|
227
246
|
});
|
|
228
247
|
} catch (e) {
|
|
@@ -17,6 +17,17 @@ const defaultESLintComponentConfiguration = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const esLintDefaultConfigurationData = {
|
|
21
|
+
'?xml': {
|
|
22
|
+
'@_version': '1.0',
|
|
23
|
+
'@_encoding': 'UTF-8'
|
|
24
|
+
},
|
|
25
|
+
project: {
|
|
26
|
+
'@_version': '4',
|
|
27
|
+
component: defaultESLintComponentConfiguration
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
const setupESlintConfig = async (esLintConfigurationData) => {
|
|
21
32
|
let hasChanges = false;
|
|
22
33
|
const themes = await getCSAThemes();
|
|
@@ -56,6 +67,18 @@ const setupESLintConfigTask = () => ({
|
|
|
56
67
|
let hasChanges = false;
|
|
57
68
|
const esLintConfigurationData = await loadXmlFile(pathToESLintConfig);
|
|
58
69
|
|
|
70
|
+
if (!esLintConfigurationData.project) {
|
|
71
|
+
esLintConfigurationData.project = {
|
|
72
|
+
...esLintDefaultConfigurationData.project
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!esLintConfigurationData['?xml']) {
|
|
77
|
+
esLintConfigurationData['?xml'] = {
|
|
78
|
+
...esLintDefaultConfigurationData['?xml']
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
59
82
|
if (esLintConfigurationData.project.component && !Array.isArray(esLintConfigurationData.project.component)) {
|
|
60
83
|
hasChanges = true;
|
|
61
84
|
esLintConfigurationData.project.component = [esLintConfigurationData.project.component];
|
|
@@ -84,20 +107,9 @@ const setupESLintConfigTask = () => ({
|
|
|
84
107
|
return;
|
|
85
108
|
}
|
|
86
109
|
|
|
87
|
-
|
|
88
|
-
'?xml': {
|
|
89
|
-
'@_version': '1.0',
|
|
90
|
-
'@_encoding': 'UTF-8'
|
|
91
|
-
},
|
|
92
|
-
project: {
|
|
93
|
-
'@_version': '4',
|
|
94
|
-
component: defaultESLintComponentConfiguration
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
await setupESlintConfig(esLintConfigurationData);
|
|
110
|
+
await setupESlintConfig(esLintDefaultConfigurationData);
|
|
99
111
|
|
|
100
|
-
await buildXmlFile(pathToESLintConfig,
|
|
112
|
+
await buildXmlFile(pathToESLintConfig, esLintDefaultConfigurationData);
|
|
101
113
|
}
|
|
102
114
|
});
|
|
103
115
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const pathExists = require('../../../../util/path-exists');
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
phpCSConfigurationPath, phpCSConfigFormattedPath, phpCSFixerConfigurationPath, phpCSFixerConfigurationFormattedPath
|
|
4
|
+
} = require('./paths');
|
|
3
5
|
const { nameKey, valueKey } = require('../keys');
|
|
4
6
|
const {
|
|
5
7
|
options: {
|
|
@@ -13,13 +15,22 @@ const setupCustomRuleSetPathOption = async (config) => {
|
|
|
13
15
|
(option) => option[nameKey] === CUSTOM_RULE_SET_PATH_OPTION_NAME
|
|
14
16
|
);
|
|
15
17
|
const phpCSConfigExists = await pathExists(phpCSConfigurationPath);
|
|
18
|
+
const phpCSFixerConfigPathExists = await pathExists(phpCSFixerConfigurationPath);
|
|
16
19
|
|
|
17
|
-
if (!customRuleSetPathOption
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (!customRuleSetPathOption) {
|
|
21
|
+
if (phpCSConfigExists) {
|
|
22
|
+
hasChanges = true;
|
|
23
|
+
config.option.push({
|
|
24
|
+
[nameKey]: CUSTOM_RULE_SET_PATH_OPTION_NAME,
|
|
25
|
+
[valueKey]: phpCSConfigFormattedPath
|
|
26
|
+
});
|
|
27
|
+
} else if (phpCSFixerConfigPathExists) {
|
|
28
|
+
hasChanges = true;
|
|
29
|
+
config.option.push({
|
|
30
|
+
[nameKey]: CUSTOM_RULE_SET_PATH_OPTION_NAME,
|
|
31
|
+
[valueKey]: phpCSFixerConfigurationFormattedPath
|
|
32
|
+
});
|
|
33
|
+
}
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
return hasChanges;
|
|
@@ -6,6 +6,8 @@ const phpCompatibilityRuleSetPath = path.join(phpCompatibilityPath, 'ruleset.xml
|
|
|
6
6
|
const phpCompatibilityFormattedPath = formatPathForPHPStormConfig(phpCompatibilityPath);
|
|
7
7
|
const phpCSConfigurationPath = path.join(process.cwd(), '.php_cs.dist');
|
|
8
8
|
const phpCSConfigFormattedPath = formatPathForPHPStormConfig(phpCSConfigurationPath);
|
|
9
|
+
const phpCSFixerConfigurationPath = path.join(process.cwd(), '.php-cs-fixer.dist.php');
|
|
10
|
+
const phpCSFixerConfigurationFormattedPath = formatPathForPHPStormConfig(phpCSFixerConfigurationPath);
|
|
9
11
|
const phpMDRuleSetPath = path.join(process.cwd(), 'dev', 'tests', 'static', 'testsuite', 'Magento', 'Test', 'Php', '_files', 'phpmd', 'ruleset.xml');
|
|
10
12
|
const phpMDRuleSetFormattedPath = formatPathForPHPStormConfig(phpMDRuleSetPath);
|
|
11
13
|
|
|
@@ -15,6 +17,8 @@ module.exports = {
|
|
|
15
17
|
phpCompatibilityFormattedPath,
|
|
16
18
|
phpCSConfigurationPath,
|
|
17
19
|
phpCSConfigFormattedPath,
|
|
20
|
+
phpCSFixerConfigurationPath,
|
|
21
|
+
phpCSFixerConfigurationFormattedPath,
|
|
18
22
|
phpMDRuleSetPath,
|
|
19
23
|
phpMDRuleSetFormattedPath
|
|
20
24
|
};
|
|
@@ -5,7 +5,7 @@ const UnknownError = require('../../../errors/unknown-error');
|
|
|
5
5
|
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
6
6
|
*/
|
|
7
7
|
module.exports = () => ({
|
|
8
|
-
title: 'Flushing Magento
|
|
8
|
+
title: 'Flushing Magento Redis cache',
|
|
9
9
|
task: async ({ ports, config: { docker }, isDockerDesktop }) => {
|
|
10
10
|
const { redis: { name } } = docker.getContainers(ports);
|
|
11
11
|
const host = !isDockerDesktop ? 'localhost' : 'host.docker.internal';
|
|
@@ -32,10 +32,10 @@ const setupMagento = (options = {}) => ({
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return task.newListr([
|
|
35
|
-
flushRedisConfig(),
|
|
36
35
|
waitingForRedis(),
|
|
37
36
|
updateEnvPHP(),
|
|
38
37
|
migrateDatabase(),
|
|
38
|
+
flushRedisConfig(),
|
|
39
39
|
{
|
|
40
40
|
title: 'Configuring Magento settings',
|
|
41
41
|
task: (ctx, task) => task.newListr([
|
|
@@ -48,11 +48,11 @@ const varnishConfigSetup = () => ({
|
|
|
48
48
|
`);
|
|
49
49
|
|
|
50
50
|
// update cache policy to not use varnish
|
|
51
|
-
//
|
|
51
|
+
// 1 - magento cache, 2 - varnish cache
|
|
52
52
|
await updateTableValues('core_config_data', [
|
|
53
53
|
{
|
|
54
54
|
path: 'system/full_page_cache/caching_application',
|
|
55
|
-
value: '
|
|
55
|
+
value: '1'
|
|
56
56
|
}
|
|
57
57
|
], { databaseConnection, task });
|
|
58
58
|
}
|
|
@@ -19,7 +19,7 @@ const updateEnvPHP = () => ({
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const { isDockerDesktop
|
|
22
|
+
const { isDockerDesktop } = ctx;
|
|
23
23
|
const { php } = ctx.config.docker.getContainers(ctx.ports);
|
|
24
24
|
|
|
25
25
|
const hostMachine = !isDockerDesktop ? '127.0.0.1' : 'host.docker.internal';
|
|
@@ -71,12 +71,12 @@ const updateEnvPHP = () => ({
|
|
|
71
71
|
command: 'php ./update-env-php.php',
|
|
72
72
|
mountVolumes: [
|
|
73
73
|
`${path.join(__dirname, 'update-env.php')}:${ctx.config.baseConfig.containerMagentoDir}/update-env-php.php`,
|
|
74
|
-
`${envPhpPath}
|
|
74
|
+
`${envPhpPath}:${ctx.config.baseConfig.containerMagentoDir}/env.php`
|
|
75
75
|
],
|
|
76
76
|
image: php.image,
|
|
77
77
|
detach: false,
|
|
78
78
|
rm: true,
|
|
79
|
-
user: platform === 'linux' ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
|
|
79
|
+
user: ((ctx.platform === 'linux' && isDockerDesktop) || !isDockerDesktop) ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
task.output = result;
|
|
@@ -49,7 +49,8 @@ const prettyStatus = async (ctx) => {
|
|
|
49
49
|
platform,
|
|
50
50
|
platformVersion,
|
|
51
51
|
containers,
|
|
52
|
-
composerVersion
|
|
52
|
+
composerVersion,
|
|
53
|
+
systemDFData
|
|
53
54
|
} = ctx;
|
|
54
55
|
const projectCreatedAt = getProjectCreatedAt();
|
|
55
56
|
|
|
@@ -152,6 +153,31 @@ const prettyStatus = async (ctx) => {
|
|
|
152
153
|
}
|
|
153
154
|
});
|
|
154
155
|
|
|
156
|
+
block
|
|
157
|
+
.addSeparator('Docker volume data')
|
|
158
|
+
.addEmptyLine();
|
|
159
|
+
|
|
160
|
+
const { volumes } = ctx.config.docker;
|
|
161
|
+
|
|
162
|
+
Object.values(volumes)
|
|
163
|
+
.map((volume) => {
|
|
164
|
+
volume.volumeData = systemDFData.Volumes
|
|
165
|
+
.find((v) => v.Name === volume.name);
|
|
166
|
+
|
|
167
|
+
return volume;
|
|
168
|
+
})
|
|
169
|
+
.forEach((v) => {
|
|
170
|
+
block
|
|
171
|
+
.addLine(`> ${logger.style.misc(v.name)}`);
|
|
172
|
+
if (v.volumeData) {
|
|
173
|
+
block.addLine(`Size: ${logger.style.code(v.volumeData.Size)}`);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (ctx.isDockerDesktop && v.opt && v.opt.device) {
|
|
177
|
+
block.addLine(`Mountpoint: ${logger.style.file(v.opt.device.replace(process.cwd(), '<project location>'))}`);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
155
181
|
const instanceMetadata = getInstanceMetadata(ctx);
|
|
156
182
|
|
|
157
183
|
block
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef ParsedConnection
|
|
3
|
+
* @prop {String} protocol
|
|
4
|
+
* @prop {String} [user]
|
|
5
|
+
* @prop {String} [port]
|
|
6
|
+
* @prop {String} host
|
|
7
|
+
* @prop {String} [hostname]
|
|
8
|
+
* @prop {String[]} [segments]
|
|
9
|
+
* @prop {Record<string, string} params
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {String} url
|
|
14
|
+
* @returns {ParsedConnection}
|
|
15
|
+
*/
|
|
16
|
+
const connectionStringParser = (url) => {
|
|
17
|
+
// eslint-disable-next-line no-useless-escape
|
|
18
|
+
const pattern = /^(?:([^:\/?#\s]+):\/{2})?(?:([^@\/?#\s]+)@)?([^\/?#\s]+)?(?:\/([^?#\s]*))?(?:[?]([^#\s]+))?\S*$/;
|
|
19
|
+
const matches = url.match(pattern);
|
|
20
|
+
const params = {};
|
|
21
|
+
if (matches[5] !== undefined) {
|
|
22
|
+
matches[5].split('&').forEach((x) => {
|
|
23
|
+
const a = x.split('=');
|
|
24
|
+
params[a[0]] = a[1];
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
protocol: matches[1],
|
|
30
|
+
user: matches[2] !== undefined ? matches[2].split(':')[0] : undefined,
|
|
31
|
+
password: matches[2] !== undefined ? matches[2].split(':')[1] : undefined,
|
|
32
|
+
host: matches[3],
|
|
33
|
+
hostname: matches[3] !== undefined ? matches[3].split(/:(?=\d+$)/)[0] : undefined,
|
|
34
|
+
port: matches[3] !== undefined ? matches[3].split(/:(?=\d+$)/)[1] : undefined,
|
|
35
|
+
segments: matches[4] !== undefined ? matches[4].split('/') : undefined,
|
|
36
|
+
params
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {ParsedConnection} options
|
|
42
|
+
* @returns {String}
|
|
43
|
+
*/
|
|
44
|
+
const connectionStringBuilder = (options) => {
|
|
45
|
+
const {
|
|
46
|
+
protocol,
|
|
47
|
+
user,
|
|
48
|
+
password,
|
|
49
|
+
host,
|
|
50
|
+
port,
|
|
51
|
+
segments,
|
|
52
|
+
params
|
|
53
|
+
} = options;
|
|
54
|
+
|
|
55
|
+
// eslint-disable-next-line max-len
|
|
56
|
+
return `${protocol}://${(user && password) ? `${user}:${password}@` : ''}${host}${port ? `:${port}` : ''}/${(segments && segments.length > 0) ? segments.join('/') : ''}${new URLSearchParams(params).toString()}`;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
module.exports = {
|
|
60
|
+
connectionStringParser,
|
|
61
|
+
connectionStringBuilder
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Scripts and configuration used by CMA.",
|
|
4
4
|
"homepage": "https://docs.create-magento-app.com/",
|
|
5
5
|
"repository": "github:scandipwa/create-magento-app",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.2",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./typings/index.d.ts",
|
|
9
9
|
"license": "OSL-3.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"mysql",
|
|
55
55
|
"scandipwa"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "676d083e666a985e1942a7b1d216ca6d6b6151f8"
|
|
58
58
|
}
|