WebUI/Makefile
Theta-Dev 4a59767044
All checks were successful
continuous-integration/drone/push Build is passing
fix makefile build name
2022-02-07 00:12:55 +01:00

47 lines
1.3 KiB
Makefile

SRC_DIR=./src
UI_DIR=./ui
PROTO_FILE=./proto/tsgrain.proto
APIDOC_FILE=./src/server/swagger/swagger.yaml
VER=$(or ${VERSION},$(shell git tag --sort=-version:refname | head -n 1))
setup:
cd ${UI_DIR} && pnpm install
test:
go test -v ./src/...
lint:
golangci-lint run
cd ${UI_DIR} && npm run format && npm run lint
build-ui:
cd ${UI_DIR} && pnpm run build
build-server:
go build -tags prod -ldflags "-s -w -X code.thetadev.de/TSGRain/WebUI/src/util.version=${VER}" -o build/tsgrainWebUI ./src/.
build: build-ui build-server
# Protobuf-API-Definition herunterladen und Code generieren
download-proto:
wget "https://code.thetadev.de/TSGRain/Controller/raw/branch/main/proto/tsgrain.proto" -O ${PROTO_FILE}
echo 'option go_package = "code.thetadev.de/TSGRain/WebUI/src/tsgrain_rpc";' >> ${PROTO_FILE}
protoc:
protoc --go_out ${SRC_DIR}/tsgrain_rpc --go_opt=paths=source_relative \
--go-grpc_out ${SRC_DIR}/tsgrain_rpc --go-grpc_opt=paths=source_relative \
${PROTO_FILE}
generate-apidoc:
SWAGGER_GENERATE_EXTENSION=false swagger generate spec --scan-models -o ${APIDOC_FILE}
swagger validate ${APIDOC_FILE}
generate-apiclient:
openapi-generator generate -i ${APIDOC_FILE} -g typescript-axios -o ${UI_DIR}/src/tsgrain-client -p "supportsES6=true"
cd ${UI_DIR} && npm run format
clean:
rm -f build/*
rm -rf ${UI_DIR}/dist/**