Browse Source
Merge pull request #8162 from abpframework/bundle-command-improvement
Use default values for bundle command if there is no config specified.
pull/8170/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
20 additions and
19 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundleConfig.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/AbpCliConfig.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Configuration/ConfigReader.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(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -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) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -4,6 +4,6 @@ namespace Volo.Abp.Cli.Configuration |
|
|
|
{ |
|
|
|
public class AbpCliConfig |
|
|
|
{ |
|
|
|
public BundleConfig Bundle { get; set; } |
|
|
|
public BundleConfig Bundle { get; set; } = new(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -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<AbpCliConfig>(configText, options); |
|
|
|
return JsonSerializer.Deserialize<AbpCliConfig>(configJson, options); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return new AbpCliConfig(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|