build: adding some automatic formatting on commits

This commit is contained in:
Dylan R. E. Moonfire 2022-04-02 17:30:41 -05:00
parent 8ac6b3b514
commit bf9e40dadd
8 changed files with 55 additions and 39 deletions

View file

@ -103,7 +103,7 @@ tab_width=2
[*.{cs,js,json,jsx,proto,resjson,ts,tsx}] [*.{cs,js,json,jsx,proto,resjson,ts,tsx}]
indent_style=space indent_style=space
indent_size=space indent_size=4
tab_width=4 tab_width=4
[*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}] [*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}]

6
.prettierignore Normal file
View file

@ -0,0 +1,6 @@
*~
flake.*
node_modules/
.direnv/
.config/

View file

@ -1,5 +1,5 @@
{ {
description = "A .NET core library for building tools"; description = "A .NET core library for easily building CLI tools";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
@ -11,7 +11,13 @@
let pkgs = nixpkgs.legacyPackages.${system}; let pkgs = nixpkgs.legacyPackages.${system};
in { in {
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
buildInputs = [ pkgs.dotnet-sdk pkgs.lefthook pkgs.convco pkgs.nixfmt ]; buildInputs = [
pkgs.dotnet-sdk
pkgs.lefthook
pkgs.convco
pkgs.nodePackages.prettier
pkgs.nixfmt
];
}; };
}); });
} }

View file

@ -10,3 +10,7 @@ pre-commit:
dotnet-format: dotnet-format:
glob: "*.cs" glob: "*.cs"
run: dotnet format run: dotnet format
prettier:
run: prettier . --write --loglevel warn
nixfmt:
run: nixfmt flake.nix

View file

@ -1,21 +1,19 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Normalize our environment.
cd $(dirname $0)/.. cd $(dirname $0)/..
# Make sure we have .NET installed. # Make sure we have the needed executables installed.
if ! which dotnet >& /dev/null for e in dotnet lefthook prettier nixfmt
do
if ! which $e >& /dev/null
then then
echo "Cannot find 'dotnet' in the path" echo "Cannot find '$e' in the path"
exit 1
fi
# Make sure we have lefthook.and it is installed.
if ! which lefthook >& /dev/null
then
echo "Cannot find 'lefthook' in the path"
exit 1 exit 1
fi fi
done
# Make sure we have lefthook is installed.
lefthook install lefthook install
# Everything is good. # Everything is good.

View file

@ -1,11 +1,13 @@
mode: MainLine
major-version-bump-message: "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)"
minor-version-bump-message: "^(feat)(\\([\\w\\s-]*\\))?:"
patch-version-bump-message: "^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:"
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{InformationalVersion}'
mode: ContinuousDelivery mode: ContinuousDelivery
increment: Inherit increment: Inherit
continuous-delivery-fallback-tag: ci continuous-delivery-fallback-tag: ci
tag-prefix: '[vV]'
major-version-bump-message: "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)"
minor-version-bump-message: "^(feat)(\\([\\w\\s-]*\\))?:"
patch-version-bump-message: "^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:"
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: "{InformationalVersion}"
tag-prefix: "[vV]"