Browse Source
Merge pull request #13565 from abpframework/EngincanV/issue-13438
CLI: Don't accept `--theme` option before v6.0.0-rc.1
pull/13571/head
liangshiwei
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
38 additions and
12 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs
|
|
|
@ -103,18 +103,6 @@ public abstract class ProjectCreationCommandBase |
|
|
|
Logger.LogInformation("UI Framework: " + uiFramework); |
|
|
|
} |
|
|
|
|
|
|
|
var theme = uiFramework == UiFramework.None ? (Theme?)null : GetThemeByTemplateOrNull(commandLineArgs, template); |
|
|
|
if (theme.HasValue) |
|
|
|
{ |
|
|
|
Logger.LogInformation("Theme: " + theme); |
|
|
|
} |
|
|
|
|
|
|
|
var themeStyle = theme.HasValue ? GetThemeStyleOrNull(commandLineArgs, theme.Value) : (ThemeStyle?)null; |
|
|
|
if(themeStyle.HasValue) |
|
|
|
{ |
|
|
|
Logger.LogInformation("Theme Style: " + themeStyle); |
|
|
|
} |
|
|
|
|
|
|
|
var publicWebSite = uiFramework != UiFramework.None && commandLineArgs.Options.ContainsKey(Options.PublicWebSite.Long); |
|
|
|
if (publicWebSite) |
|
|
|
{ |
|
|
|
@ -210,6 +198,9 @@ public abstract class ProjectCreationCommandBase |
|
|
|
} |
|
|
|
|
|
|
|
commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); |
|
|
|
|
|
|
|
var theme = uiFramework == UiFramework.None ? (Theme?)null : GetThemeByTemplateOrNull(commandLineArgs, template); |
|
|
|
var themeStyle = theme.HasValue ? GetThemeStyleOrNull(commandLineArgs, theme.Value) : (ThemeStyle?)null; |
|
|
|
|
|
|
|
return new ProjectBuildArgs( |
|
|
|
solutionName, |
|
|
|
|
|
|
|
@ -71,6 +71,8 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency |
|
|
|
args.ExtraProperties.ContainsKey(NewCommand.Options.Preview.Long) |
|
|
|
); |
|
|
|
|
|
|
|
ConfigureThemeOptions(args, templateFile.Version); |
|
|
|
|
|
|
|
DeveloperApiKeyResult apiKeyResult = null; |
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
@ -207,4 +209,37 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency |
|
|
|
return TemplateInfoProvider.Get(args.TemplateName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private bool IsThemeOptionEnabled(ProjectBuildArgs args, string templateVersion) |
|
|
|
{ |
|
|
|
var version = string.IsNullOrWhiteSpace(args.Version) |
|
|
|
? templateVersion |
|
|
|
: args.Version; |
|
|
|
|
|
|
|
if (!SemanticVersion.TryParse(version, out var semanticVersion)) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return semanticVersion >= SemanticVersion.Parse("6.0.0-rc.1"); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureThemeOptions(ProjectBuildArgs args, string templateVersion) |
|
|
|
{ |
|
|
|
if (!IsThemeOptionEnabled(args, templateVersion)) |
|
|
|
{ |
|
|
|
args.Theme = null; |
|
|
|
args.ThemeStyle = null; |
|
|
|
} |
|
|
|
|
|
|
|
if (args.Theme.HasValue) |
|
|
|
{ |
|
|
|
Logger.LogInformation("Theme: " + args.Theme); |
|
|
|
} |
|
|
|
|
|
|
|
if(args.ThemeStyle.HasValue) |
|
|
|
{ |
|
|
|
Logger.LogInformation("Theme Style: " + args.ThemeStyle); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|