Add js lint & building to make file

This commit is contained in:
Jannis Mattheis 2018-03-30 19:02:01 +02:00 committed by Jannis Mattheis
parent a6ff23944d
commit 00d506ba7c
3 changed files with 11 additions and 5 deletions

View File

@ -32,9 +32,8 @@ install:
script: script:
# packr builds a go file for all packr "boxes", this would be f.ex. the spec.json file. # packr builds a go file for all packr "boxes", this would be f.ex. the spec.json file.
- (cd ui && npm run build) - make build-js
- packr - packr
- ui/node_modules/.bin/eslint ui/src
- make test - make test
- make check - make check

View File

@ -4,7 +4,7 @@ DOCKER_DIR=./docker/
SHELL := /bin/bash SHELL := /bin/bash
test: test-coverage test-race test: test-coverage test-race
check: additional-checks check-swagger check: check-go check-swagger check-js
require-version: require-version:
if [ -n ${VERSION} ] && [[ $$VERSION == "v"* ]]; then echo "The version may not start with v" && exit 1; fi if [ -n ${VERSION} ] && [[ $$VERSION == "v"* ]]; then echo "The version may not start with v" && exit 1; fi
@ -23,11 +23,14 @@ test-coverage:
fi \ fi \
done done
additional-checks: check-go:
go vet ./... go vet ./...
gocyclo -over 10 $(shell find . -iname '*.go' -type f | grep -v /vendor/) gocyclo -over 10 $(shell find . -iname '*.go' -type f | grep -v /vendor/)
golint -set_exit_status $(shell go list ./... | grep -v mock) golint -set_exit_status $(shell go list ./... | grep -v mock)
check-js:
(cd ui && npm run lint)
download-tools: download-tools:
go get github.com/golang/lint/golint go get github.com/golang/lint/golint
go get github.com/fzipp/gocyclo go get github.com/fzipp/gocyclo
@ -66,4 +69,7 @@ build-docker: require-version
(cd ${DOCKER_DIR} && docker build -f Dockerfile.arm7 -t gotify/server-arm7:latest -t gotify/server-arm7:${VERSION} .) (cd ${DOCKER_DIR} && docker build -f Dockerfile.arm7 -t gotify/server-arm7:latest -t gotify/server-arm7:${VERSION} .)
rm ${DOCKER_DIR}gotify-app rm ${DOCKER_DIR}gotify-app
.PHONY: test-race test-coverage test additional-checks verify-swagger check download-tools update-swagger package-zip build-docker build-js:
(cd ui && npm run build)
.PHONY: test-race test-coverage test check-go check-js verify-swagger check download-tools update-swagger package-zip build-docker build-js

View File

@ -24,6 +24,7 @@
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test --env=jsdom", "test": "react-scripts test --env=jsdom",
"lint": "eslint src",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
"devDependencies": { "devDependencies": {