Skip to content

Commit 8677d88

Browse files
committed
Switch task runner
Migrate from task to just
1 parent 89088f8 commit 8677d88

File tree

10 files changed

+147
-253
lines changed

10 files changed

+147
-253
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
**/compose.yml
1717
**/.coverage
1818
**/.dockerignore
19-
**/Taskfile.yml
19+
**/.justfile
2020
docs/
2121
dev/
2222
assets/

Tekst-API/.env.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ TEKST_LOG_LEVEL=debug
44
TEKST_AUTO_MIGRATE=true
55

66
# database (MongoDB)
7-
TEKST_DB__NAME=tekst_testing
7+
TEKST_DB__NAME=tekst_test
88

99
# search server (Elasticsearch)
10-
TEKST_ES__PREFIX=tekst_testing
10+
TEKST_ES__PREFIX=tekst_test
1111

1212
# auth
1313
TEKST_SECURITY__ENABLE_JWT_AUTH=true

Tekst-API/.justfile

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
alias test := tests
2+
3+
# print list of available recipes
4+
list:
5+
@just --list
6+
7+
# print API version
8+
version:
9+
@echo "Test-API version: $(uv run python3 -c "from tekst import __version__ as v; print(v, end='')")"
10+
11+
# install dependencies
12+
install:
13+
uv sync
14+
15+
# format code base, fix linting errors
16+
fix:
17+
uv run ruff format .
18+
uv run ruff check . --fix
19+
20+
# check code formatting and style
21+
check:
22+
uv run ruff format . --check
23+
uv run ruff check . --extend-select N
24+
25+
# run tests
26+
tests ARGS="": install (services-up "test") && (services-down "test")
27+
-TEKST_CUSTOM_ENV_FILE=.env.test uv run pytest {{ARGS}}
28+
29+
# run dev environment
30+
dev: (services-up "dev") && (services-down "dev")
31+
-TEKST_DEV_MODE=true uv run python3 -m tekst bootstrap
32+
@printf "\n\
33+
╭───────────────────────────────────────────────────────╮\n\
34+
│ 🌐 Tekst-Web Dev Server ... http://127.0.0.1 │\n\
35+
│ 🐍 Tekst-API .............. http://127.0.0.1/api │\n\
36+
│ 📖 API Docs ............... http://127.0.0.1/api/docs │\n\
37+
│ 📬 MailPit ................ http://127.0.0.1:8025 │\n\
38+
│ 📂 MongoExpress ........... http://127.0.0.1:8081 │\n\
39+
╰───────────────────────────────────────────────────────╯\n\
40+
\n\
41+
"
42+
-TEKST_DEV_MODE=true uv run fastapi dev tekst/app.py
43+
44+
# export OpenAPI schema to openapi.json
45+
schema:
46+
TEKST_DEV_MODE=true TEKST_LOG_LEVEL=warning uv run python3 -m tekst schema -f
47+
48+
# run full pre-commit toolchain
49+
all:
50+
just fix
51+
just tests
52+
just check
53+
just schema
54+
55+
# build updated container images in services stack
56+
services-build:
57+
docker compose -f ../dev/compose.yml --profile dev --profile test build
58+
59+
# run services stack
60+
services-up SCOPE="test": gen-smtp-ssl-cert && wait-for-mongodb wait-for-elasticsearch
61+
docker compose -f ../dev/compose.yml --profile {{SCOPE}} -p tekst-{{SCOPE}} up --detach
62+
63+
# kill services stack
64+
services-down SCOPE="test":
65+
docker compose -f ../dev/compose.yml --profile {{SCOPE}} -p tekst-{{SCOPE}} down --volumes
66+
67+
# clean up generated files
68+
cleanup:
69+
uv run ruff clean
70+
rm -rf \
71+
*/**/__pycache__ \
72+
*/**/.pytest_cache \
73+
.ruff_cache \
74+
.coverage \
75+
dist \
76+
htmlcov \
77+
78+
[private]
79+
wait-for-mongodb:
80+
@printf "Waiting for MongoDB service"; sleep 2; printf "\n"
81+
82+
[private]
83+
wait-for-elasticsearch:
84+
@printf "Waiting for Elasticsearch service"; while ! $(curl -f 127.0.0.1:9200 > /dev/null 2>&1); do sleep 1; printf "."; done; printf "\n"
85+
86+
[private]
87+
gen-smtp-ssl-cert:
88+
@cd ../dev/smtp-ssl && ./generate.sh

Tekst-API/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ For general information on Tekst, visit the [Tekst repository](https://github.co
1313
3. Install the project and its dependencies (from the `Tekst-API/` project directory): `uv sync`
1414
4. Run the development environment
1515
- `uv run fastapi dev tekst/app.py` to run the dev server ([...and so on](https://docs.astral.sh/uv/reference/cli/))
16-
- Local development also needs all the services running (MongoDB, Elasticsearch + some optional extras). The easiest way is to use the development compose stack in `../dev/compose.yml`. This also contains a Caddy (web server) that manages routing of requests to the client dev server and the API. See [this](Taskfile.yml) for reference.
17-
5. The project has some *very* convenient tasks configured that can be run with [Task](https://taskfile.dev/) (a task runner). This is optional, but it helps *a lot*. You can install it form [here](https://taskfile.dev/installation/). Tasks can then be run via `task <taskname>`. You'll get a commented overview of the configured tasks if you run `task` without any arguments (or look [here](Taskfile.yml)).
16+
- Local development also needs all the services running (MongoDB, Elasticsearch + some optional extras). The easiest way is to use the development compose stack in `../dev/compose.yml`. This also contains a Caddy (web server) that manages routing of requests to the client dev server and the API. See [this](.justfile) for reference.
17+
5. The project has some _very_ convenient recipes configured that can be run with [just](https://just.systems/man/en/packages.html) (a task runner). This is optional, but it helps _a lot_. Recipes can then be run via `just <recipe name>`. You'll get a commented overview of the configured recipes if you run `just` without any arguments (or look [here](.justfile)).

Tekst-API/Taskfile.yml

Lines changed: 0 additions & 168 deletions
This file was deleted.

Tekst-Web/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ node_modules/
55

66
Dockerfile
77
.dockerignore
8-
Taskfile.yml
8+
.justfile

Tekst-Web/.justfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# print list of available recipes
2+
list:
3+
@just --list
4+
5+
# print web client version
6+
version:
7+
@echo "Test-Web version: $(npx -c 'node -p "process.env.npm_package_version"')"
8+
9+
# install dependencies
10+
install:
11+
npm install
12+
13+
# format code
14+
format:
15+
npm run format
16+
17+
# lint code
18+
lint:
19+
npm run lint
20+
21+
# format and lint code
22+
fix:
23+
npm run format
24+
npm run lint
25+
26+
# run dev server
27+
dev:
28+
-npm run start
29+
30+
# build distribution files
31+
build: install
32+
npm run build
33+
34+
# generate TypeScript types from OpenAPI schema
35+
types:
36+
npm run types
37+
38+
# generate translation assets
39+
translations:
40+
npm run translations
41+
42+
# run full pre-commit toolchain
43+
all:
44+
just fix
45+
npm run build
46+
47+
# visualize bundle
48+
visualize:
49+
npx vite-bundle-visualizer

Tekst-Web/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For general information on Tekst, visit the [Tekst repository](https://github.co
1414
3. You can now use
1515
- `npm run dev` to run the [Vite](https://vitejs.dev/) dev server
1616
- `npm run build` to build the project
17-
- `npm run api-schema` to generate types from the Tekst-API OpenAPI schema
17+
- `npm run types` to generate types from the Tekst-API OpenAPI schema
1818
- `npm run translations` to generate translation modules from the translation files
1919
- [...and so on](package.json)
20-
4. The project has some _very_ convenient tasks configured that can be run with [Task](https://taskfile.dev/) (a task runner). This is optional, but it helps _a lot_. You can install it form [here](https://taskfile.dev/installation/). Tasks can then be run via `task <taskname>`. You'll get a commented overview of the configured tasks if you run `task` without any arguments (or look [here](Taskfile.yml)).
20+
4. The project also has some _very_ convenient recipes configured that can be run with [just](https://just.systems/man/en/packages.html) (a task runner). This is optional, but it helps _a lot_. Recipes can then be run via `just <recipe name>`. You'll get a commented overview of the configured recipes if you run `just` without any arguments (or look [here](.justfile)).

0 commit comments

Comments
 (0)