feat: 添加 Avalonia Stack dotnet 模板支持
This commit is contained in:
parent
5cdc7052e0
commit
79fed6cf5d
3
.gitignore
vendored
3
.gitignore
vendored
@ -29,3 +29,6 @@
|
|||||||
/package-output
|
/package-output
|
||||||
/package-scripts/tools
|
/package-scripts/tools
|
||||||
/.vs
|
/.vs
|
||||||
|
/.template-hive
|
||||||
|
/bin
|
||||||
|
/obj
|
||||||
|
|||||||
90
.template.config/template.json
Normal file
90
.template.config/template.json
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/template",
|
||||||
|
"author": "Qiang",
|
||||||
|
"classifications": [
|
||||||
|
"Avalonia",
|
||||||
|
"ASP.NET Core",
|
||||||
|
"Desktop",
|
||||||
|
"Template"
|
||||||
|
],
|
||||||
|
"identity": "Qiang.Avalonia.Stack",
|
||||||
|
"name": "Avalonia Stack",
|
||||||
|
"shortName": "Qiang-avalonia-stack",
|
||||||
|
"preferNameDirectory": true,
|
||||||
|
"forms": {
|
||||||
|
"appendHyphen": {
|
||||||
|
"identifier": "replace",
|
||||||
|
"pattern": "$",
|
||||||
|
"replacement": "-"
|
||||||
|
},
|
||||||
|
"keepOriginalCase": {
|
||||||
|
"identifier": "replace",
|
||||||
|
"pattern": "$",
|
||||||
|
"replacement": ""
|
||||||
|
},
|
||||||
|
"appendUnderscore": {
|
||||||
|
"identifier": "replace",
|
||||||
|
"pattern": "$",
|
||||||
|
"replacement": "_"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"symbols": {
|
||||||
|
"projectFileName": {
|
||||||
|
"type": "derived",
|
||||||
|
"valueSource": "name",
|
||||||
|
"valueTransform": "keepOriginalCase",
|
||||||
|
"fileRename": "Avalonia"
|
||||||
|
},
|
||||||
|
"projectPrefix": {
|
||||||
|
"type": "derived",
|
||||||
|
"valueSource": "name",
|
||||||
|
"valueTransform": "appendHyphen",
|
||||||
|
"replaces": "Avalonia-"
|
||||||
|
},
|
||||||
|
"namespacePrefix": {
|
||||||
|
"type": "derived",
|
||||||
|
"valueSource": "name",
|
||||||
|
"valueTransform": "appendUnderscore",
|
||||||
|
"replaces": "Avalonia_"
|
||||||
|
},
|
||||||
|
"lowerCaseProjectName": {
|
||||||
|
"type": "generated",
|
||||||
|
"generator": "casing",
|
||||||
|
"parameters": {
|
||||||
|
"source": "name",
|
||||||
|
"toLower": true
|
||||||
|
},
|
||||||
|
"fileRename": "avalonia"
|
||||||
|
},
|
||||||
|
"lowerCaseProjectPrefix": {
|
||||||
|
"type": "derived",
|
||||||
|
"valueSource": "lowerCaseProjectName",
|
||||||
|
"valueTransform": "appendHyphen",
|
||||||
|
"replaces": "avalonia-"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"modifiers": [
|
||||||
|
{
|
||||||
|
"exclude": [
|
||||||
|
".git/**",
|
||||||
|
".vs/**",
|
||||||
|
".template-hive/**",
|
||||||
|
".template.config/**",
|
||||||
|
"**/bin/**",
|
||||||
|
"**/.vs/**",
|
||||||
|
"**/logs/**",
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/obj/**",
|
||||||
|
"**/*.user",
|
||||||
|
"README.md",
|
||||||
|
"package-output/**",
|
||||||
|
"package-scripts/tools/**",
|
||||||
|
"Avalonia.Stack.TemplatePack.csproj"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
24
Avalonia.Stack.TemplatePack.csproj
Normal file
24
Avalonia.Stack.TemplatePack.csproj
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
<PackageId>Qiang.Avalonia.Stack.Templates</PackageId>
|
||||||
|
<PackageVersion>1.0.0</PackageVersion>
|
||||||
|
<Title>Qiang Avalonia Stack Templates</Title>
|
||||||
|
<Authors>Qiang</Authors>
|
||||||
|
<Description>Project templates for the Qiang Avalonia Stack.</Description>
|
||||||
|
<PackageTags>dotnet-new;templates;avalonia;aspnetcore</PackageTags>
|
||||||
|
<PackageType>Template</PackageType>
|
||||||
|
<IncludeContentInPack>true</IncludeContentInPack>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<ContentTargetFolders>content</ContentTargetFolders>
|
||||||
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
|
<NoDefaultExcludes>true</NoDefaultExcludes>
|
||||||
|
<NoWarn>$(NoWarn);NU5110;NU5111;NU5128</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="**\*" Exclude=".git\**;.vs\**;.template-hive\**;**\.vs\**;**\bin\**;**\logs\**;**\node_modules\**;**\obj\**;package-output\**;package-scripts\tools\**" />
|
||||||
|
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||||
|
<Compile Remove="**\*" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
32
README.md
32
README.md
@ -0,0 +1,32 @@
|
|||||||
|
# Avalonia Stack
|
||||||
|
|
||||||
|
This repository can be used as a `dotnet new` project template. The template
|
||||||
|
replaces the `Avalonia` prefix in solution files, project files, folder names,
|
||||||
|
project references, C# namespaces, packaging scripts, and frontend names when a
|
||||||
|
new project is created.
|
||||||
|
|
||||||
|
Use a C# namespace friendly project name such as `DemoApp` or `QiChengApp`.
|
||||||
|
Avoid names with `-`, spaces, or a leading digit because the generated name is
|
||||||
|
also used inside C# namespaces.
|
||||||
|
|
||||||
|
## Generate from a local clone
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
dotnet new install .
|
||||||
|
dotnet new Qiang-avalonia-stack -n DemoApp -o ..\DemoApp
|
||||||
|
```
|
||||||
|
|
||||||
|
The generated solution entry point is `DemoApp-Stack.slnx`. Project folders,
|
||||||
|
project files, and generated C# namespaces keep the project name casing from
|
||||||
|
`-n`.
|
||||||
|
|
||||||
|
## Build an installable template package
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
dotnet pack .\Avalonia.Stack.TemplatePack.csproj -c Release
|
||||||
|
dotnet new install .\bin\Release\QiCheng.Avalonia.Stack.Templates.1.0.0.nupkg
|
||||||
|
dotnet new Qiang-avalonia-stack -n DemoApp -o .\DemoApp
|
||||||
|
```
|
||||||
|
|
||||||
|
Publish the generated `.nupkg` to a private or public NuGet feed when you want
|
||||||
|
to create named projects without cloning this template repository first.
|
||||||
Loading…
x
Reference in New Issue
Block a user