From 2442fa7bd3980bce6c56918e1d925d5dc65462f1 Mon Sep 17 00:00:00 2001 From: Sergii Kirianov Date: Tue, 25 Apr 2023 13:01:05 +0200 Subject: [PATCH 1/3] fix: replace rmdir with rm to avoid depreciation warning --- packages/cli/README.md | 8 ++++---- packages/cli/package.json | 2 +- .../src/domains/directory/handleProjectDiretoryExists.ts | 2 +- packages/cli/src/domains/magento2/docker/removeDocker.ts | 2 +- packages/cli/src/domains/magento2/functions/copyEnv.ts | 4 +++- .../cli/src/domains/magento2/prompts/confirmOverwrite.ts | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 0a620c3346..b417bd130f 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -73,7 +73,7 @@ DESCRIPTION Display help for @vue-storefront/cli. ``` -_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.16/src/commands/help.ts)_ +_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.18/src/commands/help.ts)_ ## `@vue-storefront/cli init` @@ -85,7 +85,7 @@ EXAMPLES $ @vue-storefront/cli init ``` -_See code: [dist/commands/init.ts](https://github.com/vuestorefront/vue-storefront/blob/v3.0.0/dist/commands/init.ts)_ +_See code: [dist/commands/init.ts](https://github.com/vuestorefront/vue-storefront/blob/v4.1.1-next.0/dist/commands/init.ts)_ ## `@vue-storefront/cli plugins` @@ -105,7 +105,7 @@ EXAMPLES $ @vue-storefront/cli plugins ``` -_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.1.5/src/commands/plugins/index.ts)_ +_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.1.7/src/commands/plugins/index.ts)_ ## `@vue-storefront/cli plugins:install PLUGIN...` @@ -352,5 +352,5 @@ EXAMPLES $ @vue-storefront/cli update --available ``` -_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v3.0.4/src/commands/update.ts)_ +_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v3.0.6/src/commands/update.ts)_ diff --git a/packages/cli/package.json b/packages/cli/package.json index f0f746aefc..fc8ef6ef22 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/cli", - "version": "4.1.1", + "version": "4.1.3-rc.1", "description": "Vue Storefront's CLI.", "bin": "./bin/run", "homepage": "https://github.com/vuestorefront/vue-storefront", diff --git a/packages/cli/src/domains/directory/handleProjectDiretoryExists.ts b/packages/cli/src/domains/directory/handleProjectDiretoryExists.ts index ebba3dead5..f0a503a075 100644 --- a/packages/cli/src/domains/directory/handleProjectDiretoryExists.ts +++ b/packages/cli/src/domains/directory/handleProjectDiretoryExists.ts @@ -32,7 +32,7 @@ export const handleProjectDiretoryExists = async ({ sp.start( picocolors.cyan(t('command.generate_store.progress.delete_start')) ); - await fs.rmdirSync(projectDir, { recursive: true }); + await fs.rmSync(projectDir, { recursive: true }); await fs.mkdirSync(projectDir); sp.stop( picocolors.green(t('command.generate_store.progress.delete_end')) diff --git a/packages/cli/src/domains/magento2/docker/removeDocker.ts b/packages/cli/src/domains/magento2/docker/removeDocker.ts index 844ada0e38..d0375a435a 100644 --- a/packages/cli/src/domains/magento2/docker/removeDocker.ts +++ b/packages/cli/src/domains/magento2/docker/removeDocker.ts @@ -11,7 +11,7 @@ const removeDockerContainer = async (magentoDirName: string): Promise => { const removeDocker = spawn('docker-compose', ['rm', '-f'], options); removeDocker.on('exit', () => { - fs.rmdirSync(magentoDirName, { recursive: true }); + fs.rmSync(magentoDirName, { recursive: true }); }); }); }; diff --git a/packages/cli/src/domains/magento2/functions/copyEnv.ts b/packages/cli/src/domains/magento2/functions/copyEnv.ts index 83f60ccdfe..ae46f9f392 100644 --- a/packages/cli/src/domains/magento2/functions/copyEnv.ts +++ b/packages/cli/src/domains/magento2/functions/copyEnv.ts @@ -31,7 +31,9 @@ const copyEnv = async (vsfDirName: string, magentoDomain?: string) => { process.exit(1); } - fs.rmdirSync(path.join(vsfDirName, '.env.example')); + if (fs.existsSync(path.join(vsfDirName, '.env.example'))) { + fs.rmSync(path.join(vsfDirName, '.env.example')); + } }; export default copyEnv; diff --git a/packages/cli/src/domains/magento2/prompts/confirmOverwrite.ts b/packages/cli/src/domains/magento2/prompts/confirmOverwrite.ts index 72b3c9629d..af90d72dd4 100644 --- a/packages/cli/src/domains/magento2/prompts/confirmOverwrite.ts +++ b/packages/cli/src/domains/magento2/prompts/confirmOverwrite.ts @@ -34,7 +34,7 @@ const confirmOverwrite = async ({ sp.start( picocolors.cyan(t('command.generate_store.progress.delete_start')) ); - await fs.rmdirSync(magentoDirName, { recursive: true }); + await fs.rmSync(magentoDirName, { recursive: true }); await fs.mkdirSync(magentoDirName); sp.stop(picocolors.green(t('command.generate_store.progress.delete_end'))); newMagentoDirName = magentoDirName; From efcf2f5758327286c6fafefc27705288c5daecd2 Mon Sep 17 00:00:00 2001 From: Sergii Kirianov Date: Tue, 25 Apr 2023 13:12:57 +0200 Subject: [PATCH 2/3] fix: handle windows yarn install command --- packages/cli/package.json | 2 +- packages/cli/src/domains/magento2/functions/installDeps.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index fc8ef6ef22..3567be6161 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/cli", - "version": "4.1.3-rc.1", + "version": "4.1.3-rc.3", "description": "Vue Storefront's CLI.", "bin": "./bin/run", "homepage": "https://github.com/vuestorefront/vue-storefront", diff --git a/packages/cli/src/domains/magento2/functions/installDeps.ts b/packages/cli/src/domains/magento2/functions/installDeps.ts index bc195337fa..9716efb3c2 100644 --- a/packages/cli/src/domains/magento2/functions/installDeps.ts +++ b/packages/cli/src/domains/magento2/functions/installDeps.ts @@ -15,7 +15,10 @@ const installDeps = async ( const sp = spinner(); return new Promise((resolve) => { - const install = spawn('yarn', options); + const install = + process.platform === 'win32' + ? spawn('yarn.cmd', [], options) + : spawn('yarn', [], options); sp.start( picocolors.cyan(t('command.generate_store.progress.install_deps_start')) From 6b94037595b37ae66b901115b3f01b23a4feaf6d Mon Sep 17 00:00:00 2001 From: Sergii Kirianov Date: Tue, 25 Apr 2023 14:05:00 +0200 Subject: [PATCH 3/3] fix: fixed typo, added warning for non WSL magento install --- CLI_logs.txt | 0 packages/cli/locales/en-US/translation.json | 5 +++-- packages/cli/package.json | 2 +- packages/cli/src/commands/generate/store.ts | 7 +++++++ 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 CLI_logs.txt diff --git a/CLI_logs.txt b/CLI_logs.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cli/locales/en-US/translation.json b/packages/cli/locales/en-US/translation.json index 79125c56bf..57875bfb22 100644 --- a/packages/cli/locales/en-US/translation.json +++ b/packages/cli/locales/en-US/translation.json @@ -14,12 +14,13 @@ "success": "🎉 Sucessfully generated your store at \"./{{projectName}}\"!", "install": "To finish the installation, run the following commands:", "install_commands": ["cd {{ projectName }}"], - "configure": "Project is conifugred. \nIf you want more advanced configuration go to the \n{{ documentationURL }} to learn how to do it.", + "configure": "Project is configured. \nIf you want more advanced configuration go to \n{{ documentationURL }} to learn how to do it.", "cd_message": "To start working with the project, cd into project directory:", "cd_directory": "cd {{ projectName }}", "start": "Start the project using this command:", "start_command": "yarn dev", - "canceled": "Store generation cancelled 😞\nWe hope to see you soon! 🤗" + "canceled": "Store generation cancelled 😞\nWe hope to see you soon! 🤗", + "windows_not_supported": "😞 Windows is not supported yet. Please use Linux, WSL or MacOS." }, "progress": { "vsf_start": "🧩 Generating Vue Storefront project", diff --git a/packages/cli/package.json b/packages/cli/package.json index 3567be6161..240b176632 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/cli", - "version": "4.1.3-rc.3", + "version": "4.1.4", "description": "Vue Storefront's CLI.", "bin": "./bin/run", "homepage": "https://github.com/vuestorefront/vue-storefront", diff --git a/packages/cli/src/commands/generate/store.ts b/packages/cli/src/commands/generate/store.ts index 930988315d..92406977b3 100644 --- a/packages/cli/src/commands/generate/store.ts +++ b/packages/cli/src/commands/generate/store.ts @@ -87,6 +87,13 @@ export default class GenerateStore extends Command { } if (isInstallMagento) { + if (process.platform === 'win32') { + logSimpleWarningMessage( + t('command.generate_store.message.windows_not_supported') + ); + process.exit(0); + } + await checkDocker(writeLog); const { magentoDirName, magentoAccessKey, magentoSecretKey } =