chore: migrate to justfile

main
sudo pacman -Syu 2024-08-22 11:48:03 +07:00
parent 483d0d50d7
commit e29d739baa
4 changed files with 44 additions and 45 deletions

View File

@ -1,45 +0,0 @@
.PHONY: all test test-color coverage coverage-cli coverate-html lint format build clean
all:
go mod tidy
$(MAKE) format
$(MAKE) test-color
$(MAKE) lint
$(MAKE) build
$(MAKE) clean
test:
go test -race -failfast ./...
test-color:
# go install github.com/haunt98/go-test-color@latest
go-test-color -race -failfast ./...
coverage:
go test -coverprofile=coverage.out ./...
coverage-cli:
$(MAKE) coverage
go tool cover -func=coverage.out
coverage-html:
$(MAKE) coverage
go tool cover -html=coverage.out
lint:
golangci-lint run ./...
format:
# go install github.com/haunt98/gofimports/cmd/gofimports@latest
# go install mvdan.cc/gofumpt@latest
# go install mvdan.cc/sh/v3/cmd/shfmt@latest
gofimports -w --company github.com/make-go-great,github.com/haunt98 .
gofumpt -w -extra .
shfmt -w -s -i 4 ./scripts ./data/zsh
build:
$(MAKE) clean
go build ./cmd/dot
clean:
rm -rf dot

View File

@ -430,6 +430,7 @@ require("lazy").setup({
"go",
"javascript",
"json",
"just",
"lua",
"make",
"markdown",
@ -451,6 +452,7 @@ require("lazy").setup({
go = { "gofumpt" },
javascript = { "deno_fmt" },
json = { "deno_fmt" },
just = { "just" },
lua = { "stylua" },
markdown = { "deno_fmt" },
proto = { "buf" },

View File

@ -136,6 +136,11 @@ if command -v fnm &>/dev/null; then
eval "$(fnm env --use-on-cd)"
fi
# https://github.com/casey/just
if command -v just &>/dev/null; then
alias jst="just"
fi
# https://github.com/crate-ci/typos
if command -v typos &>/dev/null; then
alias typo="typos --config ~/.config/typos/typos.toml"

37
justfile Normal file
View File

@ -0,0 +1,37 @@
all: tidy format test-color lint build clean
tidy:
go mod tidy
test:
go test -race -failfast ./...
test-color:
# go install github.com/haunt98/go-test-color@latest
go-test-color -race -failfast ./...
coverage:
go test -coverprofile=coverage.out ./...
coverage-cli: coverage
go tool cover -func=coverage.out
coverage-html: coverage
go tool cover -html=coverage.out
lint:
golangci-lint run ./...
format:
# go install github.com/haunt98/gofimports/cmd/gofimports@latest
# go install mvdan.cc/gofumpt@latest
# go install mvdan.cc/sh/v3/cmd/shfmt@latest
gofimports -w --company github.com/make-go-great,github.com/haunt98 .
gofumpt -w -extra .
shfmt -w -s -i 4 ./scripts ./data/zsh
build:
go build ./cmd/dot
clean:
rm -rf dot