Skip to content

Commit d8b0e6d

Browse files
Add conditional package references for .NET targets
1 parent 5f28b1d commit d8b0e6d

File tree

10 files changed

+177
-210
lines changed

10 files changed

+177
-210
lines changed

.github/workflows/dotnet-package.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ jobs:
2626
with:
2727
node-version: 18
2828

29-
- name: Install Node.js dependencies
30-
run: npm install
31-
working-directory: XtermBlazor/src
32-
33-
- name: Build Node.js project
34-
run: npm run build
35-
working-directory: XtermBlazor/src
36-
3729
- name: Restore .NET dependencies
3830
run: dotnet restore XtermBlazor
3931

.github/workflows/dotnet-publish-gpr.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ jobs:
2424
with:
2525
node-version: 18
2626

27-
- name: Install Node.js dependencies
28-
run: npm install
29-
working-directory: XtermBlazor/src
30-
31-
- name: Build Node.js project
32-
run: npm run build
33-
working-directory: XtermBlazor/src
34-
3527
- name: Build .NET project
3628
run: dotnet build XtermBlazor -c Release
3729

.github/workflows/dotnet-publish-nuget.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ jobs:
2121
with:
2222
node-version: 18
2323

24-
- name: Install Node.js dependencies
25-
run: npm install
26-
working-directory: XtermBlazor/src
27-
28-
- name: Build Node.js project
29-
run: npm run build
30-
working-directory: XtermBlazor/src
31-
3224
- name: Build .NET project
3325
run: dotnet build XtermBlazor -c Release
3426

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,4 @@ $RECYCLE.BIN/
454454
!.vscode/extensions.json
455455

456456
# XtermBlazor
457-
XtermBlazor/wwwroot/*
458-
!XtermBlazor/wwwroot/*.min.css
459-
!XtermBlazor/wwwroot/*.min.js
457+
XtermBlazor/wwwroot

XtermBlazor/XtermBlazor.csproj

Lines changed: 87 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,101 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

3-
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
5-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
5+
</PropertyGroup>
66

7-
<ItemGroup>
8-
<SupportedPlatform Include="browser" />
9-
</ItemGroup>
7+
<ItemGroup>
8+
<SupportedPlatform Include="browser" />
9+
</ItemGroup>
1010

11-
<PropertyGroup>
12-
<!-- VS's FastUpToDateCheck doesn't consider .ts file changes, so it's necessary to disable it
13-
to get incremental builds to work correctly (albeit not as fast as if FastUpToDateCheck did work
14-
for them) -->
15-
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
16-
<Authors>BattlefieldDuck</Authors>
17-
<RepositoryUrl>https://github.com/BattlefieldDuck/XtermBlazor</RepositoryUrl>
18-
<PackageProjectUrl>https://github.com/BattlefieldDuck/XtermBlazor</PackageProjectUrl>
19-
<PackageLicenseFile>LICENSE</PackageLicenseFile>
20-
<Description>Brings xterm.js to Blazor</Description>
21-
<PackageIcon>icon.png</PackageIcon>
22-
<Version>2.1.1</Version>
23-
<PackageTags>xterm, xterm-js, blazor, blazor-server, blazor-webassembly, blazor-wasm,
24-
xtermblazor</PackageTags>
25-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
26-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
27-
<Nullable>enable</Nullable>
28-
<PackageReadmeFile>README.md</PackageReadmeFile>
29-
<LangVersion>12.0</LangVersion>
30-
</PropertyGroup>
11+
<PropertyGroup>
12+
<!-- VS's FastUpToDateCheck doesn't consider .ts file changes, so it's necessary to disable it
13+
to get incremental builds to work correctly (albeit not as fast as if FastUpToDateCheck did work
14+
for them) -->
15+
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
16+
<Authors>BattlefieldDuck</Authors>
17+
<RepositoryUrl>https://github.com/BattlefieldDuck/XtermBlazor</RepositoryUrl>
18+
<PackageProjectUrl>https://github.com/BattlefieldDuck/XtermBlazor</PackageProjectUrl>
19+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
20+
<Description>Brings xterm.js to Blazor</Description>
21+
<PackageIcon>icon.png</PackageIcon>
22+
<Version>2.1.1</Version>
23+
<PackageTags>
24+
xterm, xterm-js, blazor, blazor-server, blazor-webassembly, blazor-wasm,
25+
xtermblazor
26+
</PackageTags>
27+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
28+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
29+
<Nullable>enable</Nullable>
30+
<PackageReadmeFile>README.md</PackageReadmeFile>
31+
<LangVersion>12.0</LangVersion>
32+
</PropertyGroup>
3133

32-
<PropertyGroup Label="SourceLink">
33-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
34-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
35-
<IncludeSymbols>true</IncludeSymbols>
36-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
37-
</PropertyGroup>
34+
<PropertyGroup Label="SourceLink">
35+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
36+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
37+
<IncludeSymbols>true</IncludeSymbols>
38+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
39+
</PropertyGroup>
3840

39-
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
40-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
41-
</PropertyGroup>
41+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
42+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
43+
</PropertyGroup>
4244

43-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
44-
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
45-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.26" />
46-
</ItemGroup>
45+
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
46+
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
47+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.26" />
48+
</ItemGroup>
4749

48-
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
49-
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
50-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.15" />
51-
</ItemGroup>
50+
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
51+
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
52+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.15" />
53+
</ItemGroup>
5254

53-
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
54-
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
55-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.1" />
56-
</ItemGroup>
55+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
56+
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
57+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.1" />
58+
</ItemGroup>
5759

58-
<ItemGroup>
59-
<Folder Include="wwwroot\" />
60-
</ItemGroup>
60+
<ItemGroup>
61+
<WebpackFiles Include="$(ProjectDir)src\**.*;" />
62+
<CompiledWebpackFiles Include="$(OutDir)wwwroot\XtermBlazor.min.js;$(OutDir)wwwroot\XtermBlazor.min.css" />
63+
<NodePackageSource Include="$(ProjectDir)src\package.json;$(ProjectDir)package-lock.json" />
64+
</ItemGroup>
6165

62-
<ItemGroup>
63-
<Content Update="src\**">
64-
<Pack>False</Pack>
65-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
66-
</Content>
67-
</ItemGroup>
66+
<Target Name="NpmInstall" BeforeTargets="NpmBuild" Inputs="@(NodePackageSource)" Outputs="$(ProjectDir)src\node_modules\.source">
67+
<Message Text="Installing Node Dependencies (NpmInstall) $(OutDir)" Importance="high" />
68+
<Exec Command="npm ci -q" WorkingDirectory="src" Condition="$(Configuration) == 'Release'" />
69+
<Exec Command="npm install -q" WorkingDirectory="src" Condition="$(Configuration) == 'Debug'" />
70+
<Touch Files="$(ProjectDir)src\node_modules\.source" AlwaysCreate="true" />
71+
</Target>
6872

69-
<ItemGroup>
70-
<None Include="..\LICENSE">
71-
<Pack>True</Pack>
72-
<PackagePath>\</PackagePath>
73-
</None>
74-
<None Include="..\README.md">
75-
<Pack>True</Pack>
76-
<PackagePath>\</PackagePath>
77-
</None>
78-
<None Include="icon.png">
79-
<Pack>True</Pack>
80-
<PackagePath>\</PackagePath>
81-
</None>
82-
</ItemGroup>
73+
<Target Name="NpmBuild" BeforeTargets="DispatchToInnerBuilds" Inputs="@(WebpackFiles)" Outputs="@(CompiledWebpackFiles)">
74+
<Message Text="Create `wwwroot/XtermBlazor.min.js` and `wwwroot/XtermBlazor.min.css`" Importance="high" />
75+
<Exec Command="npm run build:production" WorkingDirectory="src" Condition="$(Configuration) == 'Release'" />
76+
<Exec Command="npm run build" WorkingDirectory="src" Condition="$(Configuration) == 'Debug'" />
77+
</Target>
78+
79+
<ItemGroup>
80+
<Content Update="src\**">
81+
<Pack>False</Pack>
82+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
83+
</Content>
84+
</ItemGroup>
85+
86+
<ItemGroup>
87+
<None Include="..\LICENSE">
88+
<Pack>True</Pack>
89+
<PackagePath>\</PackagePath>
90+
</None>
91+
<None Include="..\README.md">
92+
<Pack>True</Pack>
93+
<PackagePath>\</PackagePath>
94+
</None>
95+
<None Include="icon.png">
96+
<Pack>True</Pack>
97+
<PackagePath>\</PackagePath>
98+
</None>
99+
</ItemGroup>
83100

84101
</Project>

0 commit comments

Comments
 (0)