From 51cfd91b9f07fd6a40ae6f8c5416d49f78146c3a Mon Sep 17 00:00:00 2001 From: Jose Melo Date: Thu, 12 Nov 2026 14:43:50 +0000 Subject: [PATCH 1/2] fix(new): configure Angular allowed hosts for MES 12 apps --- cmf-cli/Commands/new/HTMLCommand.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cmf-cli/Commands/new/HTMLCommand.cs b/cmf-cli/Commands/new/HTMLCommand.cs index b20199d4d..99c6f7581 100644 --- a/cmf-cli/Commands/new/HTMLCommand.cs +++ b/cmf-cli/Commands/new/HTMLCommand.cs @@ -15,6 +15,7 @@ using Cmf.CLI.Utilities; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace Cmf.CLI.Commands.New { @@ -179,9 +180,24 @@ public void Execute(IDirectoryInfo workingDir, string version) throw new CliException("Could not retrieve repository AppData."); var appName = appData.id; - var servePathArgument = $" --allowed-hosts host.docker.internal --serve-path /apps/{appName}/"; + var servePathArgument = mesVersion.Major >= 12 + ? $" --serve-path /apps/{appName}/" + : $" --allowed-hosts host.docker.internal --serve-path /apps/{appName}/"; rootPkgJson.scripts["serve"] += servePathArgument; + if (mesVersion.Major >= 12) + { + var angularJsonPath = this.fileSystem.Path.Join(packageDir.FullName, "angular.json"); + var angularJson = JObject.Parse(this.fileSystem.File.ReadAllText(angularJsonPath)); + var serve = angularJson["projects"]?[packageName]?["architect"]?["serve"] as JObject + ?? throw new CliException("Could not retrieve Angular serve configuration."); + var options = serve["options"] as JObject ?? new JObject(); + options["allowedHosts"] = new JArray("host.docker.internal"); + serve["options"] = options; + this.fileSystem.File.WriteAllText(angularJsonPath, angularJson.ToString(Formatting.Indented)); + Log.Verbose("Updated angular.json"); + } + var indexHtmlPath = this.fileSystem.Path.Join(packageDir.FullName, "src", "index.html"); var indexHtmlStr = fileSystem.File.ReadAllText(indexHtmlPath); From 362e5fc403fee4a5ee8ac0d7652c93228ec98ba0 Mon Sep 17 00:00:00 2001 From: Jose Melo Date: Fri, 13 Nov 2026 11:00:37 +0000 Subject: [PATCH 2/2] fix(new): handle self-closing base href in HTML apps --- cmf-cli/Commands/new/HTMLCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmf-cli/Commands/new/HTMLCommand.cs b/cmf-cli/Commands/new/HTMLCommand.cs index 99c6f7581..aad816522 100644 --- a/cmf-cli/Commands/new/HTMLCommand.cs +++ b/cmf-cli/Commands/new/HTMLCommand.cs @@ -205,7 +205,7 @@ public void Execute(IDirectoryInfo workingDir, string version) indexHtmlStr = Regex.Replace(indexHtmlStr, "(.*?)", $"{appName}"); // Replaces the base href to support running the app in a sub path - indexHtmlStr = Regex.Replace(indexHtmlStr, "", $""); + indexHtmlStr = Regex.Replace(indexHtmlStr, "", $""); this.fileSystem.File.WriteAllText(indexHtmlPath, indexHtmlStr);