From e4834ed1dad32aa138c1fd3a650fa68ad54b7c20 Mon Sep 17 00:00:00 2001 From: James Yeung Date: Thu, 10 Nov 2022 16:00:11 +0800 Subject: [PATCH] add target to .NET 7 (#2810) * docs: update .NET7 RC2 * fix target framework * update to .net 7 GA * update yaml * fix wasmhost * update document --- .github/workflows/nightly-build.yml | 7 +- .github/workflows/pr-preview.yml | 110 ------------------ .github/workflows/preview-build.yml | 7 +- .github/workflows/pull-request.yml | 5 + .github/workflows/release-AOT.yml | 7 +- .github/workflows/release.yml | 5 + README-zh_CN.md | 2 +- README.md | 2 +- components/AntDesign.csproj | 10 +- components/core/Internal/EventHandlers.cs | 3 + components/table/Table.razor.cs | 2 +- docs/introduce.en-US.md | 8 +- docs/introduce.zh-CN.md | 6 +- package.json | 4 +- scripts/gh-pages/index.html | 6 +- .../AntDesign.Docs.Build.CLI.csproj | 2 +- .../AntDesign.Docs.Build.csproj | 8 +- .../AntDesign.Docs.Server.csproj | 8 +- .../AntDesign.Docs.Wasm.csproj | 11 +- site/AntDesign.Docs.Wasm/wwwroot/index.html | 6 +- .../AntDesign.Docs.WasmHost.csproj | 4 +- site/AntDesign.Docs/AntDesign.Docs.csproj | 2 +- .../Form.EditContext.BuildTests.razor | 4 +- .../Form.EditContext.ValidationTests.razor | 2 +- .../Form/Model/ModelTests.razor | 2 +- 25 files changed, 90 insertions(+), 143 deletions(-) delete mode 100644 .github/workflows/pr-preview.yml diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 15e7dce7..df5dcb22 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -35,6 +35,11 @@ jobs: with: dotnet-version: 6.0.101 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + - uses: actions/setup-node@v1 with: node-version: "10.x" @@ -125,7 +130,7 @@ jobs: run: | npm install sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor - dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo + dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net7 -o cargo env: PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }} diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml deleted file mode 100644 index 8f5d0966..00000000 --- a/.github/workflows/pr-preview.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: 🔂 Surge PR Preview - -on: - issue_comment: - types: [created] - -jobs: - preview: - name: Preview - if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/preview') - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@0.9.0 - name: Prepare preview ⛏ - env: - RUN_PATH: https://github.com/ant-design-blazor/ant-design-blazor/actions/runs/${{ github.run_id }} - with: - github-token: ${{ github.token }} - script: | - const REPLACE_MARK = ''; - const comment = `[](${process.env.RUN_PATH})`; - const wrappedComment = ` - ${REPLACE_MARK} - ${comment} - `.trim(); - - let comments = await github.issues.listComments(context.issue); - // Find my comment - const updateComment = comments.data.find(({ body }) => body.includes(REPLACE_MARK)); - // eslint-disable-next-line no-console - console.log('Origin comment:', updateComment); - let res; - if (!updateComment) { - res = await github.issues.createComment({...context.issue, body: wrappedComment }) - } else { - res = await github.issues.updateComment({...context.issue, comment_id: updateComment.id, body: wrappedComment }) - } - - console.log(res); - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.100 - - - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.100 - - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: "10.x" - - - name: Checkout & Building ⚙ - env: - PULL_NUMBER: ${{ github.event.issue.number }} - run: | - git init - git remote add origin https://github.com/ant-design-blazor/ant-design-blazor.git - git fetch origin pull/$PULL_NUMBER/head:fork - git checkout fork - npm install - dotnet build - dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo - - - name: Deploy Preview 🚀 - env: - SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} - DEPLOY_DOMAIN: preview-${{ github.run_id }}-ant-design-blazor.surge.sh - run: | - npm install -g surge - surge --project ./cargo/wwwroot --domain $DEPLOY_DOMAIN - - - uses: actions/github-script@0.9.0 - name: Show preview ⛏ - env: - DEPLOY_DOMAIN: https://preview-${{ github.run_id }}-ant-design-blazor.surge.sh - with: - github-token: ${{ github.token }} - script: | - const REPLACE_MARK = ''; - const comment = `[](${process.env.DEPLOY_DOMAIN})`; - const wrappedComment = ` - ${REPLACE_MARK} - ${comment} - `.trim(); - - let comments = await github.issues.listComments(context.issue); - // Find my comment - const updateComment = comments.data.find(({ body }) => body.includes(REPLACE_MARK)); - // eslint-disable-next-line no-console - console.log('Origin comment:', updateComment); - let res; - if (!updateComment) { - res = await github.issues.createComment({...context.issue, body: wrappedComment }) - } else { - res = await github.issues.updateComment({...context.issue, comment_id: updateComment.id, body: wrappedComment }) - } - - console.log(res); - - # https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250 - always_job: - name: Always run job - runs-on: ubuntu-latest - steps: - - name: Always run - run: echo "This job is used to prevent the workflow to fail when all other jobs are skipped." diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 38c0afa8..2e981f1c 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -23,6 +23,11 @@ jobs: with: dotnet-version: 6.0.101 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + - name: Setup Node.js uses: actions/setup-node@v1 with: @@ -39,7 +44,7 @@ jobs: npm install dotnet build sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor - dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o _site + dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net7 -o _site env: PACKAGE_VERSION: ${{ github.event.number }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3c40f8d0..f8c0fc4e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -28,6 +28,11 @@ jobs: with: dotnet-version: 6.0.101 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + - uses: actions/setup-node@v1 with: node-version: "10.x" diff --git a/.github/workflows/release-AOT.yml b/.github/workflows/release-AOT.yml index 06b2bf8e..2173a658 100644 --- a/.github/workflows/release-AOT.yml +++ b/.github/workflows/release-AOT.yml @@ -31,6 +31,11 @@ jobs: with: dotnet-version: 6.0.101 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + - uses: actions/setup-node@v1 with: node-version: "10.x" @@ -52,7 +57,7 @@ jobs: sed -i s/{version}/$VERSION/g ./site/AntDesign.Docs.Wasm/wwwroot/index.html sed -i s/{version}/$VERSION/g ./site/AntDesign.Docs.Wasm/wwwroot/service-worker.published.js dotnet build - dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo -p:EnableAOT=true + dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net7 -o cargo -p:EnableAOT=true cp -rf cargo/staticwebapp.config.json cargo/wwwroot - name: Deploy to Azure 🚀 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f2961f52..273bbb05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,11 @@ jobs: with: dotnet-version: 6.0.101 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + - uses: actions/setup-node@v1 with: node-version: "10.x" diff --git a/README-zh_CN.md b/README-zh_CN.md index 51c30cde..4be5682b 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -164,7 +164,7 @@ WebAssembly 静态托管页面示例 ### 本地 -- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/6.0?WT.mc_id=DT-MVP-5003987) 6.0.100 以上版本 +- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.100 以上版本 - 安装 Node.js(只用于样式文件和互操作所需 TS 文件的构建) - 克隆到本地开发 diff --git a/README.md b/README.md index 8b04b278..9bf7e5f1 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ Click the button below to start a new workspace for development for free. ### Local -- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/6.0?WT.mc_id=DT-MVP-5003987) 6.0.100 or later. +- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.100 or later. - Install Node.js (only for building style files and interoperable TypeScript files) - Clone to local development diff --git a/components/AntDesign.csproj b/components/AntDesign.csproj index ec90c7ef..cba0260e 100644 --- a/components/AntDesign.csproj +++ b/components/AntDesign.csproj @@ -1,7 +1,7 @@  - netstandard2.1;net5;net6 + netstandard2.1;net5;net6;net7 10.0 Library true @@ -65,6 +65,14 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/components/core/Internal/EventHandlers.cs b/components/core/Internal/EventHandlers.cs index 3e6d80f2..4b014cf6 100644 --- a/components/core/Internal/EventHandlers.cs +++ b/components/core/Internal/EventHandlers.cs @@ -3,10 +3,13 @@ using Microsoft.AspNetCore.Components; namespace AntDesign { +#if NET7_0_OR_GREATER +#else [EventHandler("onmouseleave", typeof(EventArgs))] [EventHandler("onmouseenter", typeof(EventArgs))] public static class EventHandlers { } +#endif } diff --git a/components/table/Table.razor.cs b/components/table/Table.razor.cs index 27974a64..d91a1992 100644 --- a/components/table/Table.razor.cs +++ b/components/table/Table.razor.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging; namespace AntDesign { -#if NET6_0 +#if NET6_0_OR_GREATER [CascadingTypeParameter(nameof(TItem))] #endif diff --git a/docs/introduce.en-US.md b/docs/introduce.en-US.md index 5f65ffbb..e313b120 100644 --- a/docs/introduce.en-US.md +++ b/docs/introduce.en-US.md @@ -30,7 +30,7 @@ Following the Ant Design specification, we developed a Blazor Components library - 💕 Supports WebAssembly-based client-side and SignalR-based server-side UI event interaction. - 🎨 Supports Progressive Web Applications (PWA). - 🛡 Build with C#, a multi-paradigm static language for an efficient development experience. -- ⚙️ .NET Standard 2.1/.NET 5 based, with direct reference to the rich .NET ecosystem. +- ⚙️ .NET Standard 2.1 ~ .NET 7 based, with direct reference to the rich .NET ecosystem. - 🎁 Seamless integration with existing ASP.NET Core MVC and Razor Pages projects. ## 🌈 Online Examples @@ -41,8 +41,8 @@ WebAssembly static hosting examples: ## 🖥 Environment Support -- .NET Core 3.1 / .NET 5 / .NET 6 -- Blazor WebAssembly 3.2 / .NET 5 / .NET 6 Release +- .NET Core 3.1 / .NET 5 / .NET 6 / .NET 7 +- Blazor WebAssembly 3.2 / .NET 5 / .NET 6 / .NET 7 Release - Supports two-way binding on the server side - Supports WebAssembly static file deployment - Support 4 major browsers engines, and Internet Explorer 11+ ([Blazor Server](https://docs.microsoft.com/en-us/aspnet/core/blazor/supported-platforms?view=aspnetcore-6.0&WT.mc_id=DT-MVP-5003987) only) @@ -148,7 +148,7 @@ Options for the template: ## 🔨 Local Development -- Install [.NET Core SDK](https://dotnet.microsoft.com/download?WT.mc_id=DT-MVP-5003987) 6.0.x or later. +- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.x or later. - Install Node.js (only for building style files and interoperable TypeScript files) - Clone to local development diff --git a/docs/introduce.zh-CN.md b/docs/introduce.zh-CN.md index 605a43fc..4dd8cd68 100644 --- a/docs/introduce.zh-CN.md +++ b/docs/introduce.zh-CN.md @@ -40,8 +40,8 @@ title: Ant Design of Blazor ## 🖥 支持环境 -- 兼容 .NET Core 3.1 / .NET 5 / .NET 6 -- 最新支持 Blazor WebAssembly 6.0 正式版 +- 兼容 .NET Core 3.1 / .NET 5 / .NET 6 / .NET 7 +- 最新支持 Blazor WebAssembly 7.0 正式版 - 支持服务端双向绑定 - 支持 WebAssembly 静态文件部署 - 主流 4 款现代浏览器,以及 Internet Explorer 11+ (使用 [Blazor Server](https://docs.microsoft.com/zh-cn/aspnet/core/blazor/supported-platforms?view=aspnetcore-6.0&WT.mc_id=DT-MVP-5003987)) @@ -145,7 +145,7 @@ title: Ant Design of Blazor ## 🔨 本地开发 -- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/5.0?WT.mc_id=DT-MVP-5003987) 5.0.100 以上版本 +- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.100 以上版本 - 安装 Node.js(只用于样式文件和互操作所需 TS 文件的构建) - 克隆到本地开发 diff --git a/package.json b/package.json index bede354e..517dc0f0 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "url": "https://github.com/ElderJames/ant-design-blazor/issues" }, "scripts": { - "start": "dotnet watch -p ./site/AntDesign.Docs.Server run -f net6", - "start:wasm": "dotnet watch -p ./site/AntDesign.Docs.Wasm run -f net6", + "start": "dotnet watch -p ./site/AntDesign.Docs.Server run -f net7", + "start:wasm": "dotnet watch -p ./site/AntDesign.Docs.Wasm run -f net7", "build:lib": "gulp build:library", "build:doc": "gulp build:preview --max-old-space-size=81920", "preinstall": "dotnet tool restore", diff --git a/scripts/gh-pages/index.html b/scripts/gh-pages/index.html index 61edec0a..8ddd3bd2 100644 --- a/scripts/gh-pages/index.html +++ b/scripts/gh-pages/index.html @@ -177,6 +177,10 @@ transform: rotate(405deg); } } + + .loading-progress-text:after { + content: var(--blazor-load-percentage-text, "Loading"); + }
logo @@ -191,7 +195,7 @@
- Ant Design of Blazor +
diff --git a/site/AntDesign.Docs.Build.CLI/AntDesign.Docs.Build.CLI.csproj b/site/AntDesign.Docs.Build.CLI/AntDesign.Docs.Build.CLI.csproj index 1d7b819a..9278c09f 100644 --- a/site/AntDesign.Docs.Build.CLI/AntDesign.Docs.Build.CLI.csproj +++ b/site/AntDesign.Docs.Build.CLI/AntDesign.Docs.Build.CLI.csproj @@ -1,7 +1,7 @@  - net6 + net7 Exe diff --git a/site/AntDesign.Docs.Build/AntDesign.Docs.Build.csproj b/site/AntDesign.Docs.Build/AntDesign.Docs.Build.csproj index 2ab9b282..891eaa0d 100644 --- a/site/AntDesign.Docs.Build/AntDesign.Docs.Build.csproj +++ b/site/AntDesign.Docs.Build/AntDesign.Docs.Build.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 @@ -38,8 +38,8 @@ - - - + + + diff --git a/site/AntDesign.Docs.Server/AntDesign.Docs.Server.csproj b/site/AntDesign.Docs.Server/AntDesign.Docs.Server.csproj index ae9e7a60..bc7377d1 100644 --- a/site/AntDesign.Docs.Server/AntDesign.Docs.Server.csproj +++ b/site/AntDesign.Docs.Server/AntDesign.Docs.Server.csproj @@ -1,7 +1,7 @@  - net6 + net7 enable @@ -29,6 +29,12 @@
+ + + 6.0.100.1 + + + diff --git a/site/AntDesign.Docs.Wasm/AntDesign.Docs.Wasm.csproj b/site/AntDesign.Docs.Wasm/AntDesign.Docs.Wasm.csproj index 31a26270..f452b092 100644 --- a/site/AntDesign.Docs.Wasm/AntDesign.Docs.Wasm.csproj +++ b/site/AntDesign.Docs.Wasm/AntDesign.Docs.Wasm.csproj @@ -1,9 +1,9 @@  - net6 + net7 service-worker-assets.js - true + false @@ -17,6 +17,13 @@ + + + + + + + diff --git a/site/AntDesign.Docs.Wasm/wwwroot/index.html b/site/AntDesign.Docs.Wasm/wwwroot/index.html index 12170bf1..7e432e12 100644 --- a/site/AntDesign.Docs.Wasm/wwwroot/index.html +++ b/site/AntDesign.Docs.Wasm/wwwroot/index.html @@ -173,6 +173,10 @@ transform: rotate(405deg); } } + + .loading-progress-text:after { + content: var(--blazor-load-percentage-text, "Loading"); + }
logo @@ -187,7 +191,7 @@
- Ant Design of Blazor +
diff --git a/site/AntDesign.Docs.WasmHost/AntDesign.Docs.WasmHost.csproj b/site/AntDesign.Docs.WasmHost/AntDesign.Docs.WasmHost.csproj index 7b846c24..2a2b2beb 100644 --- a/site/AntDesign.Docs.WasmHost/AntDesign.Docs.WasmHost.csproj +++ b/site/AntDesign.Docs.WasmHost/AntDesign.Docs.WasmHost.csproj @@ -1,11 +1,11 @@  - net6 + net7 - + diff --git a/site/AntDesign.Docs/AntDesign.Docs.csproj b/site/AntDesign.Docs/AntDesign.Docs.csproj index 2fdbd7fd..fa55c09b 100644 --- a/site/AntDesign.Docs/AntDesign.Docs.csproj +++ b/site/AntDesign.Docs/AntDesign.Docs.csproj @@ -1,7 +1,7 @@  - net6 + net6;net7 diff --git a/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.BuildTests.razor b/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.BuildTests.razor index ac868d9c..0646e405 100644 --- a/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.BuildTests.razor +++ b/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.BuildTests.razor @@ -8,7 +8,7 @@ Model _model = new(); AntDesign.Form? _form; -#if NET6_0 +#if NET6_0_OR_GREATER [Fact] public void Form_EditContext_fires_OnFieldChange() { @@ -36,7 +36,7 @@ } #endif -#if NET6_0 +#if NET6_0_OR_GREATER [Fact] public void Form_EditContext_Build_keep_OnFieldChange_subscription() { diff --git a/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.ValidationTests.razor b/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.ValidationTests.razor index a720a340..7b82a51b 100644 --- a/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.ValidationTests.razor +++ b/tests/AntDesign.Tests/Form/EditContext/Form.EditContext.ValidationTests.razor @@ -19,7 +19,7 @@ }; -#if NET6_0 +#if NET6_0_OR_GREATER [Fact] public void Form_EditContext_with_RulesModeValidation_and_CompositeModel_should_validate_properly() { diff --git a/tests/AntDesign.Tests/Form/Model/ModelTests.razor b/tests/AntDesign.Tests/Form/Model/ModelTests.razor index 71358ba2..11e83c40 100644 --- a/tests/AntDesign.Tests/Form/Model/ModelTests.razor +++ b/tests/AntDesign.Tests/Form/Model/ModelTests.razor @@ -6,7 +6,7 @@ public string Name { get; set; } = ""; } -#if NET6_0 +#if NET6_0_OR_GREATER [Fact] public void Form_Model_is_updated() {