Browse Source
Merge pull request #12972 from akunzai/improve-yarn-detection
Improve the `yarn` command detection
pull/12987/head
maliming
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
9 deletions
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs
@ -54,6 +54,11 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency
return ;
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." ) ;
Logger . LogInformation ( $"Found {projectPaths.Count} projects." ) ;
foreach ( var projectPath in projectPaths )
foreach ( var projectPath in projectPaths )
{
{
@ -253,17 +258,10 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency
private bool IsYarnAvailable ( )
private bool IsYarnAvailable ( )
{
{
var output = CmdHelper . RunCmdAndGetOutput ( "npm list yarn -g --depth 0" ) . Trim ( ) ;
var output = CmdHelper . RunCmdAndGetOutput ( "yarn -v" ) . Trim ( ) ;
if ( output . Contains ( "empty" ) )
if ( ! SemanticVersion . TryParse ( output , out var version ) ) {
{
return false ;
return false ;
}
}
if ( ! SemanticVersion . TryParse ( output . Substring ( output . IndexOf ( '@' ) + 1 ) , out var version ) )
{
return false ;
}
return version > SemanticVersion . Parse ( "1.20.0" ) ;
return version > SemanticVersion . Parse ( "1.20.0" ) ;
}
}
}
}