-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDoStuffPackageManifestReader.cs
More file actions
51 lines (46 loc) · 1.71 KB
/
Copy pathDoStuffPackageManifestReader.cs
File metadata and controls
51 lines (46 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Umbraco.Cms.Core.Manifest;
using Umbraco.Cms.Infrastructure.Manifest;
namespace DoStuff.Client.Composers;
/// <summary>
/// Package Manifest reader is a way of adding the package via backend code.
/// </summary>
/// <remarks>
/// a package manifest reader is registerd in the composer, add adds
/// the package details via the backend c# code.
///
/// Adding the package this way means we can set the version of the package
/// to match the version in the assembly. so when we release a new version
/// the package version is automatically updated.
///
/// we can also add this to the URL of the script file, so we bust the
/// cache for any new version of the package.
/// </remarks>
internal class DoStuffPackageManifestReader : IPackageManifestReader
{
public Task<IEnumerable<PackageManifest>> ReadPackageManifestsAsync()
{
var version = Assembly.GetAssembly(typeof(DoStuffPackageManifestReader))?.GetName().Version?.ToString() ?? "1.0.0";
return Task.FromResult<IEnumerable<PackageManifest>>(new[]
{
new PackageManifest
{
Id = "DoStuff.Client",
Name = "DoStuff with Umbraco client",
AllowTelemetry = true,
Version = version,
Extensions = [
new {
name = "DoStuff Client Bundle",
alias = "DoStuff.Client.Bundle",
type = "bundle",
js = "/App_Plugins/DoStuffClient/do-stuff-client.js?v=" + version
}
]
}
});
}
}