-
Notifications
You must be signed in to change notification settings - Fork 2
/
justfile
63 lines (51 loc) · 1.72 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
TRUNK_CONFIG_FILE := if os() == "windows" { "Trunk.win.toml" } else { "Trunk.toml" }
TRUNK_RELEASE_CONFIG_FILE := if os() == "windows" { "Trunk-release.win.toml" } else { "Trunk.toml" }
# build in release mode
build:
# build frontend
trunk --config {{TRUNK_RELEASE_CONFIG_FILE}} build
# build backend
cargo build --release --workspace --exclude frontend
# run cargo check
check:
cargo check -p frontend --target wasm32-unknown-unknown
cargo check --workspace --exclude frontend
# run cargo clippy
clippy:
cargo clippy -p frontend --target wasm32-unknown-unknown
cargo clippy --workspace --exclude frontend
# run clippy fix
fix:
cargo clippy -p frontend --fix --target wasm32-unknown-unknown
cargo clippy --workspace --fix --exclude frontend
# build docs. use --open to open in browser
doc *ARGS:
cargo doc -F docbuild {{ ARGS }}
# run frontend devserver. use --open to open a new browser
serve-frontend *ARGS:
trunk --config {{TRUNK_CONFIG_FILE}} serve {{ ARGS }}
# run API server
serve-api *ARGS:
watchexec -r -i "frontend/**" -i "target/**" --exts rs,sql,toml cargo run -p uchat_server {{ ARGS }}
# run both frontend and API server
serve-all:
just serve-frontend &
just serve-api
# set up project dependencies
init:
cargo run -p project-init
cd frontend && npm install
# migration related commands
# apply migrations
db-migrate:
diesel migration run
# test migration
diesel migration redo
psql -d postgres -c 'DROP DATABASE uchat_test;'
# reset the database
db-reset:
diesel database reset
psql -d postgres -c 'DROP DATABASE uchat_test;' || true
# create a new database migration
db-new-migration NAME:
diesel migration generate {{ NAME }}