Skip to content

Commit

Permalink
Merge pull request #6913 from vuestorefront/feat/mage-only
Browse files Browse the repository at this point in the history
feat: mage only
  • Loading branch information
skirianov authored May 24, 2023
2 parents dc4572d + 1d69145 commit fd22572
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/cli",
"version": "4.1.1",
"version": "4.2.1-rc.1",
"description": "Vue Storefront's CLI.",
"bin": "./bin/run",
"homepage": "https://github.com/vuestorefront/vue-storefront",
Expand Down
49 changes: 49 additions & 0 deletions packages/cli/src/commands/m2-only.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { intro } from '@clack/prompts';
import { Command } from '@oclif/core';
import { initLogger } from '../domains/logging/logger';
import { checkDocker, getMagentoDomainName } from '../domains/magento2/docker';
import { getMagentoDetails } from '../domains/magento2/functions';
import { installMagento } from '../domains/magento2/installMagento';
import { simpleLog } from '../domains/magento2/functions/terminalHelpers';
import picocolors from 'picocolors';
import { t } from 'i18next';

export default class M2Only extends Command {
static override description = 'Install local Magento 2 instance';

static override examples = ['<%= config.bin %> <%= command.id %>'];

static override flags = {};

static override args = [];

async run(): Promise<void> {
const { writeLog, deleteLog } = initLogger();

intro('Welcome to the Magento 2 local instance installer!');

await checkDocker(writeLog);

const { magentoDirName, magentoAccessKey, magentoSecretKey } =
await getMagentoDetails();

const magentoDomain = await getMagentoDomainName(
t('command.generate_store.magento.domain')
);

await installMagento({
isInstallMagento: true,
magentoDirName,
magentoDomain,
magentoAccessKey,
magentoSecretKey,
writeLog
});

deleteLog();

simpleLog('Happy coding! 🎉', picocolors.green);

this.exit(0);
}
}
4 changes: 2 additions & 2 deletions packages/cli/src/domains/magento2/docker/checkDocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ const checkDocker = async (

if (!isDockerInstalled) {
writeLog(
'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'
'Docker is not installed or not running. Please make sure that prerequisites are complied with and run command again.'
);
logSimpleErrorMessage(
'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'
'Docker is not installed or not running. Please make sure that prerequisites are complied with and run command again.'
);
logSimpleInfoMessage(t('command.generate_store.magento.failed_log'));
process.exit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { t } from 'i18next';
import handleMagentoKeys from '../prompts/handleMagentoKeys';
import { note } from '@clack/prompts';

const getMagentoDetails = async (projectName: string) => {
const getMagentoDetails = async (projectName?: string) => {
let magentoAccessKey: string;
let magentoSecretKey: string;

Expand Down

0 comments on commit fd22572

Please sign in to comment.