-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
54 lines (45 loc) · 967 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
45
46
47
48
49
50
51
52
53
54
artifact_name := api-sdk-node
version := "unversioned"
.PHONY: clean
clean:
rm -f ./$(artifact_name)-*.zip
rm -rf ./build-*
rm -rf ./dist
rm -f ./build.log
.PHONY: build
build:
npm i
npm run lint
npm run build
.PHONY: lint
lint:
npm run lint
.PHONY: security-check
security-check:
npm audit
.PHONY: test
test:
npm run test
.PHONY: test-unit
test-unit:
npm run test
.PHONY: package
package: build
ifndef version
$(error No version given. Aborting)
endif
$(info Packaging version: $(version))
$(eval tmpdir := $(shell mktemp -d build-XXXXXXXXXX))
cp -r ./dist/* $(tmpdir)
cp -r ./package.json $(tmpdir)
cp -r ./package-lock.json $(tmpdir)
cd $(tmpdir) && npm i --production
rm $(tmpdir)/package.json $(tmpdir)/package-lock.json
cd $(tmpdir) && zip -r ../$(artifact_name)-$(version).zip .
rm -rf $(tmpdir)
.PHONY: dist
dist: lint test-unit clean package
.PHONY: sonar
sonar:
npm run coverage:report
npm run analyse-code