Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [6.0.0-3](https://github.com/criticalmanufacturing/cli/compare/6.0.0-2...6.0.0-3) (2026-08-21)


### Features

* add dependency version for v12 (dotnet, node, ng22) ([3c3019a](https://github.com/criticalmanufacturing/cli/commit/3c3019af1202e790770c25240493335c35deb89e))
* add support for pre-releases ([2d89954](https://github.com/criticalmanufacturing/cli/commit/2d89954ae20f980209508aea1a702f3f634dca49))


### Bug Fixes

* update SharpCompress package version and improve TAR.GZ handling in CmfPackageController ([c3f654b](https://github.com/criticalmanufacturing/cli/commit/c3f654bb62b8b4032f924e17c8332f30281b0a8a))


### Under the hood

* remove outdated NPX version handling logic from NPXCommand ([5a75a86](https://github.com/criticalmanufacturing/cli/commit/5a75a86b21231a7582d9ccd64ba9b8a0605e511d))
* replace Version with MesVersion for improved semantic version handling across the CLI ([7893e74](https://github.com/criticalmanufacturing/cli/commit/7893e749d07c83a60498c513ce9bf91aa8d3aabf))

## [6.0.0-2](https://github.com/criticalmanufacturing/cli/compare/6.0.0-1...6.0.0-2) (2026-07-22)


Expand Down
15 changes: 1 addition & 14 deletions cmf-cli/Builders/NPXCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Cmf.CLI.Core.Objects;
using NuGet.Versioning;

namespace Cmf.CLI.Builders
{
Expand Down Expand Up @@ -40,18 +39,6 @@ public override ProcessBuildStep[] GetSteps()
// Bypass any interactive confirmation prompts that might appear
"-y"
};

// The initial versions of NPX (<= 6) that are used by MES v8 and v9 must be called like this:
// npx -y true
// Later versions of NPX (>= 7) that are used by MES v10 and greater, must be called only like this:
// npx -y
// So we get the MES version of the project, and we assume that the user must be running the supported
// node version for that MES project
var mesVersion = ExecutionContext.Instance?.ProjectConfig?.MESVersion;
if (mesVersion != null && mesVersion < new Version(10, 0))
{
args.Add("true");
}

args.Add(this.Command);
if (this.Args != null)
Expand Down
8 changes: 4 additions & 4 deletions cmf-cli/Commands/UILayerTemplateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ protected void CloneHTMLStarter(Version versionTag, IDirectoryInfo target)
target.GetFiles(".gitkeep").FirstOrDefault()?.Delete();
Log.Verbose("cloning html starter");
// git init
(new GitCommand() { Command = "init", WorkingDirectory = target }).Exec();
new GitCommand() { Command = "init", WorkingDirectory = target }.Exec();
// git remote add origin https://github.com/criticalmanufacturing/html-starter
(new GitCommand() { Command = "remote", WorkingDirectory = target, Args = new[] { "add", "origin", "https://github.com/criticalmanufacturing/html-starter" } }).Exec();
new GitCommand() { Command = "remote", WorkingDirectory = target, Args = ["add", "origin", "https://github.com/criticalmanufacturing/html-starter"] }.Exec();
// git fetch
(new GitCommand() { Command = "fetch", WorkingDirectory = target }).Exec();
new GitCommand() { Command = "fetch", WorkingDirectory = target }.Exec();
// git pull origin $vars['HTMLStarterVersion']
(new GitCommand() { Command = "pull", WorkingDirectory = target, Args = new[] { "origin", versionTag.ToString() } }).Exec();
new GitCommand() { Command = "pull", WorkingDirectory = target, Args = ["origin", versionTag.ToString()] }.Exec();
Log.Debug("delete .git folder");
this.DeleteFolderWithReadOnlyFiles(target.GetDirectories(".git").FirstOrDefault());
// delete apps/.gitkeep
Expand Down
4 changes: 2 additions & 2 deletions cmf-cli/Commands/build/html/ExtractI18nCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
using Cmf.CLI.Utilities;
using System.Xml.Linq;
using System.Linq;
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using NuGet.Versioning;

namespace Cmf.CLI.Commands.html;

Expand All @@ -26,7 +26,7 @@ public class ExtractI18nCommand : BaseCommand
/// <summary>
/// The minimum MES Version that supports this command
/// </summary>
private readonly Version MIN_MES_VERSION = new Version(11, 2, 0);
private readonly NuGetVersion MIN_MES_VERSION = new NuGetVersion(11, 2, 0);

/// <summary>
/// constructor
Expand Down
4 changes: 2 additions & 2 deletions cmf-cli/Commands/build/html/LocalizeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Cmf.CLI.Core.Objects;
using Cmf.CLI.Utilities;
using System.Linq;
using System;
using NuGet.Versioning;

namespace Cmf.CLI.Commands.html;

Expand All @@ -21,7 +21,7 @@ public class LocalizeCommand : BaseCommand
/// <summary>
/// The minimum MES Version that supports this command
/// </summary>
private readonly Version MIN_MES_VERSION = new Version(11, 2, 0);
private readonly NuGetVersion MIN_MES_VERSION = new NuGetVersion(11, 2, 0);

public override void Configure(Command cmd)
{
Expand Down
9 changes: 5 additions & 4 deletions cmf-cli/Commands/init/InitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Cmf.CLI.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NuGet.Versioning;

namespace Cmf.CLI.Commands
{
Expand Down Expand Up @@ -514,8 +515,8 @@ internal void Execute(InitArguments x)

if (string.IsNullOrWhiteSpace(x.ngxSchematicsVersion))
{
var mesVer = Version.Parse(x.BaseVersion);
x.ngxSchematicsVersion = $"release-{mesVer.Major}{mesVer.Minor}{mesVer.Build}";
var mesVer = NuGetVersion.Parse(x.BaseVersion);
x.ngxSchematicsVersion = GenericUtilities.GetNpmDistTag(mesVer);
}

Log.Information($"Using ngx-schematics version: {x.ngxSchematicsVersion}");
Expand Down Expand Up @@ -578,10 +579,10 @@ internal void Execute(InitArguments x)

#region version-specific bits

var version = Version.Parse(x.BaseVersion);
var version = new NuGetVersion(x.BaseVersion);
args.AddRange(new []{ "--dotnetSDKVersion", ExecutionContext.ServiceProvider.GetService<IDependencyVersionService>().DotNetSdk(version) });

if(version < new Version(10,0))
if(version < new NuGetVersion(10, 0, 0))
{
throw new CliException("MES Versions under 10 are no longer supported with the newest version of the CLI. Please use cmf-cli 5.8.0 or lower.");
}
Expand Down
2 changes: 1 addition & 1 deletion cmf-cli/Commands/new/DataCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void Configure(Command cmd)
protected override List<string> GenerateArgs(IDirectoryInfo projectRoot, IDirectoryInfo workingDir, List<string> args)
{
var repoType = ExecutionContext.Instance.ProjectConfig.RepositoryType ?? CliConstants.DefaultRepositoryType;
Version version = ExecutionContext.Instance.ProjectConfig.MESVersion;
var version = ExecutionContext.Instance.ProjectConfig.MESVersion;

var relativePathToRoot =
this.fileSystem.Path.Join("..", //always one level deeper
Expand Down
14 changes: 11 additions & 3 deletions cmf-cli/Commands/new/HTMLCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void ExecuteV10(IDirectoryInfo workingDir, string version)
var packageName = base.GeneratePackageName(workingDir)!.Value.Item1;
var packageDir = workingDir.GetDirectories(packageName).First();

var schematicsVersion = !string.IsNullOrEmpty(ngxSchematicsVersion) ? ngxSchematicsVersion : $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}";
var schematicsVersion = !string.IsNullOrEmpty(ngxSchematicsVersion?.ToString()) ? ngxSchematicsVersion.ToString() : GenericUtilities.GetNpmDistTag(mesVersion);

//After v11 we use Angular default routing
var routing = mesVersion.Major >= 11 ? "true" : "false";
Expand Down Expand Up @@ -143,7 +143,7 @@ public void ExecuteV10(IDirectoryInfo workingDir, string version)
"add", "--registry", ExecutionContext.Instance.ProjectConfig.NPMRegistry.OriginalString,
"--skip-confirmation", $"@criticalmanufacturing/ngx-schematics@{schematicsVersion}",
"--eslint", "--application", baseLayer.ToString(),
"--version", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}"
"--version", GenericUtilities.GetNpmDistTag(mesVersion)
],
WorkingDirectory = packageDir,
ForceColorOutput = false
Expand All @@ -170,7 +170,15 @@ public void ExecuteV10(IDirectoryInfo workingDir, string version)
rootPkgJson.devDependencies["cross-env"] = "^10.1.0";
}

rootPkgJson.scripts["serve"] = "cross-env NODE_OPTIONS=--max-old-space-size=8192 npm run start -- --host 0.0.0.0 --disable-host-check --port 7000";

if (mesVersion.Major < 12)
{
rootPkgJson.scripts["serve"] = "cross-env NODE_OPTIONS=--max-old-space-size=8192 npm run start -- --host 0.0.0.0 --disable-host-check --port 7000";
}
else
{
rootPkgJson.scripts["serve"] = "cross-env NODE_OPTIONS=--max-old-space-size=8192 npm run start -- --host 0.0.0.0 --port 7000";
}

if (ExecutionContext.Instance.ProjectConfig.RepositoryType == RepositoryType.App)
{
Expand Down
9 changes: 5 additions & 4 deletions cmf-cli/Commands/new/HelpCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.IO.Abstractions;
Expand All @@ -16,6 +15,7 @@
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NuGet.Versioning;

namespace Cmf.CLI.Commands.New
{
Expand Down Expand Up @@ -64,9 +64,10 @@ protected override List<string> GenerateArgs(IDirectoryInfo projectRoot, IDirect
projectRoot.FullName)
).Replace("\\", "/");

var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;
var requireModuleSES =
ExecutionContext.Instance.ProjectConfig.MESVersion >= new Version(11, 0, 0) &&
ExecutionContext.Instance.ProjectConfig.MESVersion < new Version(11, 2, 0);
mesVersion >= new NuGetVersion(11, 0, 0) &&
mesVersion < new NuGetVersion(11, 2, 0);

var angularDeps = ExecutionContext.ServiceProvider.GetService<IDependencyVersionService>().Angular(ExecutionContext.Instance.ProjectConfig.MESVersion);

Expand Down Expand Up @@ -102,7 +103,7 @@ public void Execute(IDirectoryInfo workingDir, string version)

var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;

this.schematicsVersion = ngxSchematicsVersion ?? $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}";
this.schematicsVersion = !string.IsNullOrEmpty(ngxSchematicsVersion?.ToString()) ? ngxSchematicsVersion.ToString() : GenericUtilities.GetNpmDistTag(mesVersion);

//Switch between v10 and v11 template
switch (majorVersion)
Expand Down
20 changes: 8 additions & 12 deletions cmf-cli/Commands/new/IoTCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Cmf.CLI.Services;
using Cmf.CLI.Utilities;
using Microsoft.Extensions.DependencyInjection;
using System;
using NuGet.Versioning;
using System.Collections.Generic;
using System.CommandLine;
using System.IO.Abstractions;
Expand Down Expand Up @@ -114,10 +114,10 @@ public void Execute(IDirectoryInfo workingDir, string version, string htmlPackag
var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;
// (ATL) Automation Task Library Package
// only introduced in v10.2.7
var executeV10ATL = !isAngularPackage && mesVersion >= new Version(10, 2, 7) && mesVersion < new Version(11, 0, 0);
var executeV10ATL = !isAngularPackage && mesVersion >= new NuGetVersion(10, 2, 7) && mesVersion < new NuGetVersion(11, 0, 0);

// only introduced in v11
var executeV11ATL = !isAngularPackage && mesVersion >= new Version(11, 0, 0);
var executeV11ATL = !isAngularPackage && mesVersion >= new NuGetVersion(11, 0, 0);

if (executeV10ATL)
{
Expand Down Expand Up @@ -160,7 +160,6 @@ public void ExecuteV10ATL(IDirectoryInfo workingDir, string version)
}

var iotCustomPackageWorkDir = iotCustomPackage.GetFileInfo().Directory;
var iotCustomPackageName = base.GeneratePackageName(iotCustomPackageWorkDir)!.Value.Item1;

var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;

Expand All @@ -175,8 +174,10 @@ public void ExecuteV10AngularPackage(IDirectoryInfo workingDir, string version,
{
throw new CliException(CliMessages.IoTV10HTMLPackageMustBeProvided);
}


var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;
var ngxSchematicsVersion = ExecutionContext.Instance.ProjectConfig.NGXSchematicsVersion;
var schematicsVersion = !string.IsNullOrEmpty(ngxSchematicsVersion?.ToString()) ? ngxSchematicsVersion.ToString() : GenericUtilities.GetNpmDistTag(mesVersion);

IDirectoryInfo htmlPackageDir = fileSystem.DirectoryInfo.New(htmlPackageLocation);

Expand Down Expand Up @@ -208,11 +209,6 @@ public void ExecuteV10AngularPackage(IDirectoryInfo workingDir, string version,
}

var iotCustomPackageWorkDir = iotCustomPackage.GetFileInfo().Directory;
var iotCustomPackageName = base.GeneratePackageName(iotCustomPackageWorkDir)!.Value.Item1;

var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;

var schematicsVersion = ngxSchematicsVersion ?? $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}";

Log.Debug($"Creating new IoT Workspace {packageName}");

Expand Down Expand Up @@ -256,7 +252,7 @@ public void ExecuteV10AngularPackage(IDirectoryInfo workingDir, string version,
"--skip-confirmation", $"@criticalmanufacturing/ngx-iot-schematics@{schematicsVersion}",
"--lint",
"--base-app", baseLayer.ToString(),
"--version", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}" },
"--version", GenericUtilities.GetNpmDistTag(mesVersion) },
WorkingDirectory = iotCustomPackageWorkDir,
ForceColorOutput = false
}.Exec();
Expand All @@ -276,7 +272,7 @@ public void ExecuteV10AngularPackage(IDirectoryInfo workingDir, string version,
#endregion Link To HTML Package
}

private static void InstallYoeman(IDirectoryInfo iotCustomPackageWorkDir, Version mesVersion)
private static void InstallYoeman(IDirectoryInfo iotCustomPackageWorkDir, NuGetVersion mesVersion)
{
Log.Debug($"Installing Yeoman");

Expand Down
4 changes: 2 additions & 2 deletions cmf-cli/Commands/new/TestCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
using System.Collections.Generic;
using System.CommandLine;
using System.IO.Abstractions;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Cmf.CLI.Services;
using NuGet.Versioning;

namespace Cmf.CLI.Commands.New
{
Expand Down Expand Up @@ -108,7 +108,7 @@ public void Execute(string version)
#region version-specific bits
args.AddRange(new []{ "--targetFramework", ExecutionContext.ServiceProvider.GetService<IDependencyVersionService>().DotNetTargetFramework(mesVersion) });

if (mesVersion >= new Version(11, 2, 3))
if (mesVersion >= new NuGetVersion(11, 2, 3))
{
args.Add("--hostPerformanceTests");
}
Expand Down
2 changes: 1 addition & 1 deletion cmf-cli/Commands/new/iot/GenerateDotnetDriverCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private List<string> GenerateArgs(
var args = new List<string>();
args.AddRange(new[]
{
"--targetSystemVersionProcessed", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}",
"--targetSystemVersionProcessed", GenericUtilities.GetNpmDistTag(mesVersion),
"--directoryName", directoryName,
"--identifier", identifier,
"--identifierCamel", identifierCamel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private List<string> GenerateArgs(
var args = new List<string>();
args.AddRange(new[]
{
"--targetSystemVersionProcessed", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}",
"--targetSystemVersionProcessed", GenericUtilities.GetNpmDistTag(mesVersion),
"--directoryName", directoryName,
"--identifier", identifier,
"--identifierCamel", identifierCamel,
Expand Down
2 changes: 1 addition & 1 deletion cmf-cli/Commands/new/iot/GenerateDriverCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private List<string> GenerateArgs(
var args = new List<string>();
args.AddRange(new[]
{
"--targetSystemVersionProcessed", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}",
"--targetSystemVersionProcessed", GenericUtilities.GetNpmDistTag(mesVersion),
"--directoryName", directoryName,
"--identifier", identifier,
"--identifierCamel", identifierCamel,
Expand Down
2 changes: 1 addition & 1 deletion cmf-cli/Commands/new/iot/GenerateTaskLibraryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private List<string> GenerateArgs(
"--identifierLower", identifier.Replace(" ", "").ToLower().Trim(),
"--packageName", fullPackageName,
"--packageVersion", packageVersion,
"--targetSystemVersionProcessed", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}",
"--targetSystemVersionProcessed", GenericUtilities.GetNpmDistTag(mesVersion),
"--dependsOnScope", JsonConvert.SerializeObject(dependsOnScope),
"--mandatoryForScope", JsonConvert.SerializeObject(mandatoryForScope),
"--dependsOnProtocol", JsonConvert.SerializeObject(dependsOnProtocol),
Expand Down
4 changes: 2 additions & 2 deletions cmf-cli/Commands/upgrade/UpgradeBaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Cmf.CLI.Factories;
using Cmf.CLI.Utilities;
using Microsoft.Extensions.DependencyInjection;
using System;
using NuGet.Versioning;
using System.Collections.Generic;
using System.CommandLine;
using System.IO;
Expand Down Expand Up @@ -144,7 +144,7 @@ private void UpdateProjectConfig(IDirectoryInfo packagePath, string baseVersion)
text = UpgradeBaseUtilities.UpdateJsonValue(text, key, baseVersion);
}

if (new Version(baseVersion).Major >= 11)
if (NuGetVersion.Parse(baseVersion).Major >= 11)
{
// TODO: find a more elegant way to apply these changes to files/packages when this command is executed.
// For the moment, sneaking this if-statement in will do the job but long-term we'll need an approach that
Expand Down
Loading
Loading