Skip to content

Commit 83f5449

Browse files
Add husky and csharpier to format on pre-commit
1 parent 574b25a commit 83f5449

File tree

5 files changed

+99
-42
lines changed

5 files changed

+99
-42
lines changed

.config/dotnet-tools.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"husky": {
6+
"version": "0.6.2",
7+
"commands": [
8+
"husky"
9+
]
10+
},
11+
"csharpier": {
12+
"version": "0.25.0",
13+
"commands": [
14+
"dotnet-csharpier"
15+
]
16+
}
17+
}
18+
}

.husky/pre-commit

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
## husky task runner examples -------------------
5+
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
6+
7+
## run all tasks
8+
#husky run
9+
10+
### run all tasks with group: 'group-name'
11+
#husky run --group group-name
12+
13+
## run task with name: 'task-name'
14+
#husky run --name task-name
15+
16+
## pass hook arguments to task
17+
#husky run --args "$1" "$2"
18+
19+
## or put your custom commands -------------------
20+
#echo 'Husky.Net is awesome!'
21+
22+
dotnet husky run --name format

.husky/task-runner.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"tasks": [
3+
{
4+
"name": "format",
5+
"command": "dotnet",
6+
"args": [ "csharpier", "${staged}" ],
7+
"include": [ "**/*.cs" ]
8+
}
9+
]
10+
}
Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net7.0</TargetFramework>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
<Nullable>enable</Nullable>
6+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
7+
<Description>SQLite Package of SharpEngine - 2D Game Engine</Description>
8+
<PackageProjectUrl />
9+
<Authors>LavaPower</Authors>
10+
<Company>LavaPower</Company>
11+
<Copyright>Copyright (c) LavaPower 2021-2023</Copyright>
12+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
13+
<PackageProjectUrl>https://github.com/SharpEngine/SharpEngine.SQLite</PackageProjectUrl>
14+
<PackageVersion>1.0.0</PackageVersion>
15+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
16+
<PackageReadmeFile>README.md</PackageReadmeFile>
17+
<EnablePackageValisation>true</EnablePackageValisation>
18+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
19+
<RepositoryUrl>https://github.com/SharpEngine/SharpEngine.SQLite</RepositoryUrl>
20+
<RepositoryType>git</RepositoryType>
21+
<PackageTags>SQLite,SharpEngine,Game,Engine</PackageTags>
22+
</PropertyGroup>
23+
<ItemGroup>
24+
<None Include="../CHANGELOG.md" Pack="true" PackagePath="\" />
25+
<None Include="../README.md" Pack="true" PackagePath="\" />
26+
</ItemGroup>
27+
<ItemGroup>
28+
<PackageReference Include="SharpEngine.Core" Version="1.1.2" />
29+
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
30+
</ItemGroup>
231

3-
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
8-
<Description>SQLite Package of SharpEngine - 2D Game Engine</Description>
9-
<PackageProjectUrl />
10-
<Authors>LavaPower</Authors>
11-
<Company>LavaPower</Company>
12-
<Copyright>Copyright (c) LavaPower 2021-2023</Copyright>
13-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
14-
<PackageProjectUrl>https://github.com/SharpEngine/SharpEngine.SQLite</PackageProjectUrl>
15-
<PackageVersion>1.0.0</PackageVersion>
16-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
17-
<PackageReadmeFile>README.md</PackageReadmeFile>
18-
<EnablePackageValisation>true</EnablePackageValisation>
19-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
20-
<RepositoryUrl>https://github.com/SharpEngine/SharpEngine.SQLite</RepositoryUrl>
21-
<RepositoryType>git</RepositoryType>
22-
<PackageTags>SQLite,SharpEngine,Game,Engine</PackageTags>
23-
</PropertyGroup>
24-
25-
<ItemGroup>
26-
<None Include="../CHANGELOG.md" Pack="true" PackagePath="\" />
27-
<None Include="../README.md" Pack="true" PackagePath="\" />
28-
</ItemGroup>
29-
30-
<ItemGroup>
31-
<PackageReference Include="SharpEngine.Core" Version="1.1.2" />
32-
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
33-
</ItemGroup>
34-
</Project>
32+
<!-- set HUSKY to 0 in CI\/CD disable this -->
33+
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
34+
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
35+
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".." />
36+
</Target>
37+
</Project>

Testing/Testing.csproj

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
28

3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<Nullable>enable</Nullable>
8-
</PropertyGroup>
9-
10-
</Project>
9+
<!-- set HUSKY to 0 in CI\/CD disable this -->
10+
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
11+
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
12+
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".." />
13+
</Target>
14+
</Project>

0 commit comments

Comments
 (0)