|
1 | 1 | <Project>
|
2 | 2 | <!--
|
3 | 3 | Copied from: https://github.com/aspnet/AspLabs/blob/main/src/ClientAssets/Microsoft.AspNetCore.ClientAssets/build/netstandard2.0/Microsoft.AspNetCore.ClientAssets.targets
|
4 |
| -
|
5 | 4 | More information:
|
6 | 5 | - https://devblogs.microsoft.com/dotnet/build-client-web-assets-for-your-razor-class-library/
|
7 | 6 | - https://github.com/dotnet/aspnetcore/issues/38445
|
8 | 7 | -->
|
9 | 8 | <PropertyGroup>
|
10 |
| - <ClientAssetsDirectory Condition="'$(ClientAssetsDirectory)' == ''">src\</ClientAssetsDirectory> |
11 |
| - <ClientAssetsRestoreInputs Condition="'$(ClientAssetsRestoreInputs)' == ''">package-lock.json;package.json</ClientAssetsRestoreInputs> |
12 |
| - <ClientAssetsRestoreOutputs Condition="'$(ClientAssetsRestoreOutputs)' == ''">node_modules\.package-lock.json</ClientAssetsRestoreOutputs> |
| 9 | + <ClientAssetsDirectory Condition="'$(ClientAssetsDirectory)' == ''">Client\</ClientAssetsDirectory> |
| 10 | + <ClientAssetsRestoreInputs Condition="'$(ClientAssetsRestoreInputs)' == ''">$(ClientAssetsDirectory)\package-lock.json;$(ClientAssetsDirectory)\package.json</ClientAssetsRestoreInputs> |
| 11 | + <ClientAssetsRestoreOutputs Condition="'$(ClientAssetsRestoreOutputs)' == ''">$(ClientAssetsDirectory)node_modules\.package-lock.json</ClientAssetsRestoreOutputs> |
13 | 12 | <ClientAssetsRestoreCommand Condition="'$(ClientAssetsRestoreCommand)' == ''">npm ci --no-fund --no-audit --prefer-offline</ClientAssetsRestoreCommand>
|
14 | 13 | <ClientAssetsBuildCommand Condition="'$(ClientAssetsBuildCommand)' == ''">npm run build</ClientAssetsBuildCommand>
|
15 | 14 |
|
|
27 | 26 |
|
28 | 27 | <Target Name="ClientAssetsRestore" BeforeTargets="$(ClientAssetsRestoreBeforeTargets)" Inputs="$(ClientAssetsRestoreInputs)" Outputs="$(ClientAssetsRestoreOutputs)">
|
29 | 28 | <Message Text="Restoring NPM packages" Importance="high" />
|
30 |
| - |
31 |
| - </Target> |
| 29 | + <Exec Command="$(ClientAssetsRestoreCommand)" WorkingDirectory="$(ClientAssetsDirectory)"/> |
| 30 | + </Target> |
32 | 31 |
|
33 | 32 | <Target Name="ClientAssetsBuild" Condition="'$(ShouldRunClientAssetsBuild)' == 'true'" DependsOnTargets="ClientAssetsRestore" BeforeTargets="AssignTargetPaths" Inputs="@(ClientAssetsInputs)" Outputs="$(IntermediateOutputPath)clientassetsbuild.complete.txt">
|
34 | 33 | <PropertyGroup>
|
|
38 | 37 | <Message Text="Executing NPM build script" Importance="High" />
|
39 | 38 |
|
40 | 39 | <MakeDir Directories="$(_ClientAssetsOutputFullPath)" />
|
41 |
| - <Exec Command="$(ClientAssetsBuildCommand)" /> |
| 40 | + <Exec Command="$(ClientAssetsBuildCommand)" WorkingDirectory="$(ClientAssetsDirectory)" /> |
42 | 41 |
|
43 | 42 | <ItemGroup>
|
44 | 43 | <_ClientAssetsBuildOutput Include="$(IntermediateOutputPath)clientassets\**"></_ClientAssetsBuildOutput>
|
|
0 commit comments