include node.mk
.PHONY: all test build lint format
SHELL := /bin/bash

TS_FILES := $(shell find . -name "*.ts" -not -path "./node_modules/*" -not -name "*.d.ts")

all: test build

format:
	@./node_modules/.bin/prettier --write $(TS_FILES)

lint:
	@echo "Running eslint"
	@./node_modules/.bin/eslint $(TS_FILES)
	@echo "Running prettier"
	@./node_modules/.bin/prettier -l $(TS_FILES) || \
		(echo "**** Prettier errors in the above files! Run 'make format' to fix! ****" && false)

test: lint
	@echo "Testing..."
	@./node_modules/.bin/jest

build:
	@echo "Building..."
	@rm -rf dist
	@./node_modules/.bin/tsc --declaration
