-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (31 loc) · 806 Bytes
/
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
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
.ONESHELL:
.PHONY: clean test build dev
build: out/built
test: out/tested
clean:
rm -rf out
dev:
tsc --watch
node_modules: package.json
npm install
out/built: $(shell find src tests) tsconfig.json node_modules Makefile
tsc \
&& touch out/built
out/tested: out/built jest.config.js
jest \
--collectCoverage=true \
--coverageProvider=v8 \
&& touch out/tested
publish: out/tested
if [ ! -z "$$(git status --porcelain)" ]; then
echo "Git not clean!"
exit 1
fi
version=$$(awk '/^\W*"version":/ { print gensub(/\"(.+)\",/, "v\\1", "g", $$2) }' package.json)
tags=$$(git tag -l --points-at=HEAD)
if (echo $$tags | grep $$version); then
echo '//registry.npmjs.org/:_authToken=$${NPM_TOKEN}' > .npmrc
npm publish
fi