Browse Source

Add husky and pre-commits

pull/109/head
Ionite 1 year ago
parent
commit
3f7c2ae80d
No known key found for this signature in database
  1. 18
      .config/dotnet-tools.json
  2. 22
      .husky/pre-commit
  3. 18
      .husky/task-runner.json
  4. 6
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

18
.config/dotnet-tools.json

@ -0,0 +1,18 @@
{
"version": 1,
"isRoot": true,
"tools": {
"husky": {
"version": "0.6.0",
"commands": [
"husky"
]
},
"xamlstyler.console": {
"version": "3.2206.4",
"commands": [
"xstyler"
]
}
}
}

22
.husky/pre-commit

@ -0,0 +1,22 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
## husky task runner examples -------------------
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
## run all tasks
#husky run
### run all tasks with group: 'group-name'
dotnet husky run --group "pre-commit"
## run task with name: 'task-name'
#husky run --name task-name
## pass hook arguments to task
#husky run --args "$1" "$2"
## or put your custom commands -------------------
#echo 'Husky.Net is awesome!'
#dotnet husky run

18
.husky/task-runner.json

@ -0,0 +1,18 @@
{
"tasks": [
{
"name": "Run csharpier",
"group": "pre-commit",
"command": "dotnet",
"args": [ "csharpier", "${staged}" ],
"include": [ "**/*.cs" ]
},
{
"name": "Run xamlstyler",
"group": "pre-commit",
"command": "dotnet",
"args": [ "xstyler", "${staged}" ],
"include": [ "**/*.axaml" ]
}
]
}

6
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -99,4 +99,10 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<!-- set HUSKY to 0 to disable, or opt-in during CI by setting HUSKY to 1 -->
<Target Name="husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' == 1 Or ('$(HUSKY)' != 0 And '$(CI)' != 'true')">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High"/>
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory="../" />
</Target>
</Project> </Project>

Loading…
Cancel
Save