-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit replaces the Makefile with a Python CLI tool. The tool manages the project, including building the Docker image, running the app in a container, and running the app locally. The tool also builds the Tailwind CSS stylesheet. The app always runs with hot template reloading enabled. In development mode, it also runs with hot code reloading.
- Loading branch information
1 parent
e0c22bf
commit e3bff79
Showing
15 changed files
with
504 additions
and
23,968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
static/css/main*.css | ||
static/js/tailwind*.js | ||
static/js/typography*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,3 +165,6 @@ package*.json | |
|
||
# IntelliJ project files | ||
.idea/ | ||
|
||
# stylesheet generated by tailwindcss cli | ||
static/css/main-*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,16 +25,48 @@ help: | |
@echo '- dev -- Run the app in development (reload) mode' | ||
@echo '- pre-commit-setup -- Setup the pre-commit environment' | ||
|
||
build-tailwind-css: | ||
@echo "Checking for static/css/tailwind.css..." | ||
if [ -f $PWD/static/css/tailwind.css ]; then \ | ||
echo "File static/css/tailwind.css exists. Exiting."; \ | ||
exit 0; \ | ||
fi; \ | ||
# check if Tailwind CLI is installed | ||
if ! command -v tailwind > /dev/null; then \ | ||
echo "Error: Command `tailwind` (Tailwind CLI) not found."; \ | ||
exit 1; \ | ||
fi; \ | ||
echo "Building Tailwind CSS..."; \ | ||
tailwind --minify \ | ||
-i static/css/main.css \ | ||
-o static/css/tailwind.css | ||
|
||
ensure-tailwind-assets: | ||
# do nothing, when Tailwind CLI has already built `tailwind.css` | ||
if [ -f static/css/tailwind.css ]; then \ | ||
exit 0; \ | ||
fi; \ | ||
# check if `curl` is installed | ||
if ! command -v curl > /dev/null; then \ | ||
echo "Error: curl is not installed."; \ | ||
exit 1; \ | ||
fi; \ | ||
[ -f static/js/tailwind.min.js ] || \ | ||
curl -Lo static/js/tailwind.min.js https://cdn.tailwindcss.com/4.0.0; \ | ||
[ -f static/js/typography.min.js ] || \ | ||
curl -Lo static/js/typography.min.js \ | ||
https://cdn.tailwindcss.com/3.4.16\?plugins\=[email protected] | ||
|
||
.PHONY: run | ||
run: | ||
run: build-tailwind-css | ||
python -c "from capellambse_context_diagrams import install_elk; install_elk()" | ||
MODEL="$$MODEL" TEMPLATES_DIR="$$TEMPLATES_DIR" uvicorn \ | ||
--host=$(HOST) \ | ||
--port=$(PORT) \ | ||
capella_model_explorer.main:app | ||
|
||
.PHONY: dev | ||
dev: | ||
dev: ensure-tailwind-assets | ||
python -c "from capellambse_context_diagrams import install_elk; install_elk()" | ||
MODEL="$$MODEL" TEMPLATES_DIR="$$TEMPLATES_DIR" LIVE=1 uvicorn \ | ||
--host=$(HOST) \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.