diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundleConfig.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundleConfig.cs index 3fb1dd91c9..f1eae11bde 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundleConfig.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundleConfig.cs @@ -5,8 +5,8 @@ namespace Volo.Abp.Cli.Bundling { public class BundleConfig { - public BundlingMode Mode { get; set; } - public string Name { get; set; } - public BundleParameterDictionary Parameters { get; set; } + public BundlingMode Mode { get; set; } = BundlingMode.BundleAndMinify; + public string Name { get; set; } = "global"; + public BundleParameterDictionary Parameters { get; set; } = new(); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs index cbe577380f..cc8d9c0bf5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs @@ -41,12 +41,7 @@ namespace Volo.Abp.Cli.Bundling var projectFilePath = projectFiles[0]; var config = ConfigReader.Read(PathHelper.GetWwwRootPath(directory)); - var bundleConfig = config?.Bundle; - - if (bundleConfig == null) - { - throw new BundlingException("Bundle section is missing in the appsettings.json configuration file."); - } + var bundleConfig = config.Bundle; if (forceBuild) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/AbpCliConfig.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/AbpCliConfig.cs index e71f54c097..7ce02532f7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/AbpCliConfig.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/AbpCliConfig.cs @@ -4,6 +4,6 @@ namespace Volo.Abp.Cli.Configuration { public class AbpCliConfig { - public BundleConfig Bundle { get; set; } + public BundleConfig Bundle { get; set; } = new(); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/ConfigReader.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/ConfigReader.cs index baf1fc79dc..7b53ce375c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/ConfigReader.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/ConfigReader.cs @@ -30,18 +30,24 @@ namespace Volo.Abp.Cli.Configuration using (var document = JsonDocument.Parse(settingsFileContent,documentOptions)) { - var element = document.RootElement.GetProperty("AbpCli"); - var configText = element.GetRawText(); - var options = new JsonSerializerOptions + if (document.RootElement.TryGetProperty("AbpCli", out var element)) { - Converters = + var configJson = element.GetRawText(); + var options = new JsonSerializerOptions { - new JsonStringEnumConverter() - }, - ReadCommentHandling = JsonCommentHandling.Skip - }; + Converters = + { + new JsonStringEnumConverter() + }, + ReadCommentHandling = JsonCommentHandling.Skip + }; - return JsonSerializer.Deserialize(configText, options); + return JsonSerializer.Deserialize(configJson, options); + } + else + { + return new AbpCliConfig(); + } } } }