From 3f7c2ae80d25ac320525dfb666c6b99236ec0823 Mon Sep 17 00:00:00 2001 From: Ionite Date: Wed, 30 Aug 2023 17:36:49 -0400 Subject: [PATCH] Add husky and pre-commits --- .config/dotnet-tools.json | 18 +++++++++++++++ .husky/pre-commit | 22 +++++++++++++++++++ .husky/task-runner.json | 18 +++++++++++++++ .../StabilityMatrix.Avalonia.csproj | 6 +++++ 4 files changed, 64 insertions(+) create mode 100644 .config/dotnet-tools.json create mode 100644 .husky/pre-commit create mode 100644 .husky/task-runner.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000..b1761c61 --- /dev/null +++ b/.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" + ] + } + } +} \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..92d1a693 --- /dev/null +++ b/.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 diff --git a/.husky/task-runner.json b/.husky/task-runner.json new file mode 100644 index 00000000..8201d1d3 --- /dev/null +++ b/.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" ] + } + ] +} diff --git a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj index 542e5d68..015312c6 100644 --- a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj +++ b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj @@ -99,4 +99,10 @@ Resources.resx + + + + + +