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

OSOE-819: Get bootstrap version from source generator #105

Merged
merged 1 commit into from
Mar 15, 2024
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
7 changes: 7 additions & 0 deletions Lombiq.BaseTheme/Lombiq.BaseTheme.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.SourceGenerators\Lombiq.HelpfulLibraries.SourceGenerators\Lombiq.HelpfulLibraries.SourceGenerators.csproj" OutputItemType="Analyzer" />
</ItemGroup>

<Import Condition="'$(NuGetBuild)' != 'true'" Project="..\..\..\Utilities\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions.targets" />

<ItemGroup>
<AdditionalFiles Include="package.json"/>
</ItemGroup>
</Project>
10 changes: 4 additions & 6 deletions Lombiq.BaseTheme/ResourceManagementOptionsConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
using Lombiq.BaseTheme.Constants;
using Lombiq.HelpfulLibraries.SourceGenerators;
using Microsoft.Extensions.Options;
using OrchardCore.ResourceManagement;
using System;

namespace Lombiq.BaseTheme;

public class ResourceManagementOptionsConfiguration : IConfigureOptions<ResourceManagementOptions>
[ConstantFromJson("NpmBootstrapVersion", "package.json", "bootstrap")]
public partial class ResourceManagementOptionsConfiguration : IConfigureOptions<ResourceManagementOptions>
{
private const string WwwRoot = "~/" + FeatureIds.Area + "/";
private const string Css = WwwRoot + "css/";
private const string Js = WwwRoot + "js/";
private const string Vendors = WwwRoot + "vendors/";

// Make sure to keep this exactly the same version as the "bootstrap" dependency in the package.json file.
public static readonly Version NpmBootstrapVersion = new(5, 3, 2);

private static readonly ResourceManifest _manifest = new();

static ResourceManagementOptionsConfiguration()
Expand All @@ -32,7 +30,7 @@ static ResourceManagementOptionsConfiguration()
_manifest
.DefineScript("bootstrap")
.SetUrl(Vendors + "bootstrap/js/bootstrap.bundle.min.js", Vendors + "bootstrap/js/bootstrap.bundle.js")
.SetVersion(NpmBootstrapVersion.ToString());
.SetVersion(NpmBootstrapVersion);
}

public void Configure(ResourceManagementOptions options) => options.ResourceManifests.Add(_manifest);
Expand Down