Skip to content

Commit fd22572

Browse files
authored
Merge pull request vuestorefront#6913 from vuestorefront/feat/mage-only
feat: mage only
2 parents dc4572d + 1d69145 commit fd22572

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

packages/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue-storefront/cli",
3-
"version": "4.1.1",
3+
"version": "4.2.1-rc.1",
44
"description": "Vue Storefront's CLI.",
55
"bin": "./bin/run",
66
"homepage": "https://github.com/vuestorefront/vue-storefront",

packages/cli/src/commands/m2-only.ts

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { intro } from '@clack/prompts';
2+
import { Command } from '@oclif/core';
3+
import { initLogger } from '../domains/logging/logger';
4+
import { checkDocker, getMagentoDomainName } from '../domains/magento2/docker';
5+
import { getMagentoDetails } from '../domains/magento2/functions';
6+
import { installMagento } from '../domains/magento2/installMagento';
7+
import { simpleLog } from '../domains/magento2/functions/terminalHelpers';
8+
import picocolors from 'picocolors';
9+
import { t } from 'i18next';
10+
11+
export default class M2Only extends Command {
12+
static override description = 'Install local Magento 2 instance';
13+
14+
static override examples = ['<%= config.bin %> <%= command.id %>'];
15+
16+
static override flags = {};
17+
18+
static override args = [];
19+
20+
async run(): Promise<void> {
21+
const { writeLog, deleteLog } = initLogger();
22+
23+
intro('Welcome to the Magento 2 local instance installer!');
24+
25+
await checkDocker(writeLog);
26+
27+
const { magentoDirName, magentoAccessKey, magentoSecretKey } =
28+
await getMagentoDetails();
29+
30+
const magentoDomain = await getMagentoDomainName(
31+
t('command.generate_store.magento.domain')
32+
);
33+
34+
await installMagento({
35+
isInstallMagento: true,
36+
magentoDirName,
37+
magentoDomain,
38+
magentoAccessKey,
39+
magentoSecretKey,
40+
writeLog
41+
});
42+
43+
deleteLog();
44+
45+
simpleLog('Happy coding! 🎉', picocolors.green);
46+
47+
this.exit(0);
48+
}
49+
}

packages/cli/src/domains/magento2/docker/checkDocker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ const checkDocker = async (
2626

2727
if (!isDockerInstalled) {
2828
writeLog(
29-
'Docker is not installed or not running. Please make sure that prerequisites are complied with and run command again. For more information, please visit https://docs.vuestorefront.io/magento/installation-setup/configure-magento.html'
29+
'Docker is not installed or not running. Please make sure that prerequisites are complied with and run command again.'
3030
);
3131
logSimpleErrorMessage(
32-
'Docker is not installed or not running. Please make sure that prerequisites are complied with and run command again. For more information, please visit https://docs.vuestorefront.io/magento/installation-setup/configure-magento.html'
32+
'Docker is not installed or not running. Please make sure that prerequisites are complied with and run command again.'
3333
);
3434
logSimpleInfoMessage(t('command.generate_store.magento.failed_log'));
3535
process.exit(1);

packages/cli/src/domains/magento2/functions/getMagentoDetails.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { t } from 'i18next';
77
import handleMagentoKeys from '../prompts/handleMagentoKeys';
88
import { note } from '@clack/prompts';
99

10-
const getMagentoDetails = async (projectName: string) => {
10+
const getMagentoDetails = async (projectName?: string) => {
1111
let magentoAccessKey: string;
1212
let magentoSecretKey: string;
1313

0 commit comments

Comments
 (0)