From a03d9efd071a54b0a418d6da7e6817c3a64cfe51 Mon Sep 17 00:00:00 2001 From: Charley Wu Date: Fri, 10 Jun 2022 21:21:25 +0800 Subject: [PATCH 1/2] Improve the `yarn` command detection --- .../Volo/Abp/Cli/LIbs/InstallLibsService.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs index 71cf789c9c..08b89d9547 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs @@ -253,17 +253,10 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency private bool IsYarnAvailable() { - var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g --depth 0").Trim(); - if (output.Contains("empty")) - { - return false; - } - - if (!SemanticVersion.TryParse(output.Substring(output.IndexOf('@') + 1), out var version)) - { + var output = CmdHelper.RunCmdAndGetOutput("yarn -v").Trim(); + if (!SemanticVersion.TryParse(output, out var version)){ return false; } - return version > SemanticVersion.Parse("1.20.0"); } } From a14c650780d9c10df37b5b86cd4f76263f927244 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 13 Jun 2022 09:18:25 +0800 Subject: [PATCH 2/2] Warn if yarn is not available. --- .../Volo/Abp/Cli/LIbs/InstallLibsService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs index 08b89d9547..94bd0383f6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs @@ -54,6 +54,11 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency return; } + if (!IsYarnAvailable()) + { + Logger.LogWarning("YARN is not installed, which may cause package inconsistency, please use YARN instead of NPM. visit https://classic.yarnpkg.com/lang/en/docs/install/ and install YARN"); + } + Logger.LogInformation($"Found {projectPaths.Count} projects."); foreach (var projectPath in projectPaths) {