-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
50 lines (40 loc) · 1.29 KB
/
Makefile
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
#
# Copyright (c) 2018, Joyent, Inc.
#
ESLINT = ./node_modules/.bin/eslint
JSFILES := bin/joyent-repos $(shell find lib -name '*.js')
all $(ESLINT) $(PRETTIER):
npm install
.PHONY: clean
clean:
rm -rf node_modules
.PHONY: check
check:: check-version check-eslint
@echo "Check ok."
.PHONY: check-eslint
check-eslint: | $(ESLINT)
$(ESLINT) $(JSFILES)
# Just lint check (no style)
.PHONY: lint
lint: | $(ESLINT)
$(ESLINT) --rule 'prettier/prettier: off' $(JSFILES)
.PHONY: fmt
fmt: | $(ESLINT)
$(ESLINT) --fix $(JSFILES)
# Ensure CHANGES.md and package.json have the same version.
.PHONY: check-version
check-version:
@echo version is: $(shell cat package.json | json version)
[[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]]
.PHONY: cutarelease
cutarelease: check-version
[[ -z `git status --short` ]] # If this fails, the working dir is dirty.
@which json 2>/dev/null 1>/dev/null && \
ver=$(shell json -f package.json version) && \
echo "** Are you sure you want to tag v$$ver?" && \
echo "** Enter to continue, Ctrl+C to abort." && \
read
ver=$(shell cat package.json | json version) && \
date=$(shell date -u "+%Y-%m-%d") && \
git tag -a "v$$ver" -m "version $$ver ($$date)" && \
git push origin "v$$ver"