-
Notifications
You must be signed in to change notification settings - Fork 17
/
justfile
143 lines (125 loc) · 3.56 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# List all available commands
_default:
@just --list
@install:
uv sync
# Install dependencies
@bootstrap:
uv sync
@clean:
rm -rf .venv
# Run sphinx autobuild
@docs-serve:
uv sync --group docs
uv run docs:sphinx-autobuild docs docs/_build/html --port 8002
# Generate demo project
generate-demo *OVERWRITE:
#!/usr/bin/env bash
set -euo pipefail
[[ "{{ OVERWRITE }}" == "--overwrite" ]] && rm -rf demo/myjourney
[[ -d demo/myjourney ]] && { echo "Directory demo/myjourney already exists. Use --overwrite to recreate it."; exit 0; }
uv run falco start-project myjourney demo -b blueprints/tailwind
cd demo/myjourney
just bootstrap
just falco start-app entries
cp ../../docs/_static/snippets/entry_model.py myjourney/entries/models.py
just mm && just migrate
just falco crud entries.entry --skip-git-check
# Generate documents assets
generate-docs-assets: generate-demo
just tree
cp demo/myjourney/myjourney/entries/urls.py docs/_static/snippets/urls.py
# Generate project tree files
tree: generate-demo
#!/usr/bin/env bash
set -euo pipefail
levels=(1 2 3)
SED_CMD=$( [[ "$OSTYPE" == "darwin"* ]] && echo "sed -i ''" || echo "sed -i" )
for level in "${levels[@]}"; do
tree "demo/myjourney" -L $level --dirsfirst -o tree.txt --noreport -a -n -v -I '.env|requirements*|__pycache__|entries'
$SED_CMD 's|{{{{ cookiecutter.project_name }}|demo|g' tree.txt
$SED_CMD 's|demo/myjourney|myjourney|g' tree.txt
mv tree.txt docs/_static/snippets/tree-$level.txt
done
rm -f tree.txt\'\'
@test:
uv run pytest
# Run all formatters
@fmt:
just --fmt --unstable
uvx ruff format
uv run pyproject-fmt pyproject.toml
uv run pre-commit run reorder-python-imports -a
# Bump project version and update changelog
@bumpver version:
uvx bump-my-version bump {{ version }}
git push
git push --tags
# ----------------------------------------------------------------------
# Blueprints
# ----------------------------------------------------------------------
# Initialze / update submodules
submodule-init:
git submodule update --init --recursive
# Checkout all submodules on main
checkout:
#!/usr/bin/env sh
for parent_dir in blueprints; do
for dir in $parent_dir/*; do
if [ -d "$dir" ]; then
echo "$(basename $dir)"
cd "$dir"
git checkout main
cd -
fi
done
done
# Run git pull in all submodules
pull:
#!/usr/bin/env sh
git pull
for parent_dir in blueprints; do
for dir in $parent_dir/*; do
if [ -d "$dir" ]; then
echo "$(basename $dir)"
cd "$dir"
git pull
cd -
fi
done
done
# Run git fetch in all submodules
fetch:
#!/usr/bin/env sh
git fetch --all
for parent_dir in blueprints; do
for dir in $parent_dir/*; do
if [ -d "$dir" ]; then
echo "$(basename $dir)"
cd "$dir"
git fetch --all
cd -
fi
done
done
# Set the upstream remote for alternative blueprints
set-remote:
cd blueprints/bootstrap
git remote add upstream "git@github.com:Tobi-De/falco_tailwind.git"
# Merge change from the upstream in all blueprints
merge:
cd blueprints/bootstrap
git fetch upstream
git merge upstream/main
# Push all changes in all submodules
push:
#!/usr/bin/env sh
for dir in blueprints/*; do
if [ -d "$dir" ]; then
echo "$(basename $dir)"
cd "$dir"
git pull
git push
cd -
fi
done