Skip to content

Commit 2b05b4f

Browse files
Add husky and csharpier to format on pre-commit
1 parent 404249e commit 2b05b4f

File tree

5 files changed

+101
-45
lines changed

5 files changed

+101
-45
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: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net7.0</TargetFramework>
4+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
5+
<Description>Python Package of SharpEngine - 2D Game Engine</Description>
6+
<PackageProjectUrl />
7+
<Authors>LavaPower</Authors>
8+
<Company>LavaPower</Company>
9+
<Copyright>Copyright (c) LavaPower 2021-2023</Copyright>
10+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11+
<PackageProjectUrl>https://github.com/SharpEngine/SharpEngine.Python</PackageProjectUrl>
12+
<PackageVersion>1.0.0</PackageVersion>
13+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
14+
<PackageReadmeFile>README.md</PackageReadmeFile>
15+
<EnablePackageValisation>true</EnablePackageValisation>
16+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
17+
<RepositoryUrl>https://github.com/SharpEngine/SharpEngine.Python</RepositoryUrl>
18+
<RepositoryType>git</RepositoryType>
19+
<PackageTags>Raylib,SharpEngine,Game,Engine</PackageTags>
20+
<Nullable>enable</Nullable>
21+
</PropertyGroup>
22+
<ItemGroup>
23+
<None Include="../CHANGELOG.md" Pack="true" PackagePath="\" />
24+
<None Include="../README.md" Pack="true" PackagePath="\" />
25+
</ItemGroup>
26+
<ItemGroup>
27+
<PackageReference Include="pythonnet" Version="3.0.2" />
28+
<PackageReference Include="SharpEngine.Core" Version="1.4.0" />
29+
</ItemGroup>
230

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

Testing/Testing.csproj

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
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>
8+
<ItemGroup>
9+
<ProjectReference Include="..\SharpEngine.Python\SharpEngine.Python.csproj" />
10+
</ItemGroup>
211

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

0 commit comments

Comments
 (0)