-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (41 loc) · 1.33 KB
/
Makefile
File metadata and controls
56 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
include node.mk
.PHONY: all test build lint
SHELL := /bin/bash
NODE_VERSION := "v24"
TS_FILES := $(shell find . -name "*.ts" -not -path "./node_modules/*" -not -name "*numbro-polyfill.ts")
FORMATTED_FILES := $(TS_FILES) # Add other file types as you see fit, e.g. JSON files, config files
MODIFIED_FORMATTED_FILES := $(shell git diff --name-only master $(FORMATTED_FILES))
ESLINT := ./node_modules/.bin/eslint
PRETTIER := ./node_modules/.bin/prettier
JEST := ./node_modules/.bin/jest
TSC := ./node_modules/.bin/tsc
.PHONY: test run install_deps build all clean
all: test build
test:
@$(JEST)
clean:
:
format:
@echo "Formatting modified files..."
@$(PRETTIER) --write $(MODIFIED_FORMATTED_FILES)
format-all:
@echo "Formatting all files..."
@$(PRETTIER) --write $(FORMATTED_FILES)
format-check:
@echo "Running format check..."
@$(PRETTIER) --list-different $(FORMATTED_FILES) || \
(echo -e "❌ \033[0;31m Prettier found discrepancies in the above files. Run 'make format' to fix.\033[0m" && false)
lint-es:
@echo "Running eslint..."
@$(ESLINT) $(TS_FILES)
lint-fix:
@echo "Running eslint --fix..."
@$(ESLINT) --fix $(TS_FILES) || \
(echo "\033[0;31mThe above errors require manual fixing.\033[0m" && true)
lint: format-check lint-es
build:
@echo "Building..."
@rm -rf ./dist/
@$(TSC) --declaration
install_deps:
npm install