-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (50 loc) · 1.79 KB
/
Makefile
File metadata and controls
70 lines (50 loc) · 1.79 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
63
64
65
66
67
68
69
70
# Django + Vite Makefile
# v. 2022.07.13
.PHONY: run runserver vite clean push pull update
.DEFAULT: run
SERVER_URL = $(shell git config --get remote.server.url | sed 's|ssh://||' | cut -d ':' -f 1 | cut -d '/' -f 1)
PROJECT_NAME = $(shell basename $(PWD))
run: install
@echo "run ----------------------------------------------------------------"
${MAKE} -j2 runserver vite
runserver:
uv run python manage.py runserver 0.0.0.0:8000
vite:
bun run dev
install: node_modules/touchfile .venv/touchfile db.sqlite3
node_modules/touchfile: package.json
@echo "install node deps --------------------------------------------------"
bun install
touch $@
@echo "> all node deps installed"
.venv/touchfile: pyproject.toml
@echo "install python deps ------------------------------------------------"
uv sync
touch $@
@echo "> all python deps installed"
db.sqlite3:
@echo "create database ----------------------------------------------------"
uv run python manage.py migrate
@echo "> database created"
push:
@echo "push ---------------------------------------------------------------"
git remote | xargs -I R git push R master
pull:
@echo "pull ---------------------------------------------------------------"
rsync -avz $(SERVER_URL):/srv/data/$(PROJECT_NAME)/db/db.sqlite3 db.sqlite3
rsync -avz $(SERVER_URL):/srv/data/$(PROJECT_NAME)/db.mmdb db.mmdb
rsync -avz $(SERVER_URL):/srv/data/$(PROJECT_NAME)/media/ media
@echo "> all files copied"
update: install
@echo "update -------------------------------------------------------------"
uv lock --upgrade
bun update --latest
@echo "> all deps updated"
clean:
@echo "clean --------------------------------------------------------------"
rm -rf node_modules
rm -rf .venv
rm -rf db.sqlite3
rm -rf db.mmdb
rm -rf media
@echo "> all files removed"