forked from projectfluent/fluent.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mk
60 lines (48 loc) · 1.52 KB
/
common.mk
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
57
58
59
60
# This makefile is intended to be included by each package's makefile. The
# paths are relative to the package directory.
ROOT := $(CURDIR)/..
SOURCES := $(wildcard src/*)
VERSION := $(shell node -pe "require('./package.json').version")
export SHELL := /bin/bash
export PATH := $(ROOT)/node_modules/.bin:$(PATH)
# The default target.
all: lint test build
# Used for pre-publishing.
dist: clean lint test build html
lint:
@eslint --config $(ROOT)/eslint_src.json --max-warnings 0 src/
@eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/
@echo -e " $(OK) $@"
test:
ifneq (,$(wildcard ./test/index.js))
@nyc --reporter=text --reporter=html mocha \
--recursive --ui tdd \
--require $(ROOT)/mocha_setup \
--require ./test/index \
test/**/*_test.js
else
@nyc --reporter=text --reporter=html mocha \
--recursive --ui tdd \
--require $(ROOT)/mocha_setup \
test/**/*_test.js
endif
html: $(SOURCES)
@jsdoc -c $(ROOT)/.jsdoc.json -R README.md \
-d $(ROOT)/html/$(PACKAGE) $(SOURCES)
@echo -e " $(OK) $@ built"
deps:
@npm install
@echo -e " $(OK) $@ installed"
depsclean:
@rm -rf node_modules
@echo -e " $(OK) $@"
CHANGELOG.md:
@if [ -z "$(SINCE)" ]; \
then echo 'Specify last version with SINCE=x.y.z' && exit 1; \
fi
@git log $(PACKAGE)@$(SINCE) HEAD --pretty=format:' - (%h) %s' $(CURDIR) \
| cat - <(echo -e "\n\n") CHANGELOG.md \
| sponge CHANGELOG.md
@echo -e " $(OK) $@ updated; make sure to edit it"
.PHONY: test html CHANGELOG.md
OK := \033[32;01m✓\033[0m