From 20195e7eaf75a5f356be182ee9663a56feec3c92 Mon Sep 17 00:00:00 2001 From: nsnail Date: Wed, 22 Nov 2023 16:02:07 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=F0=9F=93=A6=20=E6=95=B4=E7=90=86?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E7=9B=B8=E5=85=B3=E7=9A=84=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20(#64)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - .gitmodules | 9 +++ .tgitconfig | 4 -- CHANGELOG.md | 4 +- Directory.Build.props | 4 +- NetAdmin.sln | 58 ++++++++++--------- README.md | 1 - build.cake | 49 ---------------- clone.project.refs.ps1 | 6 -- code.cleanup.full.ps1 | 1 - copy.pkg.xml.comment.files.targets | 4 +- dot.clean.cmd | 4 -- dotnet-tools.json | 8 +-- gen.ln.cmd | 2 - install.as.tpl.ps1 | 2 - nuget.config | 4 +- prebuild.targets | 8 +-- refs/FreeSql | 1 + refs/Furion | 1 + refs/ns-ext | 1 + code.clean.csx => scripts/code.clean.csx | 2 +- code.clean.ps1 => scripts/code.clean.ps1 | 0 scripts/code.cleanup.full.ps1 | 1 + scripts/dot.clean.cmd | 4 ++ gen.cs.tt => scripts/gen.cs.tt | 2 +- gen.id.linq => scripts/gen.id.linq | 0 scripts/gen.ln.cmd | 2 + gen.resx.tt => scripts/gen.resx.tt | 2 +- 1.git.pr.ps1 => scripts/git.pr.ps1 | 4 +- git.rc.ps1 => scripts/git.rc.ps1 | 0 .../image.optimize.csx | 4 +- scripts/install.as.tpl.ps1 | 2 + rename.csx => scripts/rename.csx | 4 +- .../switcher.freesql.json | 4 +- .../switcher.furion.json | 2 +- .../switcher.nsext.json | 2 +- switcher.ps1 => scripts/switcher.ps1 | 2 +- .../sync.sln.files.csx | 20 ++++++- 38 files changed, 95 insertions(+), 134 deletions(-) create mode 100644 .gitmodules delete mode 100644 .tgitconfig delete mode 100644 build.cake delete mode 100644 clone.project.refs.ps1 delete mode 100644 code.cleanup.full.ps1 delete mode 100644 dot.clean.cmd delete mode 100644 gen.ln.cmd delete mode 100644 install.as.tpl.ps1 create mode 160000 refs/FreeSql create mode 160000 refs/Furion create mode 160000 refs/ns-ext rename code.clean.csx => scripts/code.clean.csx (97%) rename code.clean.ps1 => scripts/code.clean.ps1 (100%) create mode 100644 scripts/code.cleanup.full.ps1 create mode 100644 scripts/dot.clean.cmd rename gen.cs.tt => scripts/gen.cs.tt (98%) rename gen.id.linq => scripts/gen.id.linq (100%) create mode 100644 scripts/gen.ln.cmd rename gen.resx.tt => scripts/gen.resx.tt (95%) rename 1.git.pr.ps1 => scripts/git.pr.ps1 (85%) rename git.rc.ps1 => scripts/git.rc.ps1 (100%) rename image.optimize.csx => scripts/image.optimize.csx (97%) create mode 100644 scripts/install.as.tpl.ps1 rename rename.csx => scripts/rename.csx (81%) rename switcher.freesql.json => scripts/switcher.freesql.json (72%) rename switcher.furion.json => scripts/switcher.furion.json (75%) rename switcher.nsext.json => scripts/switcher.nsext.json (81%) rename switcher.ps1 => scripts/switcher.ps1 (93%) rename sync.sln.files.csx => scripts/sync.sln.files.csx (60%) diff --git a/.gitignore b/.gitignore index f8d1a2ec..83f8abf8 100644 --- a/.gitignore +++ b/.gitignore @@ -400,7 +400,6 @@ FodyWeavers.xsd # User Define dist/ -refs/ *.[Dd]esigner.cs *.db cache \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e2f67f6a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "refs/Furion"] + path = refs/Furion + url = https://github.com/nsnail/Furion.git +[submodule "refs/ns-ext"] + path = refs/ns-ext + url = https://github.com/nsnail/ns-ext.git +[submodule "refs/FreeSql"] + path = refs/FreeSql + url = https://github.com/nsnail/FreeSql.git diff --git a/.tgitconfig b/.tgitconfig deleted file mode 100644 index cea19aa0..00000000 --- a/.tgitconfig +++ /dev/null @@ -1,4 +0,0 @@ -[hook "startcommit"] - cmdline = dot.clean.cmd - wait = true - show = true \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7b6fa3..029abdf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Changelog -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +All notable changes to this project will be documented in this file. +See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ## 1.0.0 (2023-11-17) - ### Features * ✨ 基础模块 ([d26e4c7](https://github.com/nsnail/NetAdmin/commit/d26e4c77cc7264829a410f8503e855531f6b9c19)) \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 97098841..7788f11e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ $(MSBuildThisFileDirectory) - + true nsnail @@ -31,6 +31,6 @@ - + \ No newline at end of file diff --git a/NetAdmin.sln b/NetAdmin.sln index 94a5c3ad..ed2e4594 100644 --- a/NetAdmin.sln +++ b/NetAdmin.sln @@ -13,28 +13,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0 .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore - .tgitconfig = .tgitconfig - 1.git.pr.ps1 = 1.git.pr.ps1 - build.cake = build.cake + .gitmodules = .gitmodules CHANGELOG.md = CHANGELOG.md - clone.project.refs.ps1 = clone.project.refs.ps1 - code.clean.csx = code.clean.csx - code.clean.ps1 = code.clean.ps1 - code.cleanup.full.ps1 = code.cleanup.full.ps1 code.quality.props = code.quality.props copy.pkg.xml.comment.files.targets = copy.pkg.xml.comment.files.targets Directory.Build.props = Directory.Build.props Dockerfile = Dockerfile - dot.clean.cmd = dot.clean.cmd dotnet-tools.json = dotnet-tools.json - gen.cs.tt = gen.cs.tt - gen.id.linq = gen.id.linq - gen.ln.cmd = gen.ln.cmd - gen.resx.tt = gen.resx.tt - git.rc.ps1 = git.rc.ps1 global.json = global.json - image.optimize.csx = image.optimize.csx - install.as.tpl.ps1 = install.as.tpl.ps1 LICENSE = LICENSE minver.targets = minver.targets NetAdmin.sln.DotSettings = NetAdmin.sln.DotSettings @@ -42,14 +28,37 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0 package.json = package.json prebuild.targets = prebuild.targets README.md = README.md - rename.csx = rename.csx stylecop.analyzers.ruleset = stylecop.analyzers.ruleset StyleCop.json = StyleCop.json - switcher.freesql.json = switcher.freesql.json - switcher.furion.json = switcher.furion.json - switcher.nsext.json = switcher.nsext.json - switcher.ps1 = switcher.ps1 - sync.sln.files.csx = sync.sln.files.csx + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{BB0B25C9-0901-4923-913F-00F9A6B352A5}" + ProjectSection(SolutionItems) = preProject + code.clean.csx = scripts/code.clean.csx + code.clean.ps1 = scripts/code.clean.ps1 + code.cleanup.full.ps1 = scripts/code.cleanup.full.ps1 + dot.clean.cmd = scripts/dot.clean.cmd + gen.cs.tt = scripts/gen.cs.tt + gen.id.linq = scripts/gen.id.linq + gen.ln.cmd = scripts/gen.ln.cmd + gen.resx.tt = scripts/gen.resx.tt + git.pr.ps1 = scripts/git.pr.ps1 + git.rc.ps1 = scripts/git.rc.ps1 + image.optimize.csx = scripts/image.optimize.csx + install.as.tpl.ps1 = scripts/install.as.tpl.ps1 + rename.csx = scripts/rename.csx + switcher.freesql.json = scripts/switcher.freesql.json + switcher.furion.json = scripts/switcher.furion.json + switcher.nsext.json = scripts/switcher.nsext.json + switcher.ps1 = scripts/switcher.ps1 + sync.sln.files.csx = scripts/sync.sln.files.csx + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1129FE25-466B-4F4F-85FC-3752664245E1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}" + ProjectSection(SolutionItems) = preProject + ci.yml = .github/workflows/ci.yml EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.Infrastructure", "src\backend\NetAdmin.Infrastructure\NetAdmin.Infrastructure.csproj", "{1E62C322-EE42-4699-A6F1-791C53EFA62D}" @@ -88,13 +97,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "06.Tests", "06.Tests", "{89 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.BizServer.Tests", "src\backend\NetAdmin.BizServer.Tests\NetAdmin.BizServer.Tests.csproj", "{C7F27698-DA05-4ACD-B0D7-4791B3972002}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1129FE25-466B-4F4F-85FC-3752664245E1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}" - ProjectSection(SolutionItems) = preProject - ci.yml = .github/workflows/ci.yml - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.Tests", "src\backend\NetAdmin.Tests\NetAdmin.Tests.csproj", "{00604162-C444-478B-B773-3AB23C856CA7}" EndProject Global diff --git a/README.md b/README.md index ef8facbd..edbfdc65 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ 通用后台权限管理系统、快速开发框架(基于C#12/.NET8、Vue3/Vite、Element Plus等现代技术构建,具有十分整洁、优雅的编码规范) - [![.NET](https://github.com/nsnail/NetAdmin/actions/workflows/ci.yml/badge.svg)](https://github.com/nsnail/NetAdmin/actions/workflows/ci.yml) [![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nsnail/NetAdmin/blob/main/LICENSE) [![Furion](https://img.shields.io/badge/Furion-4.x-blueviolet.svg)](https://github.com/nsnail/NetAdmin/blob/main/LICENSE) diff --git a/build.cake b/build.cake deleted file mode 100644 index 7c769ad7..00000000 --- a/build.cake +++ /dev/null @@ -1,49 +0,0 @@ -var target = Argument("target", "Default"); -var configuration = Argument("configuration", "Release"); -var outputDirectory = Argument("output-directory", "./dist/backend/publish"); - -//////////////////////////////////////////////////////////////// -// Tasks - -Task("Clean") - .Does(context => -{ - context.CleanDirectory("./dist"); -}); - -Task("Build") - .IsDependentOn("Clean") - .Does(context => -{ - DotNetBuild("./NetAdmin.sln", new DotNetBuildSettings { - Configuration = configuration - }); -}); - -Task("Publish-BizServer") - .Does(context => -{ - DotNetPublish("./src/backend/NetAdmin.BizServer.Host/NetAdmin.BizServer.Host.csproj", new DotNetPublishSettings { - NoBuild = true, - Configuration = configuration, - OutputDirectory = new DirectoryPath(outputDirectory) - }); -}); - -Task("Publish-ScheduledService") - .Does(context => -{ - DotNetPublish("./src/backend/NetAdmin.ScheduledService/NetAdmin.ScheduledService.csproj", new DotNetPublishSettings { - NoBuild = true, - Configuration = configuration, - OutputDirectory = new DirectoryPath(outputDirectory) - }); -}); - -Task("Default") - .IsDependentOn("Build"); - -//////////////////////////////////////////////////////////////// -// Execution - -RunTarget(target) \ No newline at end of file diff --git a/clone.project.refs.ps1 b/clone.project.refs.ps1 deleted file mode 100644 index bc8cae6d..00000000 --- a/clone.project.refs.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -$refs = ('https://github.com/nsnail/ns-ext.git', 'https://github.com/nsnail/Furion.git', 'https://github.com/nsnail/FreeSql.git') - -foreach ($item in $refs) -{ - git clone --depth 1 --config "http.proxy=http://127.0.0.1:1081" $item "./refs/$( [regex]::Match($item, '/([^/]+)\.git$').Groups[1] )" -} \ No newline at end of file diff --git a/code.cleanup.full.ps1 b/code.cleanup.full.ps1 deleted file mode 100644 index 66e59a41..00000000 --- a/code.cleanup.full.ps1 +++ /dev/null @@ -1 +0,0 @@ -dotnet jb cleanupcode --no-build ./NetAdmin.sln \ No newline at end of file diff --git a/copy.pkg.xml.comment.files.targets b/copy.pkg.xml.comment.files.targets index 93db426c..5f7a4f5d 100644 --- a/copy.pkg.xml.comment.files.targets +++ b/copy.pkg.xml.comment.files.targets @@ -3,8 +3,8 @@ + Include="$(NugetPackageRoot)\%(PackageReference.Identity)\%(PackageReference.Version)\%(PackageReference.CopyToOutputDirectory)" /> - + \ No newline at end of file diff --git a/dot.clean.cmd b/dot.clean.cmd deleted file mode 100644 index 4f18cc51..00000000 --- a/dot.clean.cmd +++ /dev/null @@ -1,4 +0,0 @@ -call npm --prefix ./src/frontend/admin run prettier -dot rbom -w -e refs -e .git -e node_modules -dot trim -w -e refs -e .git -e node_modules -dot tolf -w -e refs -e .git -e node_modules \ No newline at end of file diff --git a/dotnet-tools.json b/dotnet-tools.json index 9ed33e04..11366c32 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -8,12 +8,6 @@ "t4" ] }, - "cake.tool": { - "version": "4.0.0", - "commands": [ - "dotnet-cake" - ] - }, "dotnet-script": { "version": "1.5.0", "commands": [ @@ -21,7 +15,7 @@ ] }, "jetbrains.resharper.globaltools": { - "version": "2023.2.3", + "version": "2023.3.0-eap08", "commands": [ "jb" ] diff --git a/gen.ln.cmd b/gen.ln.cmd deleted file mode 100644 index 028e7740..00000000 --- a/gen.ln.cmd +++ /dev/null @@ -1,2 +0,0 @@ -dotnet t4 ./gen.resx.tt -o ./assets/res/Ln.resx -dotnet t4 ./gen.cs.tt -o ./dist/backend/NetAdmin.Infrastructure/Ln.cs \ No newline at end of file diff --git a/install.as.tpl.ps1 b/install.as.tpl.ps1 deleted file mode 100644 index 648e90fd..00000000 --- a/install.as.tpl.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -dotnet new uninstall . -dotnet new --install . \ No newline at end of file diff --git a/nuget.config b/nuget.config index 0066ce13..eb8bbcaf 100644 --- a/nuget.config +++ b/nuget.config @@ -2,7 +2,7 @@ - - + + \ No newline at end of file diff --git a/prebuild.targets b/prebuild.targets index 6e646a79..6218552f 100644 --- a/prebuild.targets +++ b/prebuild.targets @@ -1,12 +1,12 @@ - diff --git a/refs/FreeSql b/refs/FreeSql new file mode 160000 index 00000000..0f6c2b80 --- /dev/null +++ b/refs/FreeSql @@ -0,0 +1 @@ +Subproject commit 0f6c2b807db92d2ade000558faf3ad5fd9baa34c diff --git a/refs/Furion b/refs/Furion new file mode 160000 index 00000000..d23c7cca --- /dev/null +++ b/refs/Furion @@ -0,0 +1 @@ +Subproject commit d23c7cca552e9b1b1365349741139a012e2bc955 diff --git a/refs/ns-ext b/refs/ns-ext new file mode 160000 index 00000000..8c0dbcf1 --- /dev/null +++ b/refs/ns-ext @@ -0,0 +1 @@ +Subproject commit 8c0dbcf1f4507af29517dccebff5289c42e9b477 diff --git a/code.clean.csx b/scripts/code.clean.csx similarity index 97% rename from code.clean.csx rename to scripts/code.clean.csx index f0d2fc32..cb98db8e 100644 --- a/code.clean.csx +++ b/scripts/code.clean.csx @@ -18,7 +18,7 @@ using System.Net.Http.Json; { CreateNoWindow = true, FileName = "dotnet", - Arguments = $"jb cleanupcode --include=\"{files}\" --no-build ./NetAdmin.sln", + Arguments = $"jb cleanupcode --include=\"{files}\" --no-build ../NetAdmin.sln", UseShellExecute = false, RedirectStandardOutput = true } diff --git a/code.clean.ps1 b/scripts/code.clean.ps1 similarity index 100% rename from code.clean.ps1 rename to scripts/code.clean.ps1 diff --git a/scripts/code.cleanup.full.ps1 b/scripts/code.cleanup.full.ps1 new file mode 100644 index 00000000..5e79a0a0 --- /dev/null +++ b/scripts/code.cleanup.full.ps1 @@ -0,0 +1 @@ +dotnet jb cleanupcode --no-build ../NetAdmin.sln \ No newline at end of file diff --git a/scripts/dot.clean.cmd b/scripts/dot.clean.cmd new file mode 100644 index 00000000..3c113208 --- /dev/null +++ b/scripts/dot.clean.cmd @@ -0,0 +1,4 @@ +call npm --prefix ../src/frontend/admin run prettier +dot rbom -w -e refs -e .git -e node_modules ../ +dot trim -w -e refs -e .git -e node_modules ../ +dot tolf -w -e refs -e .git -e node_modules ../ \ No newline at end of file diff --git a/gen.cs.tt b/scripts/gen.cs.tt similarity index 98% rename from gen.cs.tt rename to scripts/gen.cs.tt index 9ac4c3ad..b75c4dcc 100644 --- a/gen.cs.tt +++ b/scripts/gen.cs.tt @@ -63,7 +63,7 @@ public sealed class Ln public static CultureInfo Culture { get; set; } <# var xml = new XmlDocument(); - xml.Load("./assets/res/Ln.resx"); + xml.Load("../assets/res/Ln.resx"); foreach (XmlNode data in xml.SelectNodes("//root/data")!) { #> diff --git a/gen.id.linq b/scripts/gen.id.linq similarity index 100% rename from gen.id.linq rename to scripts/gen.id.linq diff --git a/scripts/gen.ln.cmd b/scripts/gen.ln.cmd new file mode 100644 index 00000000..f6340edd --- /dev/null +++ b/scripts/gen.ln.cmd @@ -0,0 +1,2 @@ +dotnet t4 ./gen.resx.tt -o ../assets/res/Ln.resx +dotnet t4 ./gen.cs.tt -o ../dist/backend/NetAdmin.Infrastructure/Ln.cs \ No newline at end of file diff --git a/gen.resx.tt b/scripts/gen.resx.tt similarity index 95% rename from gen.resx.tt rename to scripts/gen.resx.tt index 6c402481..5c98968f 100644 --- a/gen.resx.tt +++ b/scripts/gen.resx.tt @@ -29,7 +29,7 @@ // ReSharper disable DuplicateResource <# var regex = new Regex(@"^\d", RegexOptions.Compiled); - foreach (var line in File.ReadLines("./assets/res/ln.txt")) + foreach (var line in File.ReadLines("../assets/res/ln.txt")) { #> <#= line #>" xml:space="preserve"><#= line #> diff --git a/1.git.pr.ps1 b/scripts/git.pr.ps1 similarity index 85% rename from 1.git.pr.ps1 rename to scripts/git.pr.ps1 index 37401dc3..ca0a66a8 100644 --- a/1.git.pr.ps1 +++ b/scripts/git.pr.ps1 @@ -1,7 +1,7 @@ $branch = $( git branch --show-current ) ./dot.clean.cmd -git add . -./node_modules/.bin/git-cz.ps1 +git add ../ +../node_modules/.bin/git-cz.ps1 git pull git push --set-upstream origin $branch Start-Process -FilePath "https://github.com/nsnail/NetAdmin/compare/main...$branch" diff --git a/git.rc.ps1 b/scripts/git.rc.ps1 similarity index 100% rename from git.rc.ps1 rename to scripts/git.rc.ps1 diff --git a/image.optimize.csx b/scripts/image.optimize.csx similarity index 97% rename from image.optimize.csx rename to scripts/image.optimize.csx index e43a4d40..41f558cb 100644 --- a/image.optimize.csx +++ b/scripts/image.optimize.csx @@ -7,7 +7,7 @@ var files = Directory .EnumerateFiles( - "./", + "../", "*.png", new EnumerationOptions { @@ -37,7 +37,7 @@ files = new[] { "*.jpg", "*.jpeg" } .SelectMany( x => Directory.EnumerateFiles( - "./", + "../", x, new EnumerationOptions { diff --git a/scripts/install.as.tpl.ps1 b/scripts/install.as.tpl.ps1 new file mode 100644 index 00000000..ad933ddc --- /dev/null +++ b/scripts/install.as.tpl.ps1 @@ -0,0 +1,2 @@ +dotnet new uninstall ../ +dotnet new --install ../ \ No newline at end of file diff --git a/rename.csx b/scripts/rename.csx similarity index 81% rename from rename.csx rename to scripts/rename.csx index c71e1ec1..825e62b4 100644 --- a/rename.csx +++ b/scripts/rename.csx @@ -5,7 +5,7 @@ Console.WriteLine("请输入原始名称(NetAdmin):"); var oldName = Console.ReadLine().NullOrEmpty("NetAdmin"); Console.WriteLine("请输入替换名称:"); var newName = Console.ReadLine(); -foreach (var path in Directory.EnumerateDirectories("./", $"*{oldName}*", +foreach (var path in Directory.EnumerateDirectories("../", $"*{oldName}*", SearchOption.AllDirectories)) { Console.Write($"{path} --> "); @@ -16,7 +16,7 @@ foreach (var path in Directory.EnumerateDirectories("./", $"*{oldName}*", Console.WriteLine(); -foreach (var path in Directory.EnumerateFiles("./", $"*.*", SearchOption.AllDirectories)) +foreach (var path in Directory.EnumerateFiles("../", $"*.*", SearchOption.AllDirectories)) { File.WriteAllText(path, File.ReadAllText(path).Replace(oldName, newName)); var newPath = path.Replace(oldName, newName); diff --git a/switcher.freesql.json b/scripts/switcher.freesql.json similarity index 72% rename from switcher.freesql.json rename to scripts/switcher.freesql.json index 1ceb6d43..1218c50e 100644 --- a/switcher.freesql.json +++ b/scripts/switcher.freesql.json @@ -1,8 +1,8 @@ { "solution": "NetAdmin.sln", "mappings": { - "FreeSql.NS": "./refs/FreeSql/FreeSql/FreeSql.csproj", - "FreeSql.DbContext.NS": "./refs/FreeSql/FreeSql.DbContext/FreeSql.DbContext.csproj" + "FreeSql.NS": "../refs/FreeSql/FreeSql/FreeSql.csproj", + "FreeSql.DbContext.NS": "../refs/FreeSql/FreeSql.DbContext/FreeSql.DbContext.csproj" }, "restore": [ { diff --git a/switcher.furion.json b/scripts/switcher.furion.json similarity index 75% rename from switcher.furion.json rename to scripts/switcher.furion.json index 4b74a75f..f71b8024 100644 --- a/switcher.furion.json +++ b/scripts/switcher.furion.json @@ -1,7 +1,7 @@ { "solution": "NetAdmin.sln", "mappings": { - "Furion.Pure.NS": "./refs/Furion/framework/Furion.Pure/Furion.Pure.csproj" + "Furion.Pure.NS": "../refs/Furion/framework/Furion.Pure/Furion.Pure.csproj" }, "restore": [ { diff --git a/switcher.nsext.json b/scripts/switcher.nsext.json similarity index 81% rename from switcher.nsext.json rename to scripts/switcher.nsext.json index 137b870f..e456c0c0 100644 --- a/switcher.nsext.json +++ b/scripts/switcher.nsext.json @@ -1,7 +1,7 @@ { "solution": "NetAdmin.sln", "mappings": { - "NSExt": "./refs/ns-ext/src/NSExt/NSExt.csproj" + "NSExt": "../refs/ns-ext/src/NSExt/NSExt.csproj" }, "restore": [ { diff --git a/switcher.ps1 b/scripts/switcher.ps1 similarity index 93% rename from switcher.ps1 rename to scripts/switcher.ps1 index 54200367..1d569c04 100644 --- a/switcher.ps1 +++ b/scripts/switcher.ps1 @@ -23,5 +23,5 @@ while ($null -eq $files[[int]$file - 1]) } $file = [int]$file - 1 Copy-Item $files[$file] 'switcher.json' -Force -dotnet dnt $targets[$key] +dotnet dnt $targets[$key] ../NetAdmin.sln Remove-Item switcher.json \ No newline at end of file diff --git a/sync.sln.files.csx b/scripts/sync.sln.files.csx similarity index 60% rename from sync.sln.files.csx rename to scripts/sync.sln.files.csx index 3823142a..4e7c3d6b 100644 --- a/sync.sln.files.csx +++ b/scripts/sync.sln.files.csx @@ -1,6 +1,6 @@ using System.Text.RegularExpressions; -var slnFile = Directory.GetFiles(@"./", "*.sln").First(); +var slnFile = Directory.GetFiles(@"../", "*.sln").First(); var content = File.ReadAllText(slnFile); content = Regex.Replace( @@ -10,7 +10,7 @@ content = Regex.Replace( Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0CAC-4828-A807-34A693F73859}" {{'\t'}}ProjectSection(SolutionItems) = preProject {{string.Join('\n', - Directory.GetFiles(@"./", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user")) + Directory.GetFiles(@"../", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user")) .Select(x=>$"\t\t{Path.GetFileName(x)} = {Path.GetFileName(x)}") )}} {{'\t'}}EndProject @@ -24,12 +24,26 @@ content = Regex.Replace( Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}" {{'\t'}}ProjectSection(SolutionItems) = preProject {{string.Join('\n', - Directory.GetFiles(@"./.github/workflows", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user")) + Directory.GetFiles(@"../.github/workflows", "*") .Select(x=>$"\t\t{Path.GetFileName(x)} = .github/workflows/{Path.GetFileName(x)}") )}} {{'\t'}}EndProject """ ); +content = Regex.Replace( + content, + "Project\\(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\"\\) = \"scripts\", \"scripts\", \"{BB0B25C9-0901-4923-913F-00F9A6B352A5}\"(?:.|\n)*?EndProject", + $$""" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{BB0B25C9-0901-4923-913F-00F9A6B352A5}" +{{'\t'}}ProjectSection(SolutionItems) = preProject +{{string.Join('\n', + Directory.GetFiles(@"../scripts", "*") + .Select(x=>$"\t\t{Path.GetFileName(x)} = scripts/{Path.GetFileName(x)}") + )}} +{{'\t'}}EndProject +""" +); + Console.WriteLine(content); File.WriteAllText(slnFile, content); \ No newline at end of file