twitch-bot/Makefile

77 lines
1.8 KiB
Makefile
Raw Normal View History

DOCS_BASE_URL:=/
HUGO_VERSION:=0.117.0
default: lint frontend_lint test
build_prod: frontend_prod
go build \
-trimpath \
-mod=readonly \
-ldflags "-X main.version=$(shell git describe --tags --always || echo dev)"
lint:
golangci-lint run
2023-07-14 14:15:58 +00:00
publish: frontend_prod
curl -sSLo golang.sh https://raw.githubusercontent.com/Luzifer/github-publish/master/golang.sh
bash golang.sh
test:
go test -cover -v ./...
# --- Editor frontend
2023-07-14 14:15:58 +00:00
frontend_prod: export NODE_ENV=production
frontend_prod: frontend
frontend: node_modules
node ci/build.mjs
frontend_lint: node_modules
./node_modules/.bin/eslint \
--ext .js,.vue \
--fix \
src
node_modules:
npm ci
# --- Tools
update_ua_list:
# User-Agents provided by https://www.useragents.me/
curl -sSf https://www.useragents.me/api | jq -r '.data[].ua' | grep -v 'Trident' >internal/linkcheck/user-agents.txt
# -- Vulnerability scanning --
trivy:
trivy fs . \
--dependency-tree \
--exit-code 1 \
--format table \
--ignore-unfixed \
--quiet \
--scanners config,license,secret,vuln \
--severity HIGH,CRITICAL \
--skip-dirs docs
# -- Documentation Site --
actor_docs:
go run . --storage-conn-string $(shell mktemp).db actor-docs >docs/content/configuration/actors.md
eventclient_docs:
echo -e "---\ntitle: EventClient\nweight: 10000\n---\n" >docs/content/overlays/eventclient.md
docker run --rm -i -v $(CURDIR):$(CURDIR) -w $(CURDIR) node:18-alpine sh -ec 'npx --yes jsdoc-to-markdown --files ./internal/apimodules/overlays/default/eventclient.js' >>docs/content/overlays/eventclient.md
render_docs: hugo_$(HUGO_VERSION)
./hugo_$(HUGO_VERSION) \
--baseURL "$(DOCS_BASE_URL)" \
--cleanDestinationDir \
--gc \
--source docs
hugo_$(HUGO_VERSION):
curl -sSfL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_extended_$(HUGO_VERSION)_linux-amd64.tar.gz | tar -xz hugo
mv hugo $@