In v13, the StaticAssets build was only triggered based on the existence of either the output folder or a preserve.* marker file. Here, we also additionally check for the node_modules/.package-lock.json file before reinstalling npm dependencies. We also now only run `npm install` rather than `npm ci` to optimise the build.
150 lines
8.3 KiB
XML
150 lines
8.3 KiB
XML
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
|
<PropertyGroup>
|
|
<Title>Umbraco CMS - Static assets</Title>
|
|
<Description>Contains the static assets needed to run Umbraco CMS.</Description>
|
|
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
|
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
|
|
<!-- Disable compression for static files, because MapStaticAssets() is not used anyway (yet) -->
|
|
<CompressionEnabled>false</CompressionEnabled>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<!--
|
|
TODO: Fix and remove overrides:
|
|
[NU5123] Rename files so path is shorter
|
|
-->
|
|
<WarningsNotAsErrors>$(WarningsNotAsErrors),NU5123</WarningsNotAsErrors>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
|
<SupportedPlatform Include="browser" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<ProjectReference Include="..\Umbraco.Cms.Api.Management\Umbraco.Cms.Api.Management.csproj" />
|
|
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
|
|
</ItemGroup>
|
|
|
|
<!-- General ignored files -->
|
|
<ItemGroup>
|
|
<Content Remove="wwwroot\umbraco\assets\README.md" />
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
<!-- BEGIN: Restore and build backoffice project -->
|
|
<PropertyGroup>
|
|
<BackofficeProjectDirectory Condition="'$(BackofficeProjectDirectory)' == ''">..\Umbraco.Web.UI.Client\</BackofficeProjectDirectory>
|
|
<BackofficeAssetsPath>$(ProjectDir)wwwroot\umbraco\backoffice</BackofficeAssetsPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<Content Remove="$(BackofficeAssetsPath)\**" />
|
|
</ItemGroup>
|
|
|
|
<Target Name="BuildStaticAssetsPreconditions" BeforeTargets="AssignTargetPaths">
|
|
<Message Text="Skip BuildBackoffice target because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)" Importance="high" Condition="'$(UmbracoBuild)' != ''" />
|
|
<Message Text="Skip BuildBackoffice target because '$(BackofficeAssetsPath)' already exists" Importance="high" Condition="Exists('$(BackofficeAssetsPath)')" />
|
|
<Message Text="Call BuildBackoffice target because UmbracoBuild is empty (this is Visual Studio) and '$(BackofficeAssetsPath)' doesn't exist" Importance="high" Condition="'$(UmbracoBuild)' == '' and !Exists('$(BackofficeAssetsPath)')" />
|
|
<CallTarget Targets="BuildBackoffice" Condition="'$(UmbracoBuild)' == '' and !Exists('$(BackofficeAssetsPath)')" />
|
|
</Target>
|
|
|
|
<Target Name="RestoreBackoffice" Inputs="$(BackofficeProjectDirectory)package-lock.json" Outputs="$(BackofficeProjectDirectory)node_modules\.package-lock.json">
|
|
<Message Importance="high" Text="Restoring Backoffice NPM packages..." />
|
|
<Exec Command="npm i --no-fund --no-audit" WorkingDirectory="$(BackofficeProjectDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="BuildBackoffice" DependsOnTargets="RestoreBackoffice">
|
|
<Message Importance="high" Text="Executing Backoffice NPM build script..." />
|
|
<Exec Command="npm run build:for:cms" WorkingDirectory="$(BackofficeProjectDirectory)" />
|
|
<ItemGroup>
|
|
<_BackofficeAssetsBuildOutput Include="$(BackofficeAssetsPath)\**" />
|
|
</ItemGroup>
|
|
<WriteLinesToFile File="$(IntermediateOutputPath)backoffice.complete.txt" Lines="@(_BackofficeAssetsBuildOutput)" Overwrite="true" />
|
|
</Target>
|
|
|
|
<Target Name="DefineBackofficeAssets" AfterTargets="BuildBackoffice" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
|
|
<ItemGroup>
|
|
<FileWrites Include="@(_BackofficeAssetsBuildOutput)" />
|
|
<FileWrites Include="$(IntermediateOutputPath)backoffice.complete.txt" />
|
|
</ItemGroup>
|
|
<DefineStaticWebAssets CandidateAssets="@(_BackofficeAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(ProjectDir)wwwroot" BasePath="$(StaticWebAssetBasePath)">
|
|
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
|
|
</DefineStaticWebAssets>
|
|
</Target>
|
|
|
|
<Target Name="CleanStaticAssetsPreconditions" AfterTargets="Clean" Condition="'$(UmbracoBuild)' == ''">
|
|
<Message Text="Skip CleanBackoffice target because '$(BackofficeAssetsPath)' doesn't exist" Importance="high" Condition="!Exists('$(BackofficeAssetsPath)')" />
|
|
<Message Text="Skip CleanBackoffice target because preserve.backoffice marker file exists" Importance="high" Condition="Exists('$(BackofficeAssetsPath)') and Exists('$(SolutionDir)preserve.backoffice')" />
|
|
<Message Text="Call CleanBackoffice target because '$(BackofficeAssetsPath)' exists and preserve.backoffice marker file doesn't exist" Importance="high" Condition="Exists('$(BackofficeAssetsPath)') and !Exists('$(SolutionDir)preserve.backoffice')" />
|
|
<CallTarget Targets="CleanBackoffice" Condition="Exists('$(BackofficeAssetsPath)') and !Exists('$(SolutionDir)preserve.backoffice')" />
|
|
</Target>
|
|
|
|
<Target Name="CleanBackoffice">
|
|
<ItemGroup>
|
|
<BackofficeDirectories Include="$(BackofficeAssetsPath)" />
|
|
</ItemGroup>
|
|
<RemoveDir Directories="@(BackofficeDirectories)" />
|
|
</Target>
|
|
<!-- END: Restore and build backoffice project -->
|
|
|
|
|
|
|
|
<!-- BEGIN: Restore and build login project -->
|
|
<PropertyGroup>
|
|
<LoginProjectDirectory Condition="'$(LoginProjectDirectory)' == ''">..\Umbraco.Web.UI.Login\</LoginProjectDirectory>
|
|
<LoginAssetsPath>$(ProjectDir)wwwroot\umbraco\login</LoginAssetsPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<Content Remove="$(LoginAssetsPath)\**" />
|
|
</ItemGroup>
|
|
|
|
<Target Name="BuildLoginStaticAssetsPreconditions" BeforeTargets="AssignTargetPaths">
|
|
<Message Text="Skip BuildLogin target because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)" Importance="high" Condition="'$(UmbracoBuild)' != ''" />
|
|
<Message Text="Skip BuildLogin target because '$(LoginAssetsPath)' already exists" Importance="high" Condition="Exists('$(LoginAssetsPath)')" />
|
|
<Message Text="Call BuildLogin target because UmbracoBuild is empty (this is Visual Studio) and '$(LoginAssetsPath)' doesn't exist" Importance="high" Condition="'$(UmbracoBuild)' == '' and !Exists('$(LoginAssetsPath)')" />
|
|
<CallTarget Targets="BuildLogin" Condition="'$(UmbracoBuild)' == '' and !Exists('$(LoginAssetsPath)')" />
|
|
</Target>
|
|
|
|
<Target Name="RestoreLogin" Inputs="$(LoginProjectDirectory)package-lock.json" Outputs="$(LoginProjectDirectory)node_modules/.package-lock.json">
|
|
<Message Importance="high" Text="Restoring Login NPM packages..." />
|
|
<Exec Command="npm i --no-fund --no-audit" WorkingDirectory="$(LoginProjectDirectory)" />
|
|
</Target>
|
|
|
|
<Target Name="BuildLogin" DependsOnTargets="RestoreLogin">
|
|
<Message Importance="high" Text="Executing Login NPM build script..." />
|
|
<Exec Command="npm run build" WorkingDirectory="$(LoginProjectDirectory)" />
|
|
<ItemGroup>
|
|
<_LoginAssetsBuildOutput Include="$(LoginAssetsPath)\**" />
|
|
</ItemGroup>
|
|
<WriteLinesToFile File="$(IntermediateOutputPath)login.complete.txt" Lines="@(_LoginAssetsBuildOutput)" Overwrite="true" />
|
|
</Target>
|
|
|
|
<Target Name="DefineLoginAssets" AfterTargets="BuildLogin" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
|
|
<ItemGroup>
|
|
<FileWrites Include="@(_LoginAssetsBuildOutput)" />
|
|
<FileWrites Include="$(IntermediateOutputPath)login.complete.txt" />
|
|
</ItemGroup>
|
|
<DefineStaticWebAssets CandidateAssets="@(_LoginAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(ProjectDir)wwwroot" BasePath="$(StaticWebAssetBasePath)">
|
|
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
|
|
</DefineStaticWebAssets>
|
|
</Target>
|
|
|
|
<Target Name="CleanLoginStaticAssetsPreconditions" AfterTargets="Clean" Condition="'$(UmbracoBuild)' == ''">
|
|
<Message Text="Skip CleanLogin target because '$(LoginAssetsPath)' doesn't exist" Importance="high" Condition="!Exists('$(LoginAssetsPath)')" />
|
|
<Message Text="Skip CleanLogin target because preserve.login marker file exists" Importance="high" Condition="Exists('$(LoginAssetsPath)') and Exists('$(SolutionDir)preserve.login')" />
|
|
<Message Text="Call CleanLogin target because '$(LoginAssetsPath)' exists and preserve.login marker file doesn't exist" Importance="high" Condition="Exists('$(LoginAssetsPath)') and !Exists('$(SolutionDir)preserve.login')" />
|
|
<CallTarget Targets="CleanLogin" Condition="Exists('$(LoginAssetsPath)') and !Exists('$(SolutionDir)preserve.login')" />
|
|
</Target>
|
|
|
|
<Target Name="CleanLogin">
|
|
<ItemGroup>
|
|
<LoginDirectories Include="$(LoginAssetsPath)" />
|
|
</ItemGroup>
|
|
<RemoveDir Directories="@(LoginDirectories)" />
|
|
</Target>
|
|
<!-- END: Restore and build login project -->
|
|
</Project>
|