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
|
||||
TestResults/
|
||||
tests/artifacts/
|
||||
.lefthook*
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
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
|
||||
# Refer for explanation to following link:
|
||||
# https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
|
||||
#
|
||||
# pre-push:
|
||||
# commands:
|
||||
# packages-audit:
|
||||
# tags: frontend security
|
||||
# run: yarn audit
|
||||
# gems-audit:
|
||||
# tags: backend security
|
||||
# run: bundle audit
|
||||
#
|
||||
# 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
|
||||
pre-push:
|
||||
parallel: true
|
||||
commands:
|
||||
commit-check:
|
||||
run: convco check -n 30
|
||||
|
||||
pre-commit:
|
||||
parallel: true
|
||||
commands:
|
||||
dotnet-format:
|
||||
glob: "*.cs"
|
||||
run: dotnet format
|
||||
|
|
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)/..
|
||||
|
||||
# Make sure we have .NET installed
|
||||
|
||||
# Make sure we have .NET installed.
|
||||
if ! which dotnet >& /dev/null
|
||||
then
|
||||
echo "Cannot find 'dotnet' 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
|
||||
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.Parsing;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Autofac;
|
||||
using Autofac;
|
||||
|
||||
using MfGames.ToolBuilder.Services;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace SampleTool
|
|||
{
|
||||
this.Handler = this;
|
||||
this.messyOption = new Option<bool>("--messy");
|
||||
|
||||
|
||||
this.AddOption(this.messyOption);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Autofac;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.CommandLine;
|
||||
using System.CommandLine;
|
||||
|
||||
using Autofac;
|
||||
|
||||
|
|
Reference in a new issue