Debian Codegraph @

Makefile

raw
1
2 all:
3 npm install
4
5 .PHONY: test
6 test:
7 npm test
8
9 .PHONY: distclean
10 distclean: clean
11 rm -rf node_modules
12
13 .PHONY: clean
14 clean:
15 rm -f dashdash-*.tgz
16
17 # Run just the lint-y parts of eslint (i.e. not "prettier" formatting).
18 .PHONY: lint
19 lint:
20 npm run lint
21
22 .PHONY: fmt
23 fmt:
24 npm run fmt
25
26 .PHONY: check
27 check:: check-eslint check-version
28 @echo "Check ok."
29
30 .PHONY: check-eslint
31 check-eslint:
32 npm run check
33
34 # Ensure CHANGES.md and package.json have the same version.
35 .PHONY: check-version
36 check-version:
37 @echo version is: $(shell cat package.json | json version)
38 [[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]]
39
40 .PHONY: cutarelease
41 cutarelease: check-version
42 [[ -z `git status --short` ]] # If this fails, the working dir is dirty.
43 @which json 2>/dev/null 1>/dev/null && \
44 ver=$(shell json -f package.json version) && \
45 name=$(shell json -f package.json name) && \
46 publishedVer=$(shell npm view -j $(shell json -f package.json name)@$(shell json -f package.json version) version 2>/dev/null) && \
47 if [[ -n "$$publishedVer" ]]; then \
48 echo "error: $$name@$$ver is already published to npm"; \
49 exit 1; \
50 fi && \
51 echo "** Are you sure you want to tag and publish $$name@$$ver to npm?" && \
52 echo "** Enter to continue, Ctrl+C to abort." && \
53 read
54 ver=$(shell cat package.json | json version) && \
55 date=$(shell date -u "+%Y-%m-%d") && \
56 git tag -a "v$$ver" -m "version $$ver ($$date)" && \
57 git push origin "v$$ver" && \
58 npm publish