Tooling update (#184)

* Use a common Makefile/build process

* Use ESLint with the pa11y lint config
This commit is contained in:
Rowan Manning
2017-03-21 13:41:46 +00:00
committed by GitHub
parent e27e129677
commit b24076abf1
39 changed files with 370 additions and 375 deletions

View File

@@ -1,47 +1,27 @@
include Makefile.node
# Color helpers
C_CYAN=\x1b[34;01m
C_RESET=\x1b[0m
# We need to run integration tests recursively
export INTEGRATION_FLAGS := --recursive
# Group targets
all: deps lint test
ci: lint test
# Install dependencies
deps:
@echo "$(C_CYAN)> installing dependencies$(C_RESET)"
@npm install
# Verify tasks
# ------------
# Lint JavaScript
lint: jshint jscs
# Lint alias for backwards compatibility
lint: verify
# Run JSHint
jshint:
@echo "$(C_CYAN)> linting javascript$(C_RESET)"
@./node_modules/.bin/jshint .
# Run JavaScript Code Style
jscs:
@echo "$(C_CYAN)> checking javascript code style$(C_RESET)"
@./node_modules/.bin/jscs .
# Run all tests
test: test-integration
# Run integration tests
test-integration:
@echo "$(C_CYAN)> running integration tests$(C_RESET)"
@./node_modules/.bin/mocha ./test/integration --reporter spec --recursive --timeout 5000 --slow 50
# Client-side asset tasks
# -----------------------
# Compile LESS
less:
@echo "$(C_CYAN)> compiling less$(C_RESET)"
@./node_modules/.bin/lessc -x ./public/less/main.less ./public/css/site.min.css
@lessc -x ./public/less/main.less ./public/css/site.min.css
@$(TASK_DONE)
# Compile client-side JavaScript
uglify:
@echo "$(C_CYAN)> compiling client-side JavaScript$(C_RESET)"
@./node_modules/.bin/uglifyjs \
@uglifyjs \
public/js/vendor/jquery/jquery.min.js \
public/js/vendor/bootstrap/js/alert.js \
public/js/vendor/bootstrap/js/dropdown.js \
@@ -55,5 +35,4 @@ uglify:
public/js/vendor/flot/jquery.flot.resize.js \
public/js/site.js \
-o ./public/js/site.min.js
.PHONY: test
@$(TASK_DONE)