Skip to content

Commit

Permalink
Added manifest filter to indicate package version and allow package t…
Browse files Browse the repository at this point in the history
…elemetry
  • Loading branch information
abjerner committed Mar 11, 2023
1 parent 4c59665 commit f925c14
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Skybrud.Umbraco.GridData/Composers/GridComposer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Skybrud.Umbraco.GridData.Converters.Umbraco;
using Skybrud.Umbraco.GridData.Factories;
using Skybrud.Umbraco.GridData.Manifests;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Extensions;
Expand All @@ -16,6 +17,8 @@ public void Compose(IUmbracoBuilder builder) {

builder.GridConverters().Append<UmbracoGridConverter>();

builder.ManifestFilters().Append<GridManifestFilter>();

}

}
Expand Down
59 changes: 59 additions & 0 deletions src/Skybrud.Umbraco.GridData/GridPackage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Diagnostics;
using Umbraco.Cms.Core.Semver;

namespace Skybrud.Umbraco.GridData {

/// <summary>
/// Static class with various information and constants about the package.
/// </summary>
public class GridPackage {

/// <summary>
/// Gets the alias of the package.
/// </summary>
public const string Alias = "Skybrud.Umbraco.GridData";

/// <summary>
/// Gets the friendly name of the package.
/// </summary>
public const string Name = "Limbo Grid Data";

/// <summary>
/// Gets the version of the package.
/// </summary>
public static readonly Version Version = typeof(GridPackage).Assembly.GetName().Version!;

/// <summary>
/// Gets the informational version of the package.
/// </summary>
public static readonly string InformationalVersion = FileVersionInfo.GetVersionInfo(typeof(GridPackage).Assembly.Location).ProductVersion!;

/// <summary>
/// Gets the semantic version of the package.
/// </summary>
public static readonly SemVersion SemVersion = InformationalVersion;

/// <summary>
/// Gets the URL of the GitHub repository for this package.
/// </summary>
public const string GitHubUrl = "https://github.com/skybrud/Skybrud.Umbraco.GridData/";

/// <summary>
/// Gets the URL of the issue tracker for this package.
/// </summary>
public const string IssuesUrl = "https://github.com/skybrud/Skybrud.Umbraco.GridData/issues";

/// <summary>
/// Gets the website URL of the package.
/// </summary>
public const string WebsiteUrl = "https://packages.skybrud.dk/skybrud.umbraco.griddata/v5/";

/// <summary>
/// Gets the URL of the documentation for this package.
/// </summary>
public const string DocumentationUrl = "https://packages.skybrud.dk/skybrud.umbraco.griddata/v5/docs/";

}

}
20 changes: 20 additions & 0 deletions src/Skybrud.Umbraco.GridData/Manifests/GridManifestFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using Umbraco.Cms.Core.Manifest;

namespace Skybrud.Umbraco.GridData.Manifests {

/// <inheritdoc />
public class GridManifestFilter : IManifestFilter {

/// <inheritdoc />
public void Filter(List<PackageManifest> manifests) {
manifests.Add(new PackageManifest {
AllowPackageTelemetry = true,
PackageName = GridPackage.Name,
Version = GridPackage.InformationalVersion
});
}

}

}

0 comments on commit f925c14

Please sign in to comment.