Skip to content

Commit

Permalink
Merge pull request #128 from Lombiq/issue/OSOE-819
Browse files Browse the repository at this point in the history
OSOE-819: Use Source Generator to get version from package.json
  • Loading branch information
sarahelsaig authored Mar 15, 2024
2 parents 3383d8a + 25a6573 commit ebe087c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Lombiq.VueJs/Lombiq.VueJs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,19 @@
<PackageReference Include="Lombiq.NodeJs.Extensions" Version="2.1.0" />
</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" />

<!-- Execute Lombiq.NodeJs separately, to avoid inheriting these instructions in projects that consume Lombiq.VueJs. -->
<Target Name="BuildLocalScripts" AfterTargets="NpmInstall">
<Exec Command="npm explore nodejs-extensions -- pnpm build" />
</Target>

<ItemGroup>
<AdditionalFiles Include="package.json"/>
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions Lombiq.VueJs/ResourceManagementOptionsConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using Microsoft.Extensions.Options;
using Lombiq.HelpfulLibraries.SourceGenerators;
using Microsoft.Extensions.Options;
using OrchardCore.ResourceManagement;
using static Lombiq.VueJs.Constants.FeatureIds;
using static Lombiq.VueJs.Constants.ResourceNames;

namespace Lombiq.VueJs;

public class ResourceManagementOptionsConfiguration : IConfigureOptions<ResourceManagementOptions>
[ConstantFromJson("VueVersion", "package.json", "vue")]
public partial class ResourceManagementOptionsConfiguration : IConfigureOptions<ResourceManagementOptions>
{
private const string Root = $"~/{Area}/";
private const string Js = Root + "js/";
private const string Vendors = Root + "vendors/";

// Always keep the version in sync with the value in package.json.
private const string VueVersion = "3.4.21";
private const string VueCdnRoot = $"https://unpkg.com/vue@{VueVersion}/dist/";

private static readonly ResourceManifest _manifest = new();
Expand Down

0 comments on commit ebe087c

Please sign in to comment.