* refactor(api): refactor HTTP API to version 2 * refactor: remove forced site_origin check * refactor: update http client * fix * add more api description and error code * reduce nestings in response structures * separate unread * refactor(api/comments): get comments * refactor: frontend api module * chore: remove vite temporary file * chore: restore swagger file * update * 移除为管理员分配站点名的站点隔离功能,简化实现 * refactor pagesAllFetch * fix ci * remove useless codes * limiter protected paths * add test for version endpoint * rename handler code files * code file separate * fix some bug of interacting with backend * add fetch error class for handling * fix and rename * refactor: checker support both `Promise` and callback fn * fix new checker captcha iframe url * rename and add swagger id field * replace tab with spaces in go comment * chore: refine * complete the validate tag for request fields and enable `--defaultRequired` 90% of the request fields of our API are required,100% of response fields in our API are required. Each field add validate:"required" is easy to miss. * replace original api client with auto-generated codes * artalk pkg apply new api client * artalk-sidebar pkg apply new api client * fix issues * fix sidebar locale conf and refactor user login * fix and refactor captcha and limiter * fix ui testing * add script to build http client by swagger.json
69 lines
1.6 KiB
Makefile
69 lines
1.6 KiB
Makefile
PKG_NAME := github.com/ArtalkJS/Artalk
|
|
BIN_NAME := ./bin/artalk
|
|
VERSION ?= $(shell git describe --tags --abbrev=0)
|
|
COMMIT_HASH ?= $(shell git rev-parse --short HEAD)
|
|
|
|
HAS_RICHGO := $(shell which richgo)
|
|
GOTEST ?= $(if $(HAS_RICHGO), richgo test, go test)
|
|
ARGS ?= server
|
|
|
|
all: install build
|
|
|
|
install:
|
|
go mod tidy
|
|
|
|
build:
|
|
go build \
|
|
-ldflags "-s -w -X $(PKG_NAME)/internal/config.Version=$(VERSION) \
|
|
-X $(PKG_NAME)/internal/config.CommitHash=$(COMMIT_HASH)" \
|
|
-o $(BIN_NAME) \
|
|
$(PKG_NAME)
|
|
|
|
build-frontend:
|
|
./scripts/build-frontend.sh
|
|
|
|
run: all
|
|
$(BIN_NAME) $(ARGS)
|
|
|
|
build-debug:
|
|
@echo "Building Artalk $(VERSION) for debugging..."
|
|
@go build \
|
|
-ldflags "-X $(PKG_NAME)/internal/config.Version=$(VERSION) \
|
|
-X $(PKG_NAME)/internal/config.CommitHash=$(COMMIT_HASH)" \
|
|
-gcflags "all=-N -l" \
|
|
-o $(BIN_NAME) \
|
|
$(PKG_NAME)
|
|
|
|
dev: build-debug
|
|
$(BIN_NAME) $(ARGS)
|
|
|
|
test:
|
|
$(GOTEST) -timeout 20m ./internal/...
|
|
|
|
test-coverage:
|
|
$(GOTEST) -cover ./...
|
|
|
|
test-coverage-html:
|
|
$(GOTEST) -v -coverprofile=coverage.out ./...
|
|
go tool cover -html=coverage.out
|
|
|
|
update-i18n:
|
|
go generate ./internal/i18n
|
|
|
|
update-swagger:
|
|
go install github.com/swaggo/swag/cmd/swag@latest
|
|
swag init -g server/server.go --output ./docs/swagger --requiredByDefault
|
|
|
|
docker-build:
|
|
./scripts/docker-build.sh
|
|
|
|
docker-push:
|
|
./scripts/docker-build.sh --push
|
|
|
|
test-frontend-e2e:
|
|
./scripts/frontend-e2e-test.sh $(if $(REPORT), --show-report)
|
|
|
|
.PHONY: all install build build-frontend build-debug \
|
|
dev test test-coverage test-coverage-html update-i18n \
|
|
docker-build docker-push test-frontend-e2e;
|