build: adding lefthook for hook management
This commit is contained in:
parent
8945aa89dc
commit
8ac6b3b514
12 changed files with 41 additions and 66 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,3 +15,4 @@ node_modules/
|
||||||
coverage
|
coverage
|
||||||
TestResults/
|
TestResults/
|
||||||
tests/artifacts/
|
tests/artifacts/
|
||||||
|
.lefthook*
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
let pkgs = nixpkgs.legacyPackages.${system};
|
let pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in {
|
in {
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = [ pkgs.dotnet-sdk pkgs.nixfmt ];
|
buildInputs = [ pkgs.dotnet-sdk pkgs.lefthook pkgs.convco pkgs.nixfmt ];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
46
lefthook.yml
46
lefthook.yml
|
@ -1,34 +1,12 @@
|
||||||
# EXAMPLE USAGE
|
pre-push:
|
||||||
# Refer for explanation to following link:
|
parallel: true
|
||||||
# https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
|
commands:
|
||||||
#
|
commit-check:
|
||||||
# pre-push:
|
run: convco check -n 30
|
||||||
# commands:
|
|
||||||
# packages-audit:
|
pre-commit:
|
||||||
# tags: frontend security
|
parallel: true
|
||||||
# run: yarn audit
|
commands:
|
||||||
# gems-audit:
|
dotnet-format:
|
||||||
# tags: backend security
|
glob: "*.cs"
|
||||||
# run: bundle audit
|
run: dotnet format
|
||||||
#
|
|
||||||
# pre-commit:
|
|
||||||
# parallel: true
|
|
||||||
# commands:
|
|
||||||
# eslint:
|
|
||||||
# glob: "*.{js,ts}"
|
|
||||||
# run: yarn eslint {staged_files}
|
|
||||||
# rubocop:
|
|
||||||
# tags: backend style
|
|
||||||
# glob: "*.rb"
|
|
||||||
# exclude: "application.rb|routes.rb"
|
|
||||||
# run: bundle exec rubocop --force-exclusion {all_files}
|
|
||||||
# govet:
|
|
||||||
# tags: backend style
|
|
||||||
# files: git ls-files -m
|
|
||||||
# glob: "*.go"
|
|
||||||
# run: go vet {files}
|
|
||||||
# scripts:
|
|
||||||
# "hello.js":
|
|
||||||
# runner: node
|
|
||||||
# "any.go":
|
|
||||||
# runner: go run
|
|
||||||
|
|
23
package.json
23
package.json
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"name": "mfgames-toolbuilder",
|
|
||||||
"version": "2.0.1",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "husky install",
|
|
||||||
"build": "dotnet build",
|
|
||||||
"test": "dotnet test"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@commitlint/cli": "^15.0.0",
|
|
||||||
"@commitlint/config-conventional": "^15.0.0",
|
|
||||||
"@semantic-release/changelog": "^6.0.1",
|
|
||||||
"@semantic-release/git": "^10.0.1",
|
|
||||||
"@semantic-release/gitlab": "^7.0.4",
|
|
||||||
"@semantic-release/npm": "^8.0.3",
|
|
||||||
"commitlint-gitlab-ci": "^0.0.4",
|
|
||||||
"husky": "^7.0.2",
|
|
||||||
"semantic-release": "^18.0.1",
|
|
||||||
"semantic-release-dotnet": "^1.0.0",
|
|
||||||
"semantic-release-nuget": "^1.1.1"
|
|
||||||
}
|
|
||||||
}
|
|
8
scripts/format.sh
Executable file
8
scripts/format.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Normalize our environment.
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
# Format the .NET code
|
||||||
|
dotnet format || exit 1
|
|
@ -2,10 +2,21 @@
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
# Make sure we have .NET installed
|
# Make sure we have .NET installed.
|
||||||
|
|
||||||
if ! which dotnet >& /dev/null
|
if ! which dotnet >& /dev/null
|
||||||
then
|
then
|
||||||
echo "Cannot find 'dotnet' in the path"
|
echo "Cannot find 'dotnet' in the path"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
lefthook install
|
||||||
|
|
||||||
|
# Everything is good.
|
||||||
|
exit 0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using System.CommandLine.Parsing;
|
using System.CommandLine.Parsing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Autofac;
|
using Autofac;
|
||||||
|
|
||||||
using MfGames.ToolBuilder.Services;
|
using MfGames.ToolBuilder.Services;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace SampleTool
|
||||||
{
|
{
|
||||||
this.Handler = this;
|
this.Handler = this;
|
||||||
this.messyOption = new Option<bool>("--messy");
|
this.messyOption = new Option<bool>("--messy");
|
||||||
|
|
||||||
this.AddOption(this.messyOption);
|
this.AddOption(this.messyOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Autofac;
|
using Autofac;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
|
|
||||||
using Autofac;
|
using Autofac;
|
||||||
|
|
||||||
|
|
Reference in a new issue