-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (46 loc) · 1.3 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
DOCKER_REPO := jeffspies/d2d
VERSION := 0.0.1
DOCKER_TAG := $(DOCKER_REPO):$(VERSION)
SRC_DIR := src
SRC_FILES := $(shell find $(SRC_DIR) -type f)
node_modules: package.json
@yarn
@touch node_modules
lib: node_modules $(SRC_DIR) $(SRC_FILES) tsconfig.json
@yarn run clean
@yarn run build
@touch lib
build/checkpoint:
@mkdir -p build/checkpoint
build/checkpoint/docker-build: build/checkpoint lib bin package.json Dockerfile
@docker build -t $(DOCKER_TAG) .
@touch build/checkpoint/docker-build
.PHONY: update-version
update-version:
$(info Updating versions...)
@echo "const version = '$(VERSION)'\nexport default version" > src/version.ts
@npx json -I -f package.json -e 'this.version="$(VERSION)"'
.PHONY: publish
publish: build/checkpoint/docker-build update-version
# git commit with tag
$(info Publishing to NPM...)
# @npm publish
$(info Publishing to Docker...)
@docker push $(DOCKER_TAG)
# docker publish
.PHONY: docker
docker: build/checkpoint/docker-build
$(info Generating templated content...)
@docker run \
--user $(UID):$(GID) \
-v $(PWD)/example/.env:/.env \
-v $(PWD)/example/templates:/input \
-v $(PWD)/example/build/templates:/output \
$(DOCKER_TAG)
.PHONY: run
run: lib
@npm start
.PHONY: clean
clean:
@rm -rf build lib node_modules example/build/templates
.DEFAULT_GOAL := run