-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 1.38 KB
/
Makefile
File metadata and controls
62 lines (47 loc) · 1.38 KB
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
60
61
62
CONTAINER = astro
SOURCE_DIR = ${CURDIR}/site
# The OS environment variable is always defined by windows.
ifdef OS
WriteCmd = <nul set /p=
RemoveCmd = del /Q
RemoveDirCmd = rmdir /Q /S
FixPath = $(subst /,\,$1)
# The set command will return an error, even though it succeeds.
else
WriteCmd = printf
RemoveCmd = rm -rf
RemoveDirCmd = rm -rf
FixPath = $1
endif
serve: up $(SOURCE_DIR)/node_modules
@docker compose exec $(CONTAINER) sh -c "npm run dev"
up:
@docker compose up --detach
down:
@docker compose down
shell:
@docker compose exec $(CONTAINER) bash
version: up
ifndef number
$(error Please define a 'number' that represents the new version)
endif
@docker compose exec $(CONTAINER) sh -c "npm version ${number}"
# @git tag -a v${number}
preview: $(SOURCE_DIR)/dist
@docker compose exec $(CONTAINER) sh -c "npm run preview"
build:
@docker compose build
dist: clean-js-dist $(SOURCE_DIR)/dist
$(SOURCE_DIR)/dist:
@docker compose exec $(CONTAINER) sh -c "npm run build"
$(SOURCE_DIR)/node_modules:
@echo Install JS dependencies. This will take awhile.
@docker compose exec $(CONTAINER) sh -c "npm install"
clean-js-dist:
$(RemoveDirCmd) $(call FixPath,$(SOURCE_DIR)/dist)
clean-js-modules:
$(RemoveDirCmd) $(call FixPath,$(SOURCE_DIR)/node_modules)
clean: clean-js-dist clean-js-modules
.PHONY: serve up down build shell \
clean clean-js-dist clean-js-modules \
.FORCE