|
1 |
| -<Project Sdk="Microsoft.NET.Sdk"> |
| 1 | +<Project Sdk="Microsoft.NET.Sdk.Razor"> |
2 | 2 | <PropertyGroup>
|
3 | 3 | <AssemblyName>Our.Umbraco.UiExamples</AssemblyName>
|
4 | 4 | <TargetFramework>net9.0</TargetFramework>
|
5 | 5 | <ImplicitUsings>enable</ImplicitUsings>
|
6 | 6 | <Nullable>enable</Nullable>
|
| 7 | + <StaticWebAssetBasePath>/App_Plugins/Example.UI</StaticWebAssetBasePath> |
| 8 | + <NoWarn>$(NoWarn),NU1902</NoWarn> |
7 | 9 | </PropertyGroup>
|
| 10 | + |
| 11 | + <ItemGroup> |
| 12 | + <FrameworkReference Include="Microsoft.AspNetCore.App" /> |
| 13 | + <SupportedPlatform Include="browser" /> |
| 14 | + </ItemGroup> |
| 15 | + |
8 | 16 | <ItemGroup>
|
9 | 17 | <PackageReference Include="Umbraco.Cms.Web.Common" VersionOverride="[15.0.0, 16)" />
|
10 | 18 | </ItemGroup>
|
| 19 | + |
| 20 | + <!-- Client assets restore and build --> |
| 21 | + <ItemGroup> |
| 22 | + <ClientAssetsInputs Include="package.json;package-lock.json;tsconfig.json;vite.config.js;src\**;public\**" Exclude="$(DefaultItemExcludes)" /> |
| 23 | + <Content Update="$(ClientAssetsInputs)\**" Pack="false" /> |
| 24 | + </ItemGroup> |
| 25 | + |
| 26 | + <Target Name="ClientAssetsRestore" Inputs="package-lock.json" Outputs="node_modules\.package-lock.json"> |
| 27 | + <Message Importance="high" Text="Restoring NPM packages..." /> |
| 28 | + <Exec Command="npm ci --no-fund --no-audit --prefer-offline" /> |
| 29 | + </Target> |
| 30 | + |
| 31 | + <Target Name="ClientAssetsBuild" DependsOnTargets="ClientAssetsRestore" BeforeTargets="AssignTargetPaths" Inputs="@(ClientAssetsInputs)" Outputs="$(IntermediateOutputPath)clientassetsbuild.complete.txt"> |
| 32 | + <Message Importance="high" Text="Executing NPM build script..." /> |
| 33 | + <PropertyGroup> |
| 34 | + <_ClientAssetsOutputFullPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)clientassets'))/</_ClientAssetsOutputFullPath> |
| 35 | + </PropertyGroup> |
| 36 | + <MakeDir Directories="$(_ClientAssetsOutputFullPath)" /> |
| 37 | + <Exec Command="npm run build -- --outDir "$(_ClientAssetsOutputFullPath)"" /> |
| 38 | + <ItemGroup> |
| 39 | + <_ClientAssetsBuildOutput Include="$(IntermediateOutputPath)clientassets\**"></_ClientAssetsBuildOutput> |
| 40 | + </ItemGroup> |
| 41 | + <WriteLinesToFile File="$(IntermediateOutputPath)clientassetsbuild.complete.txt" Lines="@(_ClientAssetsBuildOutput)" Overwrite="true" /> |
| 42 | + </Target> |
| 43 | + |
| 44 | + <Target Name="DefineClientAssets" AfterTargets="ClientAssetsBuild" DependsOnTargets="ResolveStaticWebAssetsConfiguration"> |
| 45 | + <ItemGroup> |
| 46 | + <FileWrites Include="@(_ClientAssetsBuildOutput)" /> |
| 47 | + <FileWrites Include="$(IntermediateOutputPath)clientassetsbuild.complete.txt" /> |
| 48 | + </ItemGroup> |
| 49 | + <DefineStaticWebAssets CandidateAssets="@(_ClientAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(_ClientAssetsOutputFullPath)" BasePath="$(StaticWebAssetBasePath)"> |
| 50 | + <Output TaskParameter="Assets" ItemName="StaticWebAsset" /> |
| 51 | + </DefineStaticWebAssets> |
| 52 | + </Target> |
11 | 53 | </Project>
|
0 commit comments