Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.0.0 #325

Merged
merged 79 commits into from
Jul 26, 2023
Merged
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
5281ff1
chore!: upgrade dotnet command line api dependencies to the latest beta
m-s- Feb 28, 2023
d26d209
chore: upgrade dotnet/templating dependency to latest v6
m-s- Mar 2, 2023
519aa02
chore: upgrade several nuget dependencies
m-s- Mar 3, 2023
06ad621
chore: upgrade System.IO.Abstractions nugets
m-s- Mar 3, 2023
d9f35b1
refactor!: invoke execution via Parser instead of RootCommand, with a…
m-s- Mar 6, 2023
cf41659
feat: support scaffolding apps in `cmf init`
m-s- Mar 9, 2023
8eebd69
test: increase test coverage for pack and assemble
ricardofslp Mar 16, 2023
9d60396
refactor!: revert Consistency Check
jrk94 Mar 21, 2023
500118c
chore(plugin): bump template cli core dependency (#287)
jrk94 Mar 27, 2023
c59345f
feat(new): allow scaffolding HTML packages for MES v10
m-s- Mar 20, 2023
fb676f8
chore: migrate GenerateBasedOnTemplates to csharp to remove Powershel…
m-s- Mar 23, 2023
f9f0f96
feat(build): support @angular/cli managed HTML package
m-s- Mar 9, 2023
0fb4c91
chore: use npx for invoking ng, so we don't require installation
m-s- Mar 20, 2023
8090bee
feat(bump): support @angular/cli managed HTML packages
joaoopereira Mar 22, 2023
b6b77dc
chore(pipelines)!: improvements on CI-Release and CD-Containers
joaoopereira Feb 28, 2023
eb1f5d2
refactor(pipelines)!: move all environment related variables to Build…
joaoopereira Mar 2, 2023
05be07b
chore: add ISOLocation to project-config
joaoopereira Mar 28, 2023
731b738
feat(pipelines)!: add Authentication Variables closes #253
joaoopereira Mar 6, 2023
438f820
chore(pipelines): small fixes on improvements
joaoopereira Mar 28, 2023
a037440
refactor: move TemplaceCommand to Core
joaoopereira Mar 31, 2023
7a9e2c8
feat: scaffold a reference doc package for MES v10
m-s- Mar 24, 2023
91406d5
fix: missing MES version token replacement in new Feature command
m-s- Mar 29, 2023
b06b5b0
chore: support latest version of ngx-schematics
m-s- Mar 29, 2023
807564c
feat: build MES v10 help packages
m-s- Mar 30, 2023
c4c9802
fixup! feat(new): allow scaffolding HTML packages for MES v10
m-s- Mar 30, 2023
a2d3ab8
Merge remote-tracking branch 'origin/main' into development
m-s- Apr 4, 2023
ff7450a
chore: change deprecated System.IO.Abstraction methods to the newer e…
m-s- Apr 4, 2023
41cb620
refactor: read project-config as a versioned object instead of a Json…
m-s- Apr 4, 2023
e969d3b
test: test the new project-config mechanism
m-s- Apr 5, 2023
35f76dc
chore: fix plugin scaffolding template
joaoopereira Apr 3, 2023
34940ba
chore: remove stale documentation
m-s- Apr 5, 2023
d29ee9f
chore: move documentation to the code branch
m-s- Apr 5, 2023
02583f4
chore: bump to 4.0.0-0
m-s- Apr 10, 2023
114a53f
refactor(pipelines)!: deprecate pipelines scaffolding
joaoopereira Apr 11, 2023
cd4558c
chore: bump to 4.0.0-1
joaoopereira Apr 12, 2023
b8b11af
fix(plugins): pass null to NPMClient if no registry was specified
m-s- Apr 17, 2023
7293ca9
refactor(installation): remove temporary zip file from github releases
m-s- Apr 17, 2023
67df93a
chore(init): fix typo in project-config
joaoopereira Apr 17, 2023
ec688f4
docs(refactor): deprecate pipelines scaffolding
joaoopereira Apr 17, 2023
a69836e
chore(docs): make pdf export optional
joaoopereira Apr 17, 2023
2f3bb51
refactor: support pre-release ngxSchematics and yeoman generators
m-s- Apr 18, 2023
4ba5e6f
refactor(plugins)!: bypass System.CommandLine API when invoking plugins
m-s- Apr 18, 2023
1793658
docs: remove repositoryUrl from cmf init
joaoopereira May 2, 2023
1f9f14c
chore: remove powershell runtime as it's no longer needed
m-s- Apr 20, 2023
60f0328
refactor(build): remove .NET bundling from bundle (testing) builds
m-s- Apr 20, 2023
d9e24fa
feat: add validate start/end methods command
Apr 19, 2023
5802fe8
chore: do not process methods without input object
Apr 19, 2023
a2d41f1
chore: validate method name
Apr 19, 2023
952c130
chore: change factory to singleton and processors to transient
Apr 20, 2023
49d9d5b
chore: fix typo
m-s- Apr 26, 2023
aee6c86
chore: replace values with tokens in index.html, ngsw.json and assets…
m-s- Apr 26, 2023
9216048
chore: bump to 4.0.0-2
joaoopereira May 8, 2023
7c98f98
docs: fix scaffolding typo
joaoopereira May 16, 2023
debdd2f
chore: avoid exception when envar is already set
joaoopereira May 16, 2023
e9223b8
chore: bump to 4.0.0-3
joaoopereira May 16, 2023
1109ad2
feat(LBOs): automatically link LBOs when building UI packages
m-s- May 29, 2023
08102a9
feat(help packages): add token placer as we do for html
m-s- May 25, 2023
ed5ec3a
refactor(LBOs)!: remove deprecated LBO generation script
m-s- May 29, 2023
a32053d
chore: remove nullable notation where not needed
m-s- May 29, 2023
1ca6dea
chore: bump to 4.0.0-4
m-s- May 30, 2023
e983ebb
chore: log warning instead of information on development version checks
joaoopereira Jun 5, 2023
70a5d3e
chore(new html): build app and define config settings after new
joaoopereira Jun 13, 2023
8216a71
fix(build): use package name instead of workspace key for token replacer
m-s- Jun 22, 2023
67ecd4d
chore: bump to 4.0.0-5
m-s- Jun 22, 2023
defda80
chore: bump to 4.0.0-6
m-s- Jun 29, 2023
a024784
feat(new): add Support for New IoT V10
jrk94 Apr 11, 2023
01428ea
fix: change on V9 IoT Build Process
jrk94 Jun 30, 2023
d7cbd37
chore: bump to 4.0.0-7
m-s- Jul 3, 2023
7264300
fix: iot for versions lesser than v835 (#319)
jrk94 Jul 3, 2023
353404a
chore: bump to 4.0.0-8
m-s- Jul 3, 2023
20fcfcb
fix: guard DevTasksVersion
jrk94 Jul 6, 2023
9bbd982
fix: reference Nuget.Versioning directly, as we use it for SemanticVe…
m-s- Jul 13, 2023
7d55d0a
chore: bump to 4.0.0-9
m-s- Jul 13, 2023
2823196
chore: reduce log messages verbosity
joaoopereira Jul 11, 2023
58b9fb8
chore(refactor): improve RelatedPackages logic
joaoopereira Jul 11, 2023
b5a2212
chore: bump to 4.0.0-10
m-s- Jul 17, 2023
8668f8a
chore(new IoT): set RelatedPackages with RelativePath
joaoopereira Jul 24, 2023
edcdfab
test(new IoT): merged v9 and v10 tests
joaoopereira Jul 25, 2023
400118d
chore: release v4.0.0
m-s- Jul 25, 2023
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
Prev Previous commit
Next Next commit
chore(new html): build app and define config settings after new
  • Loading branch information
joaoopereira committed Jun 13, 2023
commit 70a5d3e6ca4bb72bb53a2ff06b302cdd916ee8fa
8 changes: 5 additions & 3 deletions cmf-cli/Builders/NgBuildFileTokenReplacerCommand.cs
Original file line number Diff line number Diff line change
@@ -34,10 +34,12 @@ public bool Test
}
public Task Exec()
{
var workingDir = cmfPackage.GetFileInfo().Directory;

foreach (var app in apps)
{
// place tokens in assets/config.json
var configJsonPath = this.fileSystem.FileInfo.New($"dist/{app}/assets/config.json");
var configJsonPath = this.fileSystem.FileInfo.New($"{workingDir}/dist/{app}/assets/config.json");
if (configJsonPath.Exists)
{
Log.Debug($"Placing tokens in config.json at {configJsonPath.FullName}");
@@ -64,7 +66,7 @@ public Task Exec()
// place app name in index.html
// TODO get app name from cmfapp.json
var appName = ExecutionContext.Instance.ProjectConfig.ProjectName;
var indexPath = this.fileSystem.FileInfo.New($"dist/{app}/index.html");
var indexPath = this.fileSystem.FileInfo.New($"{workingDir}/dist/{app}/index.html");
if (indexPath.Exists)
{
Log.Debug($"Setting App Name '{appName}' as title in {indexPath.FullName}");
@@ -79,7 +81,7 @@ public Task Exec()
}

// fix trailing slash in ngsw.json
var ngswPath = this.fileSystem.FileInfo.New($"dist/{app}/ngsw.json");
var ngswPath = this.fileSystem.FileInfo.New($"{workingDir}/dist/{app}/ngsw.json");
if (ngswPath.Exists)
{
Log.Debug($"Placing tokens in ngsw.json at {ngswPath.FullName}");
49 changes: 47 additions & 2 deletions cmf-cli/Commands/new/HTMLCommand.cs
Original file line number Diff line number Diff line change
@@ -333,6 +333,7 @@ public void ExecuteV10(IDirectoryInfo workingDir, string version)
// this won't return null because it has to success on the base.Execute call
var ngCliVersion = "15"; // v15 for MES 10
var packageName = base.GeneratePackageName(workingDir)!.Value.Item1;
var packageDir = workingDir.GetDirectories(packageName).First();
var mesVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;

var schematicsVersion = ngxSchematicsVersion.ToString() ?? $"@release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}";
@@ -346,17 +347,61 @@ public void ExecuteV10(IDirectoryInfo workingDir, string version)
WorkingDirectory = workingDir,
ForceColorOutput = false
}.Exec();

Log.Debug($"Adding @criticalmanufacturing/ngx-schematics@{schematicsVersion} to the package, which can be used to scaffold new components and libraries");
// cd <packageName>
// ng add --skip-confirmation @criticalmanufacturing/ngx-schematics [--npmRegistry http://npm.example/] --lint --base-app <Core|MES>
new NPXCommand()
{
Command = $"@angular/cli@{ngCliVersion}",
Args = new []{ "add", "--registry", ExecutionContext.Instance.ProjectConfig.NPMRegistry.OriginalString, "--skip-confirmation", $"@criticalmanufacturing/ngx-schematics@{schematicsVersion}", "--lint", "--base-app", baseLayer.ToString(), "--version", $"release-{mesVersion.Major}{mesVersion.Minor}{mesVersion.Build}" },
WorkingDirectory = workingDir.GetDirectories(packageName).First(),
WorkingDirectory = packageDir,
ForceColorOutput = false
}.Exec();

// build
new BuildCommand(fileSystem).Execute(packageDir);

// config.json
var configJsonPath = this.fileSystem.Path.Join(packageDir.FullName, "src",
this.fileSystem.Path.Join("assets", "config.json"));
var configJsonStr = fileSystem.File.ReadAllText(configJsonPath);
if (!configJsonStr.Contains("$("))
{
// config.json has no tokens and can be malformed. We need to make sure it parses, so we inject some dummy values that will be thrown away later
Log.Debug("Generated config.json does not contain tokens and is possibly malformed. Setting some dummy values so we can deserialize it.");
configJsonStr = configJsonStr
.Replace("\"port\": ", "\"port\": 0")
.Replace("\"enableSsl\": ,", "\"enableSsl\": false,");

configJsonStr = Regex.Replace(configJsonStr, "\"isLoadBalancerEnabled\": (false)?\r?\n",
"\"isLoadBalancerEnabled\": false\n");
}
configJsonStr = Regex.Replace(configJsonStr, @"\$\([^\)]+\)", "0", RegexOptions.Multiline);
dynamic configJsonJson = null;
try
{
configJsonJson = JsonConvert.DeserializeObject(configJsonStr);
}
catch (Exception e)
{
throw new CliException("Could not load webapp config.json", e);
}
if (configJsonJson == null)
{
throw new CliException("Could not load webapp config.json");
}
var restPort = ExecutionContext.Instance.ProjectConfig.RESTPort;
configJsonJson.host.rest.enableSsl = false;
configJsonJson.host.rest.address = "localhost";
configJsonJson.host.rest.port = restPort;
configJsonJson.host.isLoadBalancerEnabled = false;
configJsonJson.host.tenant.name = ExecutionContext.Instance.ProjectConfig.Tenant;
configJsonJson.general.defaultDomain = ExecutionContext.Instance.ProjectConfig.DefaultDomain;
configJsonJson.general.environmentName = ExecutionContext.Instance.ProjectConfig.EnvironmentName;
configJsonJson.version = $"{ExecutionContext.Instance.ProjectConfig.ProjectName} $(Build.BuildNumber) - {mesVersion}";
configJsonStr = JsonConvert.SerializeObject(configJsonJson, Formatting.Indented);
this.fileSystem.File.WriteAllText(configJsonPath, configJsonStr);
Log.Verbose("Updated config.json");
}
}
}
2 changes: 1 addition & 1 deletion tests/Fixtures/init/infrastructure.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ISOLocation": "\\\\share\\iso_location",
"NPMRegistry": "http://npm_registry",
"NuGetRegistry": "htt://nuget_registry"
"NuGetRegistry": "http://nuget_registry"
}
40 changes: 34 additions & 6 deletions tests/Specs/New.cs
Original file line number Diff line number Diff line change
@@ -689,15 +689,39 @@ public void SecurityPortal()
Assert.True(File.Exists($"{dir}/Cmf.Custom.SecurityPortal/config.json"), "Package config.json is missing");
}

[Fact(Skip = "awaiting for NGXSchematics public release"), Trait("TestCategory", "LongRunning")]
public void UI_v10()
{
UI_internal_v10();
}

private void UI_internal_v10()
{
RunNew(new HTMLCommand(), "Cmf.Custom.HTML", mesVersion: "10.0.2", extraAsserts: args =>
{
var configJson = File.ReadAllText("Cmf.Custom.HTML/src/assets/config.json");
try
{
JsonConvert.DeserializeObject(configJson);
}
catch (Exception e)
{
Assert.Fail($"config.json is malformed: {e.Message}");
}
});
}

private TestConsole RunNew<T>(T newCommand, string packageId, string scaffoldingDir = null,
string[] extraArguments = null, bool defaultAsserts = true, Action<(string, string)> extraAsserts = null,
string mesVersion = "8.2.0",
string ngxSchematicsVersion = "1.1.0",
BaseLayer baseLayer = BaseLayer.MES,
RepositoryType repositoryType = RepositoryType.Customization) where T : TemplateCommand
{
var dir = scaffoldingDir ?? TestUtilities.GetTmpDirectory();

var rnd = new Random();

var rnd = new Random();
var pkgVersion = $"{rnd.Next(10)}.{rnd.Next(10)}.{rnd.Next(10)}";

var cur = Directory.GetCurrentDirectory();
@@ -717,6 +741,8 @@ private TestConsole RunNew<T>(T newCommand, string packageId, string scaffolding
.Replace(@"""MESVersion"": ""8.2.0""", $@"""MESVersion"": ""{mesVersion}""")
.Replace(@"""BaseLayer"": ""MES""", $@"""BaseLayer"": ""{baseLayer}""")
.Replace(@"""RepositoryType"": ""Customization""", $@"""RepositoryType"": ""{repositoryType}""")
.Replace(@"""NGXSchematicsVersion"": ""10.0.0""", $@"""NGXSchematicsVersion"": ""{ngxSchematicsVersion}""")
.Replace(@"""NPMRegistry"": ""http://npm_registry/""", $@"""NPMRegistry"": ""http://cmf-nuget:4873/""")
.Replace("install_path", MockUnixSupport.Path(@"x:\install_path").Replace(@"\", @"\\"))
.Replace("backup_share", MockUnixSupport.Path(@"y:\backup_share").Replace(@"\", @"\\"))
.Replace("temp_folder", MockUnixSupport.Path(@"z:\temp_folder").Replace(@"\", @"\\"))
@@ -742,13 +768,15 @@ private TestConsole RunNew<T>(T newCommand, string packageId, string scaffolding
if (defaultAsserts)
{
string errors = console.Error.ToString().Trim();
Assert.True(errors.Length == 0, $"Errors found in console: {errors}");
Assert.True(Directory.Exists(packageId), "Package folder is missing");
Assert.True(File.Exists($"{packageId}/cmfpackage.json"), "Package cmfpackage.json is missing");
Assert.Equal(packageId, TestUtilities.GetPackageProperty("packageId", $"{packageId}/cmfpackage.json"), "Package Id does not match expected");
Assert.Equal(pkgVersion, TestUtilities.GetPackageProperty("version", $"{packageId}/cmfpackage.json"), "Package version does not match expected");
errors.Length.Should().Be(0, $"Errors found in console: {errors}");
Directory.Exists(packageId).Should().BeTrue();
File.Exists($"{packageId}/cmfpackage.json").Should().BeTrue();
TestUtilities.GetPackageProperty("packageId", $"{packageId}/cmfpackage.json").Should().Be(packageId);
TestUtilities.GetPackageProperty("version", $"{packageId}/cmfpackage.json").Should().Be(pkgVersion);

var pkg = TestUtilities.GetPackage("cmfpackage.json");
pkg.GetProperty("dependencies").EnumerateArray().ToArray().FirstOrDefault(d => d.GetProperty("id").GetString() == packageId).Should().NotBeNull("Package not found in root package dependencies");

}

if (extraAsserts != null)