From a87c4536899e59098132857672f6fefd741c0ce0 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 14 Jun 2025 14:19:00 -0700 Subject: [PATCH] Develop (#2) * First commit * Do not publish to GitHub * Update PackegeId * Add write permissions to actions job * Include JSON data files in release * Resolve Copilot review suggestions * Format code * Add Husky.Net --- .config/dotnet-tools.json | 20 ++++++++++++++ .github/workflows/publish-release.yml | 6 ++--- .husky/pre-commit | 4 +++ .husky/task-runner.json | 22 ++++++++++++++++ .vscode/tasks.json | 38 +++++++++++++++++++++++++-- README.md | 2 ++ 6 files changed, 86 insertions(+), 6 deletions(-) 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 0000000..1f0faca --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "csharpier": { + "version": "1.0.2", + "commands": [ + "csharpier" + ], + "rollForward": false + }, + "husky": { + "version": "0.7.2", + "commands": [ + "husky" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 444576e..1002236 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -39,10 +39,8 @@ jobs: - name: Format checks run: | - dotnet new tool-manifest - dotnet tool install csharpier - dotnet tool install dotnet-format - dotnet csharpier check --log-level=information . + dotnet tool restore + dotnet csharpier check --log-level=debug . dotnet format --verify-no-changes --severity=info --verbosity=detailed publish: diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..5cc3c73 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +dotnet husky run diff --git a/.husky/task-runner.json b/.husky/task-runner.json new file mode 100644 index 0000000..97f3e18 --- /dev/null +++ b/.husky/task-runner.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", + "tasks": [ + { + "name": "CSharpier Format", + "command": "csharpier", + "args": ["format", "--log-level=debug", "${staged}"], + "include": ["**/*.cs"] + }, + { + "name": ".Net Format", + "command": "dotnet", + "args": [ + "format", + "--verify-no-changes", + "--severity=info", + "--verbosity=detailed" + ], + "include": ["**/*.cs"] + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 85ced3b..c66bb10 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,7 +2,7 @@ "version": "2.0.0", "tasks": [ { - "label": ".NET Build", + "label": ".Net Build", "type": "dotnet", "task": "build", "group": "build", @@ -13,7 +13,7 @@ } }, { - "label": ".NET Format", + "label": ".Net Format", "type": "process", "command": "dotnet", "args": [ @@ -36,6 +36,7 @@ "command": "csharpier", "args": [ "format", + "--log-level=debug", "." ], "problemMatcher": [ @@ -46,5 +47,38 @@ "clear": false } }, + { + "label": ".Net Tool Update", + "type": "process", + "command": "dotnet", + "args": [ + "tool", + "update", + "--all" + ], + "problemMatcher": [ + "$msCompile" + ], + "presentation": { + "showReuseMessage": false, + "clear": false + } + }, + { + "label": "Husky.Net Run", + "type": "process", + "command": "dotnet", + "args": [ + "husky", + "run" + ], + "problemMatcher": [ + "$msCompile" + ], + "presentation": { + "showReuseMessage": false, + "clear": false + } + }, ] } diff --git a/README.md b/README.md index 3b6e7be..0e615f7 100644 --- a/README.md +++ b/README.md @@ -124,11 +124,13 @@ languageLookup.IsMatch("zh-Hant", "zh-Hans"); // false - [AwesomeAssertions](https://awesomeassertions.org/) - [Bring Your Own Badge](https://github.com/marketplace/actions/bring-your-own-badge) +- [CSharpier](https://csharpier.com/) - [Create Pull Request](https://github.com/marketplace/actions/create-pull-request) - [GH Release](https://github.com/marketplace/actions/gh-release) - [Git Auto Commit](https://github.com/marketplace/actions/git-auto-commit) - [GitHub Actions](https://github.com/actions) - [GitHub Dependabot](https://github.com/dependabot) +- [Husky.Net](https://alirezanet.github.io/Husky.Net/) - [Nerdbank.GitVersioning](https://github.com/marketplace/actions/nerdbank-gitversioning) - [Serilog](https://serilog.net/) - [xUnit.Net](https://xunit.net/)