Skip to content

Commit 7ae1faa

Browse files
committed
Husky for precommit
1 parent d963ed0 commit 7ae1faa

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

.config/dotnet-tools.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
"version": "0.30.6",
77
"commands": ["dotnet-csharpier"],
88
"rollForward": false
9+
},
10+
"husky": {
11+
"version": "0.7.2",
12+
"commands": ["husky"],
13+
"rollForward": false
914
}
1015
}
1116
}

.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

.husky/task-runner.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
3+
"tasks": [
4+
{
5+
"name": "Run csharpier",
6+
"command": "dotnet",
7+
"args": ["csharpier", "${staged}"],
8+
"include": ["**/*.cs"]
9+
}
10+
]
11+
}

src/AppStoreServerLibrary.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<TargetFramework>net8.0</TargetFramework>
54
<ImplicitUsings>enable</ImplicitUsings>
@@ -20,14 +19,15 @@
2019
<AssemblyName>Mimo.AppStoreServerLibrary</AssemblyName>
2120
<RootNamespace>Mimo.AppStoreServerLibrary</RootNamespace>
2221
</PropertyGroup>
23-
2422
<ItemGroup>
2523
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.0.1" />
2624
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.0.1" />
2725
</ItemGroup>
28-
2926
<ItemGroup>
3027
<None Include="..\README.md" Pack="true" PackagePath="\" />
3128
</ItemGroup>
32-
29+
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
30+
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
31+
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".." />
32+
</Target>
3333
</Project>

0 commit comments

Comments
 (0)