@scandipwa/magento-scripts 2.0.0-alpha.0 → 2.0.0-alpha.11
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 +7 -2
- package/lib/commands/execute.js +3 -58
- package/lib/commands/import-db.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/start.js +18 -8
- package/lib/commands/status.js +9 -1
- package/lib/config/config.js +20 -2
- package/lib/config/docker.js +79 -85
- package/lib/config/index.js +2 -2
- package/lib/config/php/versions/php-7.2.js +1 -0
- package/lib/config/php/versions/php-7.3.js +1 -0
- package/lib/config/php/versions/php-7.4.js +1 -0
- package/lib/config/php/versions/php-8.1.js +1 -0
- package/lib/config/php-config.js +4 -3
- package/lib/config/port-config.js +1 -1
- package/lib/config/services/composer/versions/composer-1.js +8 -0
- package/lib/config/services/composer/versions/composer-2.js +8 -0
- package/lib/config/services/composer/versions/index.js +4 -0
- 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/services/nginx/versions/index.js +3 -0
- package/lib/config/services/nginx/versions/nginx-1.18.js +11 -0
- package/lib/config/{ssl-terminator → services/ssl-terminator}/index.js +3 -0
- package/lib/config/templates/magentorc.template +6 -5
- package/lib/config/templates/mariadb.template.cnf +191 -0
- package/lib/config/templates/php-debug.template.ini +31 -0
- package/lib/config/templates/php-fpm.template.conf +1 -2
- package/lib/config/templates/php.template.ini +6 -202
- package/lib/config/templates/ssl-terminator.template.conf +10 -3
- package/lib/config/templates/varnish.template.vcl +20 -13
- package/lib/config/varnish/varnish-6-0.js +4 -0
- package/lib/config/varnish/varnish-6-6.js +4 -0
- package/lib/config/varnish/varnish-7-0.js +4 -0
- package/lib/config/versions/magento-2.3.0.js +7 -12
- package/lib/config/versions/magento-2.3.1.js +7 -12
- package/lib/config/versions/magento-2.3.2-p1.js +7 -12
- package/lib/config/versions/magento-2.3.2-p2.js +7 -12
- package/lib/config/versions/magento-2.3.2.js +7 -12
- package/lib/config/versions/magento-2.3.3-p1.js +7 -12
- package/lib/config/versions/magento-2.3.3.js +7 -12
- package/lib/config/versions/magento-2.3.4-p1.js +7 -12
- package/lib/config/versions/magento-2.3.4-p2.js +7 -12
- package/lib/config/versions/magento-2.3.4.js +7 -12
- package/lib/config/versions/magento-2.3.5-p1.js +5 -9
- package/lib/config/versions/magento-2.3.5-p2.js +5 -9
- package/lib/config/versions/magento-2.3.5.js +5 -9
- package/lib/config/versions/magento-2.3.6-p1.js +5 -9
- package/lib/config/versions/magento-2.3.6.js +5 -9
- package/lib/config/versions/magento-2.3.7-p1.js +5 -9
- package/lib/config/versions/magento-2.3.7-p2.js +5 -9
- package/lib/config/versions/magento-2.3.7-p3.js +5 -9
- package/lib/config/versions/magento-2.3.7-p4.js +40 -0
- package/lib/config/versions/magento-2.3.7.js +5 -9
- package/lib/config/versions/magento-2.4.0-p1.js +5 -9
- package/lib/config/versions/magento-2.4.0.js +5 -9
- package/lib/config/versions/magento-2.4.1-p1.js +5 -9
- package/lib/config/versions/magento-2.4.1.js +5 -9
- package/lib/config/versions/magento-2.4.2-p1.js +5 -9
- package/lib/config/versions/magento-2.4.2-p2.js +5 -9
- package/lib/config/versions/magento-2.4.2.js +5 -9
- package/lib/config/versions/magento-2.4.3-p1.js +5 -9
- package/lib/config/versions/magento-2.4.3-p2.js +5 -9
- package/lib/config/versions/magento-2.4.3-p3.js +42 -0
- package/lib/config/versions/magento-2.4.3.js +5 -9
- package/lib/config/versions/magento-2.4.4-p1.js +42 -0
- package/lib/config/versions/magento-2.4.4.js +5 -9
- package/lib/config/versions/magento-2.4.5.js +42 -0
- package/lib/tasks/cleanup.js +1 -1
- package/lib/tasks/composer/local-auth-json.js +1 -1
- package/lib/tasks/database/connect-to-database.js +120 -0
- package/lib/tasks/database/create-magento-database.js +21 -0
- package/lib/tasks/database/create-magento-user.js +50 -0
- package/lib/tasks/database/default-magento-database.js +3 -0
- package/lib/tasks/database/default-magento-user.js +7 -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} +21 -20
- 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 +25 -1
- package/lib/tasks/docker/api.js +31 -1
- package/lib/tasks/docker/containers/container-api.d.ts +18 -0
- package/lib/tasks/docker/containers/container-api.js +76 -17
- package/lib/tasks/docker/containers/tasks.js +32 -1
- package/lib/tasks/docker/convert-legacy-volumes.js +8 -7
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
- package/lib/tasks/docker/index.js +6 -1
- package/lib/tasks/docker/network/network-api.d.ts +1 -1
- package/lib/tasks/docker/project-image-builder.js +7 -9
- package/lib/tasks/docker/volume/index.js +9 -0
- package/lib/tasks/docker/volume/tasks.js +94 -0
- package/lib/tasks/docker/volume/volume-api.d.ts +49 -0
- package/lib/tasks/docker/volume/volume-api.js +90 -0
- package/lib/tasks/execute.js +100 -0
- package/lib/tasks/file-system/create-mariadb-config.js +23 -0
- package/lib/tasks/file-system/create-nginx-config.js +3 -5
- package/lib/tasks/file-system/create-php-config.js +2 -23
- package/lib/tasks/file-system/create-php-debug-config.js +45 -0
- package/lib/tasks/file-system/create-php-fpm-config.js +2 -4
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +1 -1
- package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -7
- package/lib/tasks/file-system/create-varnish-config.js +4 -7
- package/lib/tasks/file-system/index.js +5 -1
- package/lib/tasks/import-dump.js +6 -6
- package/lib/tasks/link.js +4 -2
- package/lib/tasks/magento/enable-magento-composer-plugins.js +85 -30
- package/lib/tasks/magento/install-magento-project.js +3 -2
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +3 -5
- package/lib/tasks/magento/setup-magento/create-admin.js +1 -1
- 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/flush-redis-config.js +3 -6
- 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 +15 -17
- package/lib/tasks/magento/setup-magento/migrate-database.js +5 -11
- package/lib/tasks/magento/setup-magento/set-base-url.js +3 -3
- package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
- package/lib/tasks/magento/setup-magento/varnish-config.js +8 -13
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +17 -16
- package/lib/tasks/php/php-container.js +7 -3
- package/lib/tasks/php/update-env-php.js +7 -6
- package/lib/tasks/php/update-env.php +12 -12
- package/lib/tasks/requirements/composer-credentials.js +7 -3
- package/lib/tasks/requirements/docker/context.js +88 -0
- package/lib/tasks/requirements/docker/index.js +110 -19
- package/lib/tasks/requirements/docker/install.js +21 -7
- package/lib/tasks/requirements/docker/permissions.js +2 -11
- package/lib/tasks/requirements/docker/running-status.js +94 -24
- package/lib/tasks/requirements/docker/version.js +1 -0
- package/lib/tasks/requirements/index.js +0 -2
- package/lib/tasks/requirements/php-version.js +4 -2
- package/lib/tasks/start.js +32 -31
- package/lib/tasks/status/index.js +17 -13
- package/lib/tasks/stop.js +2 -0
- package/lib/tasks/theme/link-theme.js +2 -2
- package/lib/util/config-file-validator.js +29 -13
- package/lib/util/database.js +7 -7
- package/lib/util/execute-in-container.js +63 -0
- package/lib/util/prefix.js +1 -1
- package/lib/util/systemctl.js +62 -13
- package/package.json +4 -3
- package/typings/context.d.ts +12 -5
- package/typings/index.d.ts +69 -31
- package/lib/tasks/docker/volumes.js +0 -63
- package/lib/tasks/execute/index.js +0 -23
- package/lib/tasks/mysql/connect-to-mysql.js +0 -127
- package/lib/tasks/mysql/create-magento-database.js +0 -18
- package/lib/tasks/requirements/dependency/arch.js +0 -50
- package/lib/tasks/requirements/dependency/centos.js +0 -36
- package/lib/tasks/requirements/dependency/fedora.js +0 -36
- package/lib/tasks/requirements/dependency/index.js +0 -33
- package/lib/tasks/requirements/dependency/mac.js +0 -124
- package/lib/tasks/requirements/dependency/ubuntu.js +0 -83
package/exec.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const getLatestVersion = require('@scandipwa/scandipwa-dev-utils/latest-version');
|
|
4
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
5
|
+
const semver = require('semver');
|
|
6
|
+
const isInstalledGlobally = require('is-installed-globally');
|
|
7
|
+
const isRunningRoot = require('./lib/util/is-running-root');
|
|
8
|
+
const { executeTask } = require('./lib/tasks/execute');
|
|
9
|
+
|
|
10
|
+
if (isRunningRoot()) {
|
|
11
|
+
logger.error('Root privileges detected!');
|
|
12
|
+
console.log(`
|
|
13
|
+
We detected that you are running ${ logger.style.misc('magento-scripts') } as root user.
|
|
14
|
+
We cannot allow you to run ${ logger.style.misc('magento-scripts') } with root privileges, this will only cause more problems.
|
|
15
|
+
|
|
16
|
+
If you are experiencing problems with ${ logger.style.misc('Docker') } or ${ logger.style.misc('Magento') } setup, running ${ logger.style.misc('magento-scripts') } as root will not solve those problems.
|
|
17
|
+
`);
|
|
18
|
+
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
process.title = 'magento-scripts';
|
|
23
|
+
|
|
24
|
+
const newVersionIsAPatch = (latestVersion, currentVersion) => {
|
|
25
|
+
const latestVersionParsed = semver.parse(latestVersion);
|
|
26
|
+
const currentVersionParsed = semver.parse(currentVersion);
|
|
27
|
+
|
|
28
|
+
return latestVersionParsed.major === currentVersionParsed.major
|
|
29
|
+
&& latestVersionParsed.minor === currentVersionParsed.minor
|
|
30
|
+
&& latestVersionParsed.patch !== currentVersionParsed.patch;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
(async () => {
|
|
34
|
+
const { version: currentVersion, name } = require('./package.json');
|
|
35
|
+
try {
|
|
36
|
+
const latestVersion = await getLatestVersion(name);
|
|
37
|
+
|
|
38
|
+
if (semver.gt(latestVersion, currentVersion)) {
|
|
39
|
+
const isNewVersionAPath = newVersionIsAPatch(latestVersion, currentVersion);
|
|
40
|
+
|
|
41
|
+
let message = [];
|
|
42
|
+
|
|
43
|
+
if (isNewVersionAPath) {
|
|
44
|
+
message = [
|
|
45
|
+
`A patch for ${ logger.style.misc(name) } is available!`,
|
|
46
|
+
`We recommend to update to latest version ${ logger.style.misc(latestVersion) }!`,
|
|
47
|
+
`-> ${ logger.style.command(`npm i ${ isInstalledGlobally ? '-g ' : '' }${ name }@${ latestVersion }`) }`
|
|
48
|
+
];
|
|
49
|
+
} else {
|
|
50
|
+
message = [
|
|
51
|
+
`${ isInstalledGlobally ? 'Global module' : 'Module' } ${ logger.style.misc(name) } (${currentVersion}) is out-dated.`,
|
|
52
|
+
`Please upgrade it to latest version ${ logger.style.misc(latestVersion) }.`,
|
|
53
|
+
`You can do it by running the following command: ${ logger.style.command(`npm i ${ isInstalledGlobally ? '-g ' : '' }${ name }@${ latestVersion }`) }.`
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
process.isOutOfDateVersion = true;
|
|
58
|
+
process.isOutOfDateVersionMessage = message;
|
|
59
|
+
}
|
|
60
|
+
} catch (e) {
|
|
61
|
+
logger.warn(`Package ${ logger.style.misc(name) } is not yet published.`);
|
|
62
|
+
logger.log(); // add empty line
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const [containername, ...commands] = process.argv.slice(2);
|
|
66
|
+
|
|
67
|
+
return executeTask({
|
|
68
|
+
containername,
|
|
69
|
+
commands
|
|
70
|
+
});
|
|
71
|
+
})();
|
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ if (isRunningRoot()) {
|
|
|
13
13
|
We detected that you are running ${ logger.style.misc('magento-scripts') } as root user.
|
|
14
14
|
We cannot allow you to run ${ logger.style.misc('magento-scripts') } with root privileges, this will only cause more problems.
|
|
15
15
|
|
|
16
|
-
If you are experiencing problems with ${ logger.style.misc('Docker') }
|
|
16
|
+
If you are experiencing problems with ${ logger.style.misc('Docker') } or ${ logger.style.misc('Magento') } setup, running ${ logger.style.misc('magento-scripts') } as root will not solve those problems.
|
|
17
17
|
`);
|
|
18
18
|
|
|
19
19
|
process.exit(1);
|
package/lib/commands/cli.js
CHANGED
|
@@ -46,6 +46,11 @@ module.exports = (yargs) => {
|
|
|
46
46
|
.addLine(`Available shortcuts: magento -> ${logger.style.command('m')}, composer -> ${logger.style.command('c')}`)
|
|
47
47
|
.addEmptyLine();
|
|
48
48
|
|
|
49
|
+
block
|
|
50
|
+
.addLine(`Execute into any service: ${logger.style.command('exec <service name>')}`)
|
|
51
|
+
.addLine(`Execute into PHP container: ${logger.style.command('exec php')}`)
|
|
52
|
+
.addEmptyLine();
|
|
53
|
+
|
|
49
54
|
if (ctx.config.overridenConfiguration.configuration.varnish.enabled) {
|
|
50
55
|
block.addLine(`Clear Varnish cache: ${logger.style.command('cvc')}`);
|
|
51
56
|
}
|
|
@@ -61,8 +66,8 @@ module.exports = (yargs) => {
|
|
|
61
66
|
.addEmptyLine();
|
|
62
67
|
|
|
63
68
|
block
|
|
64
|
-
.addLine(`Connect to
|
|
65
|
-
.addLine(`Connect to
|
|
69
|
+
.addLine(`Connect to MariaDB server: ${logger.style.command('mariadb')}`)
|
|
70
|
+
.addLine(`Connect to MariaDB server as root: ${logger.style.command('mariadbroot')}`)
|
|
66
71
|
.addEmptyLine();
|
|
67
72
|
|
|
68
73
|
block.log();
|
package/lib/commands/execute.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { Listr } = require('listr2');
|
|
3
|
-
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
4
|
-
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
5
|
-
const executeInContainer = require('../tasks/execute');
|
|
6
|
-
const getMagentoVersionConfig = require('../config/get-magento-version-config');
|
|
7
|
-
const { checkRequirements } = require('../tasks/requirements');
|
|
8
|
-
const { getCachedPorts } = require('../config/get-port-config');
|
|
1
|
+
const { executeTask } = require('../tasks/execute');
|
|
9
2
|
|
|
10
3
|
/**
|
|
11
4
|
* @param {import('yargs')} yargs
|
|
@@ -18,7 +11,7 @@ module.exports = (yargs) => {
|
|
|
18
11
|
yargs.usage(`Usage: npm run exec <container name> [commands...]
|
|
19
12
|
|
|
20
13
|
Available containers:
|
|
21
|
-
-
|
|
14
|
+
- mariadb
|
|
22
15
|
- nginx
|
|
23
16
|
- redis
|
|
24
17
|
- elasticsearch
|
|
@@ -26,55 +19,7 @@ Available containers:
|
|
|
26
19
|
- sslTerminator`);
|
|
27
20
|
},
|
|
28
21
|
async (argv) => {
|
|
29
|
-
|
|
30
|
-
checkRequirements(),
|
|
31
|
-
getMagentoVersionConfig(),
|
|
32
|
-
checkConfigurationFile(),
|
|
33
|
-
getProjectConfiguration(),
|
|
34
|
-
getCachedPorts()
|
|
35
|
-
], {
|
|
36
|
-
concurrent: false,
|
|
37
|
-
exitOnError: true,
|
|
38
|
-
ctx: { throwMagentoVersionMissing: true },
|
|
39
|
-
rendererOptions: { collapse: false, clearOutput: true }
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
let ctx;
|
|
43
|
-
try {
|
|
44
|
-
ctx = await tasks.run();
|
|
45
|
-
} catch (e) {
|
|
46
|
-
logger.error(e.message || e);
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
const containers = ctx.config.docker.getContainers(ctx.ports);
|
|
50
|
-
const services = Object.keys(containers);
|
|
51
|
-
|
|
52
|
-
if (services.includes(argv.containername) || services.some((service) => service.includes(argv.containername))) {
|
|
53
|
-
const container = containers[argv.containername]
|
|
54
|
-
? containers[argv.containername]
|
|
55
|
-
: Object.entries(containers).find(([key]) => key.includes(argv.containername))[1];
|
|
56
|
-
|
|
57
|
-
if (argv.commands.length === 0) {
|
|
58
|
-
// if we have default connect command then use it
|
|
59
|
-
if (container.connectCommand) {
|
|
60
|
-
// eslint-disable-next-line no-param-reassign
|
|
61
|
-
argv.commands = container.connectCommand;
|
|
62
|
-
} else {
|
|
63
|
-
// otherwise fall back to bash (if it exists inside container)
|
|
64
|
-
argv.commands.push('bash');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
logger.logN(`Executing container ${logger.style.misc(container._)} (command: ${logger.style.command(argv.commands[0])})`);
|
|
69
|
-
await executeInContainer({
|
|
70
|
-
containerName: container.name,
|
|
71
|
-
commands: argv.commands
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
logger.error(`No container found "${argv.containername}"`);
|
|
22
|
+
await executeTask(argv);
|
|
78
23
|
}
|
|
79
24
|
);
|
|
80
25
|
};
|
package/lib/commands/logs.js
CHANGED
package/lib/commands/start.js
CHANGED
|
@@ -22,6 +22,7 @@ const reportErrors = async (errors) => {
|
|
|
22
22
|
const path = (error.path && ` Error path: ${error.path} `) || '';
|
|
23
23
|
if (error instanceof UnknownError || error instanceof KnownError) {
|
|
24
24
|
logger.error(error.message);
|
|
25
|
+
logger.error(error.stack);
|
|
25
26
|
if (error instanceof UnknownError) {
|
|
26
27
|
await googleAnalytics.trackError(`Unknown Error:${path}${error.stack}`);
|
|
27
28
|
} else {
|
|
@@ -29,9 +30,11 @@ const reportErrors = async (errors) => {
|
|
|
29
30
|
}
|
|
30
31
|
} else if (error instanceof Error) {
|
|
31
32
|
logger.error(error.message);
|
|
33
|
+
logger.error(error.stack);
|
|
32
34
|
await googleAnalytics.trackError(`Regular Error:${path}${error.message}`);
|
|
33
35
|
} else {
|
|
34
36
|
logger.error(error);
|
|
37
|
+
logger.error(error.stack);
|
|
35
38
|
await googleAnalytics.trackError(`Non Error:${path}${error}`); // track non-errors throws
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -69,10 +72,6 @@ module.exports = (yargs) => {
|
|
|
69
72
|
type: 'boolean',
|
|
70
73
|
default: false
|
|
71
74
|
})
|
|
72
|
-
.option('import-db', {
|
|
73
|
-
describe: 'Import database dump to MySQL',
|
|
74
|
-
type: 'string'
|
|
75
|
-
})
|
|
76
75
|
.option('edition', {
|
|
77
76
|
alias: 'e',
|
|
78
77
|
describe: 'Magento Edition to install',
|
|
@@ -87,6 +86,16 @@ module.exports = (yargs) => {
|
|
|
87
86
|
describe: 'Enable verbose logging',
|
|
88
87
|
type: 'boolean',
|
|
89
88
|
default: false
|
|
89
|
+
})
|
|
90
|
+
.option('pull-images', {
|
|
91
|
+
describe: 'Pull Docker images',
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
default: false
|
|
94
|
+
})
|
|
95
|
+
.option('reset-global-config', {
|
|
96
|
+
describe: 'Reset global magento-scripts configuration',
|
|
97
|
+
type: 'boolean',
|
|
98
|
+
default: false
|
|
90
99
|
}),
|
|
91
100
|
async (args = {}) => {
|
|
92
101
|
/**
|
|
@@ -169,15 +178,16 @@ module.exports = (yargs) => {
|
|
|
169
178
|
block.log();
|
|
170
179
|
|
|
171
180
|
logger.note(
|
|
172
|
-
`
|
|
181
|
+
`MariaDB credentials, containers status and project information available in ${logger.style.code('npm run status')} command.
|
|
173
182
|
To access Magento CLI, Composer and PHP for this project use ${logger.style.code('npm run cli')} command.`
|
|
174
183
|
);
|
|
175
184
|
logger.log('');
|
|
176
185
|
|
|
177
|
-
if (
|
|
178
|
-
logger.warn('
|
|
186
|
+
if (tasks.err && tasks.err.length > 0) {
|
|
187
|
+
logger.warn('During the start, we encountered some errors that have not impacted the start-up process!');
|
|
188
|
+
logger.log('');
|
|
179
189
|
for (const err of tasks.err) {
|
|
180
|
-
logger.error(
|
|
190
|
+
logger.error(`Error path: ${err.path}\nError message: ${err.message}\n\nError stack: ${err.stack}`);
|
|
181
191
|
}
|
|
182
192
|
}
|
|
183
193
|
|
package/lib/commands/status.js
CHANGED
|
@@ -9,6 +9,7 @@ const { statusContainers } = require('../tasks/docker/containers');
|
|
|
9
9
|
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
10
10
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
11
11
|
const checkPHPVersion = require('../tasks/requirements/php-version');
|
|
12
|
+
const { getComposerVersionTask } = require('../tasks/composer');
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @param {import('yargs')} yargs
|
|
@@ -21,7 +22,14 @@ module.exports = (yargs) => {
|
|
|
21
22
|
checkConfigurationFile(),
|
|
22
23
|
getProjectConfiguration(),
|
|
23
24
|
getCachedPorts(),
|
|
24
|
-
|
|
25
|
+
{
|
|
26
|
+
task: (ctx, task) => task.newListr([
|
|
27
|
+
checkPHPVersion(),
|
|
28
|
+
getComposerVersionTask()
|
|
29
|
+
], {
|
|
30
|
+
concurrent: true
|
|
31
|
+
})
|
|
32
|
+
},
|
|
25
33
|
statusContainers()
|
|
26
34
|
], {
|
|
27
35
|
concurrent: false,
|
package/lib/config/config.js
CHANGED
|
@@ -2,6 +2,16 @@ const Conf = require('conf');
|
|
|
2
2
|
|
|
3
3
|
const pkg = require('../../package.json');
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @typedef ProjectConfig
|
|
7
|
+
* @prop {String} [createdAt]
|
|
8
|
+
* @prop {String} [prefix]
|
|
9
|
+
* @prop {Boolean} debug
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('conf').default<Record<string, ProjectConfig>>}
|
|
14
|
+
*/
|
|
5
15
|
const projectsConfig = new Conf({
|
|
6
16
|
configName: 'projects',
|
|
7
17
|
projectName: 'create-magento-app',
|
|
@@ -10,6 +20,12 @@ const projectsConfig = new Conf({
|
|
|
10
20
|
});
|
|
11
21
|
const projectKey = process.cwd();
|
|
12
22
|
|
|
23
|
+
const setProjectConfig = (key, value) => {
|
|
24
|
+
projectsConfig.set(`${projectKey}.${key}`, value);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getProjectConfig = () => projectsConfig.get(projectKey);
|
|
28
|
+
|
|
13
29
|
const getProjectsFromProjectKeys = (path, project) => {
|
|
14
30
|
if (project.createdAt) {
|
|
15
31
|
return { [path]: project };
|
|
@@ -21,7 +37,7 @@ const getProjectsFromProjectKeys = (path, project) => {
|
|
|
21
37
|
};
|
|
22
38
|
/**
|
|
23
39
|
*
|
|
24
|
-
* @returns {Record<string,
|
|
40
|
+
* @returns {Record<string, ProjectConfig>}
|
|
25
41
|
*/
|
|
26
42
|
const getProjects = () => {
|
|
27
43
|
const projects = {};
|
|
@@ -45,5 +61,7 @@ const getProjects = () => {
|
|
|
45
61
|
module.exports = {
|
|
46
62
|
projectsConfig,
|
|
47
63
|
projectKey,
|
|
48
|
-
getProjects
|
|
64
|
+
getProjects,
|
|
65
|
+
setProjectConfig,
|
|
66
|
+
getProjectConfig
|
|
49
67
|
};
|