doc(Shared): add Docs project speed up debug (#1502)

* chore: 引入 Docs 工程缩减编译时长

* refactor: 更新 App 路由位置

* refactor: 调整 wasm 工程可编译

* refactor: 恢复 App 组件

* revert: 撤销资源文件的修改

* refactor: 更改变量名

* revert: 恢复脚本引用逻辑

* refactor: 增加路由配置

* refactor: 更新脚本路径

* revert: 撤销可见性更改

* revert: 撤销菜单更改

* doc: 格式化文档

* refactor: 更新项目依赖
This commit is contained in:
Argo Zhang 2023-07-06 20:32:04 +08:00 committed by GitHub
parent 7cfa65742e
commit 5ac9de6936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 1383 additions and 21 deletions

View File

@ -125,6 +125,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapBlazor.MouseFollow
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.Html2Pdf", "src\Extensions\Components\BootstrapBlazor.Html2Pdf\BootstrapBlazor.Html2Pdf.csproj", "{CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.Html2Pdf", "src\Extensions\Components\BootstrapBlazor.Html2Pdf\BootstrapBlazor.Html2Pdf.csproj", "{CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.Docs", "src\BootstrapBlazor.Docs\BootstrapBlazor.Docs.csproj", "{25062E29-CFBD-47C9-9E6B-ADDA19085572}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -251,6 +253,10 @@ Global
{CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}.Debug|Any CPU.Build.0 = Debug|Any CPU {CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}.Release|Any CPU.ActiveCfg = Release|Any CPU {CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}.Release|Any CPU.Build.0 = Release|Any CPU {CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2}.Release|Any CPU.Build.0 = Release|Any CPU
{25062E29-CFBD-47C9-9E6B-ADDA19085572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25062E29-CFBD-47C9-9E6B-ADDA19085572}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25062E29-CFBD-47C9-9E6B-ADDA19085572}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25062E29-CFBD-47C9-9E6B-ADDA19085572}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -294,6 +300,7 @@ Global
{19D6EF90-31A9-4E1C-942D-E6052205CA1C} = {CD062AB6-244D-402A-8F33-C37DAC5856CC} {19D6EF90-31A9-4E1C-942D-E6052205CA1C} = {CD062AB6-244D-402A-8F33-C37DAC5856CC}
{71FDF312-4195-4218-A941-754BDF5BAB82} = {CD062AB6-244D-402A-8F33-C37DAC5856CC} {71FDF312-4195-4218-A941-754BDF5BAB82} = {CD062AB6-244D-402A-8F33-C37DAC5856CC}
{CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2} = {CD062AB6-244D-402A-8F33-C37DAC5856CC} {CA5BF6FD-257E-4D4B-8DF0-F4035B0C7CA2} = {CD062AB6-244D-402A-8F33-C37DAC5856CC}
{25062E29-CFBD-47C9-9E6B-ADDA19085572} = {A2182155-43ED-44C1-BF6F-1B70EBD2DFFE}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0DCB0756-34FA-4FD0-AE1D-D3F08B5B3A6B} SolutionGuid = {0DCB0756-34FA-4FD0-AE1D-D3F08B5B3A6B}

View File

@ -2,6 +2,7 @@
"solution": { "solution": {
"path": "BootstrapBlazor.sln", "path": "BootstrapBlazor.sln",
"projects": [ "projects": [
"src\\BootstrapBlazor.Docs\\BootstrapBlazor.Docs.csproj",
"src\\BootstrapBlazor.Server\\BootstrapBlazor.Server.csproj", "src\\BootstrapBlazor.Server\\BootstrapBlazor.Server.csproj",
"src\\BootstrapBlazor.Shared\\BootstrapBlazor.Shared.csproj", "src\\BootstrapBlazor.Shared\\BootstrapBlazor.Shared.csproj",
"src\\BootstrapBlazor\\BootstrapBlazor.csproj", "src\\BootstrapBlazor\\BootstrapBlazor.csproj",

View File

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\Framework.props" />
<PropertyGroup>
<Version>7.0.0</Version>
<RootNamespace>BootstrapBlazor.Shared</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor.Shared" Version="7.0.0" />
<PackageReference Include="Longbow.GiteeAuth" Version="7.0.0" />
<PackageReference Include="Longbow.GitHubAuth" Version="7.0.1" />
<PackageReference Include="Longbow.OAuth" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BootstrapBlazor\BootstrapBlazor.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="BootstrapBlazor.Components" />
<Using Include="BootstrapBlazor.Shared.Common" />
<Using Include="BootstrapBlazor.Shared.Components" />
<Using Include="BootstrapBlazor.Shared.Samples" />
<Using Include="Microsoft.AspNetCore.Components" />
<Using Include="Microsoft.Extensions.Localization" />
<Using Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@
@using Bootstrap.Shared.OAuth; @using Bootstrap.Shared.OAuth;
@using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Authorization
@inherits BootstrapModuleComponentBase @inherits BootstrapModuleComponentBase
@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.Shared/Demos/AzureOpenAI/AzureOpenAIChat.razor.js")] @attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.Docs/Demos/AzureOpenAI/AzureOpenAIChat.razor.js")]
<div class="chat-title">@Localizer["ChatTitle"]</div> <div class="chat-title">@Localizer["ChatTitle"]</div>
<div class="chat-body"> <div class="chat-body">

View File

@ -0,0 +1,18 @@
@using BootstrapBlazor.Components
@using BootstrapBlazor.Shared
@using BootstrapBlazor.Shared.Components
@using BootstrapBlazor.Shared.Samples
@using BootstrapBlazor.Shared.Shared
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.Extensions.Configuration
@using Microsoft.Extensions.DependencyInjection
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Options
@using Microsoft.JSInterop
@using System.Diagnostics.CodeAnalysis
@using System.Net.Http
@using System.Threading.Tasks
@using System.Globalization

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#fff;color:#000}.hljs-comment,.hljs-quote,.hljs-variable{color:green}.hljs-built_in,.hljs-keyword,.hljs-name,.hljs-selector-tag,.hljs-tag{color:#00f}.hljs-addition,.hljs-attribute,.hljs-literal,.hljs-section,.hljs-string,.hljs-template-tag,.hljs-template-variable,.hljs-title,.hljs-type{color:#a31515}.hljs-deletion,.hljs-meta,.hljs-selector-attr,.hljs-selector-pseudo{color:#2b91af}.hljs-doctag{color:grey}.hljs-attr{color:red}.hljs-bullet,.hljs-link,.hljs-symbol{color:#00b0e8}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}

View File

@ -12,7 +12,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\BootstrapBlazor.Shared\BootstrapBlazor.Shared.csproj" /> <ProjectReference Include="..\BootstrapBlazor.Docs\BootstrapBlazor.Docs.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -5,6 +5,7 @@
using Bootstrap.Shared.OAuth; using Bootstrap.Shared.OAuth;
using BootstrapBlazor.Components; using BootstrapBlazor.Components;
using BootstrapBlazor.Server.Services; using BootstrapBlazor.Server.Services;
using BootstrapBlazor.Shared;
using DocumentFormat.OpenXml.Wordprocessing; using DocumentFormat.OpenXml.Wordprocessing;
using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.WebUtilities; using Microsoft.AspNetCore.WebUtilities;
@ -36,6 +37,12 @@ internal static class ServicesExtensions
// 增加演示网站服务 // 增加演示网站服务
services.AddWebSiteServices(); services.AddWebSiteServices();
// 配置网站路由表
services.Configure<WebsiteOptions>(op =>
{
op.AdditionalAssemblies = new Assembly[] { typeof(BootstrapBlazor.Shared.OAuth.AzureOpenAIUser).Assembly };
});
// 增加 BootstrapBlazor 组件 // 增加 BootstrapBlazor 组件
services.AddBootstrapBlazor(configureOptions); services.AddBootstrapBlazor(configureOptions);

View File

@ -21,6 +21,7 @@
<link rel="stylesheet" href="_content/BootstrapBlazor.MaterialDesign/css/md.min.css" asp-append-version="true"> <link rel="stylesheet" href="_content/BootstrapBlazor.MaterialDesign/css/md.min.css" asp-append-version="true">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" asp-append-version="true"> <link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" asp-append-version="true">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/motronic.min.css" asp-append-version="true"> <link rel="stylesheet" href="_content/BootstrapBlazor/css/motronic.min.css" asp-append-version="true">
<link rel="stylesheet" href="_content/BootstrapBlazor.Docs/BootstrapBlazor.Docs.bundle.scp.css" asp-append-version="true">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/BootstrapBlazor.Shared.bundle.scp.css" asp-append-version="true"> <link rel="stylesheet" href="_content/BootstrapBlazor.Shared/BootstrapBlazor.Shared.bundle.scp.css" asp-append-version="true">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/css/site.css" asp-append-version="true"> <link rel="stylesheet" href="_content/BootstrapBlazor.Shared/css/site.css" asp-append-version="true">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/css/motronic.css" asp-append-version="true"> <link rel="stylesheet" href="_content/BootstrapBlazor.Shared/css/motronic.css" asp-append-version="true">

View File

@ -3,7 +3,7 @@
@attribute [JSModuleAutoLoader("App.razor.js", AutoInvokeDispose = false)] @attribute [JSModuleAutoLoader("App.razor.js", AutoInvokeDispose = false)]
<BootstrapBlazorRoot> <BootstrapBlazorRoot>
<Router AppAssembly="@typeof(App).Assembly"> <Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="AdditionalAssemblies">
<Found Context="routeData"> <Found Context="routeData">
<PageTitle>@AppLocalizer["Title"]</PageTitle> <PageTitle>@AppLocalizer["Title"]</PageTitle>
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />

View File

@ -3,6 +3,8 @@
// Website: https://www.blazor.zone or https://argozhang.github.io/ // Website: https://www.blazor.zone or https://argozhang.github.io/
using BootstrapBlazor.Shared.Extensions; using BootstrapBlazor.Shared.Extensions;
using Microsoft.Extensions.Options;
using System.Reflection;
namespace BootstrapBlazor.Shared; namespace BootstrapBlazor.Shared;
@ -15,6 +17,10 @@ public partial class App
[NotNull] [NotNull]
private IStringLocalizer<App>? Localizer { get; set; } private IStringLocalizer<App>? Localizer { get; set; }
[Inject]
[NotNull]
private IOptions<WebsiteOptions>? WebsiteOptions { get; set; }
[Inject] [Inject]
[NotNull] [NotNull]
private IDispatchService<GiteePostBody>? DispatchService { get; set; } private IDispatchService<GiteePostBody>? DispatchService { get; set; }
@ -23,6 +29,9 @@ public partial class App
[NotNull] [NotNull]
private ToastService? Toast { get; set; } private ToastService? Toast { get; set; }
[NotNull]
private IEnumerable<Assembly>? AdditionalAssemblies { get; set; }
/// <summary> /// <summary>
/// OnInitialized 方法 /// OnInitialized 方法
/// </summary> /// </summary>
@ -30,6 +39,7 @@ public partial class App
{ {
base.OnInitialized(); base.OnInitialized();
AdditionalAssemblies = WebsiteOptions.Value.AdditionalAssemblies;
DispatchService.Subscribe(Notify); DispatchService.Subscribe(Notify);
} }

View File

@ -2,6 +2,10 @@
<Import Project="..\..\Framework.props" /> <Import Project="..\..\Framework.props" />
<PropertyGroup>
<Version>7.0.0</Version>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<SupportedPlatform Include="browser" /> <SupportedPlatform Include="browser" />
</ItemGroup> </ItemGroup>
@ -22,6 +26,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<!--<PackageReference Include="BootstrapBlazor" Version="7.8.3" />-->
<PackageReference Include="BootstrapBlazor.AzureOpenAI" Version="7.0.0" /> <PackageReference Include="BootstrapBlazor.AzureOpenAI" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.BaiduSpeech" Version="7.1.0" /> <PackageReference Include="BootstrapBlazor.BaiduSpeech" Version="7.1.0" />
<PackageReference Include="BootstrapBlazor.BaiduOcr" Version="7.1.1" /> <PackageReference Include="BootstrapBlazor.BaiduOcr" Version="7.1.1" />
@ -44,9 +49,6 @@
<PackageReference Include="BootstrapBlazor.Topology" Version="7.4.4" /> <PackageReference Include="BootstrapBlazor.Topology" Version="7.4.4" />
<PackageReference Include="BootstrapBlazor.VideoPlayer" Version="7.0.4" /> <PackageReference Include="BootstrapBlazor.VideoPlayer" Version="7.0.4" />
<PackageReference Include="BootstrapBlazor.MouseFollower" Version="7.0.0" /> <PackageReference Include="BootstrapBlazor.MouseFollower" Version="7.0.0" />
<PackageReference Include="Longbow.GiteeAuth" Version="7.0.0" />
<PackageReference Include="Longbow.GitHubAuth" Version="7.0.1" />
<PackageReference Include="Longbow.OAuth" Version="7.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,6 +3,7 @@
// Website: https://www.blazor.zone or https://argozhang.github.io/ // Website: https://www.blazor.zone or https://argozhang.github.io/
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System.Reflection;
namespace BootstrapBlazor.Shared; namespace BootstrapBlazor.Shared;
@ -113,6 +114,11 @@ public class WebsiteOptions
/// </summary> /// </summary>
public Dictionary<string, string?> Links { get; set; } public Dictionary<string, string?> Links { get; set; }
/// <summary>
/// 获得/设置 额外路由程序集
/// </summary>
public IEnumerable<Assembly>? AdditionalAssemblies { get; set; }
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
/// </summary> /// </summary>
@ -138,8 +144,8 @@ public class WebsiteOptions
private IConfiguration GetConfiguration(string jsonFileName) private IConfiguration GetConfiguration(string jsonFileName)
{ {
var assembly = GetType().Assembly; var assembly = GetType().Assembly;
var assemlbyName = assembly.GetName().Name; var assemblyName = assembly.GetName().Name;
using var res = assembly.GetManifestResourceStream($"{assemlbyName}.{jsonFileName}") ?? throw new InvalidOperationException(); using var res = assembly.GetManifestResourceStream($"{assemblyName}.{jsonFileName}") ?? throw new InvalidOperationException();
return new ConfigurationBuilder() return new ConfigurationBuilder()
.AddJsonStream(res) .AddJsonStream(res)

View File

@ -4,6 +4,9 @@
namespace BootstrapBlazor.Shared.Extensions; namespace BootstrapBlazor.Shared.Extensions;
/// <summary>
/// DispatchEntry 扩展方法
/// </summary>
internal static class DispatchEntryExtensions internal static class DispatchEntryExtensions
{ {
/// <summary> /// <summary>

View File

@ -46,13 +46,13 @@ public partial class PracNavMenu
new MenuItem() new MenuItem()
{ {
Template = CreateDownloadButtonComponent("仪表盘dashboard", dashboardFileList), Template = CreateDownloadButtonComponent("仪表盘dashboard", dashboardFileList),
Text="仪表盘 Dashboard", Text = "仪表盘 Dashboard",
Url="dashboard" Url = "dashboard"
}, },
new MenuItem() new MenuItem()
{ {
Text="登陆和注册 Login & Register", Text = "登陆和注册 Login & Register",
Url="praclogin", Url = "praclogin",
Items = new List<MenuItem>() Items = new List<MenuItem>()
{ {
new() new()
@ -114,8 +114,8 @@ public partial class PracNavMenu
new MenuItem() new MenuItem()
{ {
Template = CreateDownloadButtonComponent("瀑布流图片pintereso", pinteresoFileList), Template = CreateDownloadButtonComponent("瀑布流图片pintereso", pinteresoFileList),
Text="瀑布流图片 Pintereso", Text = "瀑布流图片 Pintereso",
Url="pintereso" Url = "pintereso"
} }
}; };
} }

View File

@ -6,15 +6,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="BootstrapBlazor.Shared" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.*" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.*" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.*" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="7.*" /> <PackageReference Include="System.Net.Http.Json" Version="7.*" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BootstrapBlazor.Shared\BootstrapBlazor.Shared.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\..\BootstrapBlazor.Server\wwwroot\favicon.ico" Link="wwwroot\favicon.ico"> <Content Include="..\..\BootstrapBlazor.Server\wwwroot\favicon.ico" Link="wwwroot\favicon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -24,8 +21,20 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BootstrapBlazor\BootstrapBlazor.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" /> <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Using Include="BootstrapBlazor.Components" />
<Using Include="BootstrapBlazor.Shared.Components" />
<Using Include="Microsoft.AspNetCore.Components" />
<Using Include="Microsoft.Extensions.Localization" />
<Using Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
</Project> </Project>

View File

@ -1,8 +1,17 @@
@using BootstrapBlazor.Shared.Shared @using BootstrapBlazor.Components
@using BootstrapBlazor.Shared
@using BootstrapBlazor.Shared.Components
@using BootstrapBlazor.Shared.Shared
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.Extensions.Configuration
@using Microsoft.Extensions.DependencyInjection
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Options
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using System.Diagnostics.CodeAnalysis
@using System.Net.Http @using System.Net.Http
@using System.Net.Http.Json @using System.Threading.Tasks
@using System.Globalization