chore: refactor the build process (#1729)

* refactor the build process

* add message
This commit is contained in:
James Yeung 2021-07-12 18:11:23 +08:00 committed by GitHub
parent 6aff9d370c
commit 74f1488a8a
5 changed files with 80 additions and 62 deletions

View File

@ -35,6 +35,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntDesign.Tests", "tests\An
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{DFD13180-D1BF-44DA-BEBE-4A54EFDEFFE2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntDesign.Docs.Build", "site\AntDesign.Docs.Build\AntDesign.Docs.Build.csproj", "{67E9D6C5-106F-412C-B43C-F096145FD8A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -73,6 +75,10 @@ Global
{51D7507D-48BA-43BB-8223-CE35A2D7D0D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51D7507D-48BA-43BB-8223-CE35A2D7D0D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51D7507D-48BA-43BB-8223-CE35A2D7D0D8}.Release|Any CPU.Build.0 = Release|Any CPU
{67E9D6C5-106F-412C-B43C-F096145FD8A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67E9D6C5-106F-412C-B43C-F096145FD8A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67E9D6C5-106F-412C-B43C-F096145FD8A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67E9D6C5-106F-412C-B43C-F096145FD8A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -86,6 +92,7 @@ Global
{5A765767-0766-433D-B78D-97D8F29CA6A6} = {D34F1DE5-ECF7-4CF0-8325-B7A38F41D376}
{7193BE83-12C1-4B35-8197-C28D20FBA1E6} = {DFD13180-D1BF-44DA-BEBE-4A54EFDEFFE2}
{51D7507D-48BA-43BB-8223-CE35A2D7D0D8} = {DFD13180-D1BF-44DA-BEBE-4A54EFDEFFE2}
{67E9D6C5-106F-412C-B43C-F096145FD8A9} = {D34F1DE5-ECF7-4CF0-8325-B7A38F41D376}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E124DDCB-1F8D-4F96-BF41-D87019D0A412}

View File

@ -6,7 +6,7 @@
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<RazorLangVersion>3.0</RazorLangVersion>
<Description>Ant Design components for Blazor and Razor Components</Description>
<Description>🌈 A set of enterprise-class UI components based on Ant Design and Blazor WebAssembly.</Description>
<PackageProjectUrl>https://github.com/ant-design-blazor/ant-design-blazor</PackageProjectUrl>
<RepositoryUrl>https://github.com/ant-design-blazor/ant-design-blazor</RepositoryUrl>
<PackageTags>blazor,ant-design,antd,design,razor,components</PackageTags>
@ -52,7 +52,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.DataAnnotations.Validation" Version="3.2.0-rc1.20223.4" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
<PrivateAssets>all</PrivateAssets>
@ -62,28 +61,14 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SolutionDir)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
</Target>
<Target Name="DebugRunGulp" BeforeTargets="DebugEnsureNodeEnv" Condition=" '$(Configuration)' == 'Debug' And Exists('$(SolutionDir)node_modules') ">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:components" />
</Target>
<Target Name="PublishRunGulp" AfterTargets="ComputeFilesToPublish">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:components" />
</Target>
<ItemGroup>
<Content Update="**\*.razor">
<Pack>false</Pack>
</Content>
</ItemGroup>
<Target Name="DebugMessage" BeforeTargets="Build">
<Message Importance="high" Text="If you have modified the style, documentation or added a new demo, please rebuild the entire solution." />
<Message Importance="high" Text="如果您修改了样式、文档或者新增了Demo请重新构建整个解决方案。" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5</TargetFrameworks>
<TargetFrameworks>net5</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>
@ -13,8 +13,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<PackageReference Include="YamlDotnet" Version="8.1.2" />
<PackageReference Include="Markdig" Version="0.22.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="YamlDotnet" Version="11.2.1" />
<PackageReference Include="Markdig" Version="0.25.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,63 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SolutionDir)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
</Target>
<Target Name="DebugRunGulp" BeforeTargets="DebugEnsureNodeEnv" Condition=" '$(Configuration)' == 'Debug' And Exists('$(SolutionDir)node_modules') ">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:components" />
</Target>
<Target Name="PublishRunGulp" AfterTargets="ComputeFilesToPublish">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:components" />
</Target>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SolutionDir)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
</Target>
<Target Name="DebugRunGulp" BeforeTargets="DebugEnsureNodeEnv" Condition=" '$(Configuration)' == 'Debug' And Exists('$(SolutionDir)node_modules') ">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:docs" />
</Target>
<PropertyGroup>
<CLIProjectDir>site/AntDesign.Docs.Build.CLI</CLIProjectDir>
<CLIPath>$(CLIProjectDir)/AntDesign.Docs.Build.CLI.csproj</CLIPath>
<ProjectDir>$(SolutionDir)/site/AntDesign.Docs</ProjectDir>
</PropertyGroup>
<ItemGroup>
<DocFiles Include="$(SolutionDir)docs\**\*.*" />
<DocFiles Include="$(SolutionDir)\CHANGELOG.*.*" />
</ItemGroup>
<Target Name="RunCli" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug'">
<Copy SourceFiles="@(DocFiles)" DestinationFolder="$(ProjectDir)\wwwroot\docs\%(RecursiveDir)" ContinueOnError="true" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net5 --project $(CLIPath) demo2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net5 --project $(CLIPath) menu2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/docs $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net5 --project $(CLIPath) docs2html $(ProjectDir)/wwwroot/docs ./site/AntDesign.Docs/wwwroot/docs" />
</Target>
<Target Name="PublishRunGulp" AfterTargets="ComputeFilesToPublish">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:docs" />
</Target>
</Project>

View File

@ -30,41 +30,4 @@
<ProjectReference Include="..\..\components\AntDesign.csproj" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SolutionDir)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
</Target>
<Target Name="DebugRunGulp" BeforeTargets="DebugEnsureNodeEnv" Condition=" '$(Configuration)' == 'Debug' And Exists('$(SolutionDir)node_modules') ">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:docs" />
</Target>
<PropertyGroup>
<CLIProjectDir>site/AntDesign.Docs.Build.CLI</CLIProjectDir>
<CLIPath>$(CLIProjectDir)/bin/Debug/net5/AntDesign.Docs.Build.CLI.dll</CLIPath>
<ProjectDir>$(SolutionDir)/site/AntDesign.Docs</ProjectDir>
</PropertyGroup>
<ItemGroup>
<DocFiles Include="$(SolutionDir)docs\**\*.*" />
<DocFiles Include="$(SolutionDir)\CHANGELOG.*.*" />
</ItemGroup>
<Target Name="RunCli" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug'">
<Copy SourceFiles="@(DocFiles)" DestinationFolder="$(ProjectDir)\wwwroot\docs\%(RecursiveDir)" ContinueOnError="true" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet build $(CLIProjectDir)" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet $(CLIPath) demo2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet $(CLIPath) menu2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/docs $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet $(CLIPath) docs2html $(ProjectDir)/wwwroot/docs ./site/AntDesign.Docs/wwwroot/docs" />
</Target>
<Target Name="PublishRunGulp" AfterTargets="ComputeFilesToPublish">
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:docs" />
</Target>
</Project>