-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjustfile
executable file
·42 lines (36 loc) · 1.11 KB
/
justfile
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
#!/usr/bin/env just --justfile
# Variables
db_path := "./database/events.db"
migrations_dir := "database/migrations"
css_input := "ui/assets/input.css"
css_output := "ui/static/css/main.css"
dev_port := "4000"
browser_sync_port := "4001"
# Update Go dependencies
update:
go get -u
go mod tidy -v
# Run development server with live reload
dev:
air & \
tailwindcss -i {{css_input}} -o {{css_output}} --watch & \
browser-sync start \
--files 'ui/html/**/*.tmpl, ui/static/**/*.css' \
--port {{browser_sync_port}} \
--proxy 'localhost:{{dev_port}}' \
--no-notify \
--no-open \
--no-ghost-mode \
--middleware 'function(req, res, next) { \
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); \
return next(); \
}'
# Build production CSS
build:
tailwindcss -i {{css_input}} -o {{css_output}} --minify
# Run database migrations
migrate command="up":
goose sqlite3 {{db_path}} {{command}} --dir={{migrations_dir}}
# Create new migration
makemigrations name:
goose sqlite3 {{db_path}} create {{name}} sql --dir={{migrations_dir}}