generated from companieshouse/node-review-web-starter-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (48 loc) · 1.08 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
51
52
53
54
55
56
57
58
59
artifact_name := acsp-web
version := "unversioned"
.PHONY: all
all: build
.PHONY: clean
clean:
rm -f ./$(artifact_name)-*.zip
rm -rf ./build-*
rm -rf ./dist
rm -f ./build.log
package-install:
npm install
.PHONY: build
build:
npm ci
npm run build
.PHONY: lint
lint:
npm run lint
.PHONY: sonar
sonar: test
npm run sonarqube
.PHONY: test-unit
test-unit:
npm run test:coverage
.PHONY: test
test: test-unit
.PHONY: security-check
security-check:
npm audit --audit-level=high
.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 ./assets $(tmpdir)
cp -r ./locales $(tmpdir)
cp -r ./package.json $(tmpdir)
cp -r ./package-lock.json $(tmpdir)
cd $(tmpdir) && npm install --production && npm update
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