diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index 2db480506b..c71e9591c0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -236,7 +236,7 @@ namespace Volo.Abp.Cli.ProjectModification } } - if (version == currentVersion) + if (string.IsNullOrEmpty(version) || version == currentVersion) { return false; } @@ -275,6 +275,12 @@ namespace Volo.Abp.Cli.ProjectModification ? versionList.First() : versionList.FirstOrDefault(v => !SemanticVersion.Parse(v).IsPrerelease); + if (string.IsNullOrEmpty(newVersion)) + { + _fileVersionStorage[package.Name] = newVersion; + return newVersion; + } + var newVersionWithPrefix = $"~{newVersion}"; _fileVersionStorage[package.Name] = newVersionWithPrefix; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs index 60c7fd21b9..66f39fa12f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs @@ -31,6 +31,7 @@ namespace Volo.Abp.Cli.ProjectModification { var solutionPath = GetSolutionPath(commandLineArgs); var solutionFolder = GetSolutionFolder(commandLineArgs); + var solutionAngularFolder = GetSolutionAngularFolder(solutionFolder); await _nugetPackagesVersionUpdater.UpdateSolutionAsync( solutionPath, @@ -40,42 +41,74 @@ namespace Volo.Abp.Cli.ProjectModification solutionFolder, false, true); + + if (solutionAngularFolder != null) + { + await _npmPackagesUpdater.Update( + solutionAngularFolder, + false, + true); + } } public async Task SwitchToNightlyPreview(CommandLineArgs commandLineArgs) { var solutionPath = GetSolutionPath(commandLineArgs); var solutionFolder = GetSolutionFolder(commandLineArgs); + var solutionAngularFolder = GetSolutionAngularFolder(solutionFolder); _packageSourceManager.Add(solutionFolder, "ABP Nightly", "https://www.myget.org/F/abp-nightly/api/v3/index.json"); - await _nugetPackagesVersionUpdater.UpdateSolutionAsync( - solutionPath, - true); + if (solutionPath != null) + { + await _nugetPackagesVersionUpdater.UpdateSolutionAsync( + solutionPath, + true); + } await _npmPackagesUpdater.Update( solutionFolder, true); + + if (solutionAngularFolder != null) + { + await _npmPackagesUpdater.Update( + solutionAngularFolder, + true); + } } public async Task SwitchToStable(CommandLineArgs commandLineArgs) { var solutionPath = GetSolutionPath(commandLineArgs); var solutionFolder = GetSolutionFolder(commandLineArgs); + var solutionAngularFolder = GetSolutionAngularFolder(solutionFolder); _packageSourceManager.Remove(solutionFolder, "ABP Nightly"); - await _nugetPackagesVersionUpdater.UpdateSolutionAsync( - solutionPath, - false, - false, - true); + if (solutionPath != null) + { + await _nugetPackagesVersionUpdater.UpdateSolutionAsync( + solutionPath, + false, + false, + true); + } await _npmPackagesUpdater.Update( solutionFolder, false, false, true); + + if (solutionAngularFolder != null) + { + await _npmPackagesUpdater.Update( + solutionAngularFolder, + false, + false, + true); + } } private string GetSolutionPath(CommandLineArgs commandLineArgs) @@ -99,7 +132,7 @@ namespace Volo.Abp.Cli.ProjectModification } } - Logger.LogError("There is no solution or more that one solution in current directory."); + Logger.LogWarning("There is no solution or more that one solution in current directory."); return null; } @@ -112,6 +145,23 @@ namespace Volo.Abp.Cli.ProjectModification ?? Directory.GetCurrentDirectory(); } + private string GetSolutionAngularFolder(string solutionFolder) + { + var upperAngularPath = Path.Combine(Directory.GetParent(solutionFolder)?.FullName ?? "", "angular"); + if (Directory.Exists(upperAngularPath)) + { + return upperAngularPath; + } + + var innerAngularPath = Path.Combine(solutionFolder, "angular"); + if (Directory.Exists(innerAngularPath)) + { + return innerAngularPath; + } + + return null; + } + public static class Options { public static class SolutionDirectory diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/luxon/abp.luxon.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/luxon/abp.luxon.js new file mode 100644 index 0000000000..b04de7cadf --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/luxon/abp.luxon.js @@ -0,0 +1,46 @@ +var abp = abp || {}; +(function () { + + if (!luxon) { + throw "abp/luxon library requires the luxon library included to the page!"; + } + + /* TIMING *************************************************/ + + abp.timing = abp.timing || {}; + + var setObjectValue = function (obj, property, value) { + if (typeof property === "string") { + property = property.split('.'); + } + + if (property.length > 1) { + var p = property.shift(); + setObjectValue(obj[p], property, value); + } else { + obj[property[0]] = value; + } + } + + var getObjectValue = function (obj, property) { + return property.split('.').reduce((a, v) => a[v], obj) + } + + abp.timing.convertFieldsToIsoDate = function (form, fields) { + for (var field of fields) { + var dateTime = luxon.DateTime + .fromFormat( + getObjectValue(form, field), + abp.localization.currentCulture.dateTimeFormat.shortDatePattern, + {locale: abp.localization.currentCulture.cultureName} + ); + + if (!dateTime.invalid) { + setObjectValue(form, field, dateTime.toFormat("yyyy-MM-dd HH:mm:ss")) + } + } + + return form; + } + +})(jQuery);