| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | # https://taskfile.dev
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | version: "3"
 | 
					
						
							|  |  |  | vars:
 | 
					
						
							|  |  |  |   GREETING: Hello, World!
 | 
					
						
							|  |  |  | env:
 | 
					
						
							|  |  |  |   DEFAULT_GROUP: Home
 | 
					
						
							| 
									
										
										
										
											2024-10-28 09:24:30 -05:00
										 |  |  |   DEFAULT_HOUSEHOLD: Family
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |   PRODUCTION: false
 | 
					
						
							|  |  |  |   API_PORT: 9000
 | 
					
						
							|  |  |  |   API_DOCS: True
 | 
					
						
							|  |  |  |   TOKEN_TIME: 256 # hours
 | 
					
						
							|  |  |  |   # mailplit SMTP config
 | 
					
						
							|  |  |  |   # start dev:services to use mailpit
 | 
					
						
							|  |  |  |   SMTP_HOST: localhost
 | 
					
						
							|  |  |  |   SMTP_PORT: 1025
 | 
					
						
							|  |  |  |   SMTP_FROM_NAME: MealieDev
 | 
					
						
							| 
									
										
										
										
											2024-02-10 13:26:24 +01:00
										 |  |  |   SMTP_FROM_EMAIL: mealie@example.com
 | 
					
						
							| 
									
										
										
										
											2024-02-10 13:30:02 +01:00
										 |  |  |   SMTP_AUTH_STRATEGY: NONE
 | 
					
						
							| 
									
										
										
										
											2024-02-13 08:39:21 +00:00
										 |  |  |   BASE_URL: http://localhost:3000
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |   LANG: en-US
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # loads .env file if it exists
 | 
					
						
							|  |  |  | dotenv:
 | 
					
						
							|  |  |  |   - .env
 | 
					
						
							|  |  |  |   - .dev.env
 | 
					
						
							|  |  |  | tasks:
 | 
					
						
							|  |  |  |   docs:gen:
 | 
					
						
							|  |  |  |     desc: runs the API documentation generator
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run python dev/code-generation/gen_docs_api.py
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   docs:
 | 
					
						
							|  |  |  |     desc: runs the documentation server
 | 
					
						
							|  |  |  |     dir: docs
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - docs:gen
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run python -m mkdocs serve
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   setup:ui:
 | 
					
						
							|  |  |  |     desc: setup frontend dependencies
 | 
					
						
							|  |  |  |     dir: frontend
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     run: once
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |     cmds:
 | 
					
						
							|  |  |  |       - yarn install
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     sources:
 | 
					
						
							|  |  |  |       - package.json
 | 
					
						
							|  |  |  |       - yarn.lock
 | 
					
						
							|  |  |  |     generates:
 | 
					
						
							|  |  |  |       - node_modules/**
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   setup:py:
 | 
					
						
							|  |  |  |     desc: setup python dependencies
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     run: once
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry install --with main,dev,postgres
 | 
					
						
							|  |  |  |       - poetry run pre-commit install
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     sources:
 | 
					
						
							|  |  |  |       - poetry.lock
 | 
					
						
							|  |  |  |       - pyproject.toml
 | 
					
						
							|  |  |  |       - .pre-commit-config.yaml
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   setup:
 | 
					
						
							|  |  |  |     desc: setup all dependencies
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - setup:ui
 | 
					
						
							|  |  |  |       - setup:py
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   dev:generate:
 | 
					
						
							|  |  |  |     desc: run code generators
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							| 
									
										
										
										
											2025-07-04 19:00:23 -05:00
										 |  |  |       - poetry run python dev/code-generation/main.py {{ .CLI_ARGS }}
 | 
					
						
							| 
									
										
										
										
											2025-08-15 03:44:45 -05:00
										 |  |  |       - task: docs:gen
 | 
					
						
							| 
									
										
										
										
											2024-04-11 20:36:55 -05:00
										 |  |  |       - task: py:format
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   dev:services:
 | 
					
						
							|  |  |  |     desc: starts postgres and mailpit containers
 | 
					
						
							|  |  |  |     dir: docker
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - docker compose -f docker-compose.dev.yml up
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   dev:clean:
 | 
					
						
							|  |  |  |     desc: cleans up dev environment !! removes all data files !!
 | 
					
						
							|  |  |  |     vars:
 | 
					
						
							|  |  |  |       DEV_DATA: ""
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - rm -r ./dev/data/recipes/
 | 
					
						
							|  |  |  |       - rm -r ./dev/data/users/
 | 
					
						
							|  |  |  |       - rm -f ./dev/data/mealie*.db
 | 
					
						
							| 
									
										
										
										
											2025-09-08 12:23:37 -04:00
										 |  |  |       - rm -f ./dev/data/mealie*.db-shm
 | 
					
						
							|  |  |  |       - rm -f ./dev/data/mealie*.db-wal
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |       - rm -f ./dev/data/mealie.log
 | 
					
						
							|  |  |  |       - rm -f ./dev/data/.secret
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:mypy:
 | 
					
						
							|  |  |  |     desc: runs python type checking
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run mypy mealie
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:test:
 | 
					
						
							|  |  |  |     desc: runs python tests (support args after '--')
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run pytest {{ .CLI_ARGS }}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:format:
 | 
					
						
							|  |  |  |     desc: runs python code formatter
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							| 
									
										
										
										
											2024-04-11 20:36:55 -05:00
										 |  |  |       - poetry run ruff format .
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   py:lint:
 | 
					
						
							|  |  |  |     desc: runs python linter
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							| 
									
										
										
										
											2024-03-09 12:40:08 -06:00
										 |  |  |       - poetry run ruff check mealie
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   py:check:
 | 
					
						
							|  |  |  |     desc: runs all linters, type checkers, and formatters
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - py:format
 | 
					
						
							|  |  |  |       - py:lint
 | 
					
						
							|  |  |  |       - py:mypy
 | 
					
						
							|  |  |  |       - py:test
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:coverage:
 | 
					
						
							|  |  |  |     desc: runs python coverage and generates html report
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run pytest
 | 
					
						
							|  |  |  |       - poetry run coverage report -m
 | 
					
						
							|  |  |  |       - poetry run coveragepy-lcov
 | 
					
						
							|  |  |  |       - poetry run coverage html
 | 
					
						
							|  |  |  |       - open htmlcov/index.html
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |   py:package:copy-frontend:
 | 
					
						
							|  |  |  |     desc: copy the frontend files into the Python package
 | 
					
						
							|  |  |  |     internal: true
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - ui:generate
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - rm -rf mealie/frontend
 | 
					
						
							|  |  |  |       - cp -a frontend/dist mealie/frontend
 | 
					
						
							|  |  |  |     sources:
 | 
					
						
							|  |  |  |       - frontend/dist/**
 | 
					
						
							|  |  |  |     generates:
 | 
					
						
							|  |  |  |       - mealie/frontend/**
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:package:generate-requirements:
 | 
					
						
							|  |  |  |     desc: Generate requirements file to pin all packages, effectively a "pip freeze" before installation begins
 | 
					
						
							|  |  |  |     internal: true
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry export -n --only=main --extras=pgsql --output=dist/requirements.txt
 | 
					
						
							|  |  |  |       # Include mealie in the requirements, hashing the package that was just built to ensure it's the one installed
 | 
					
						
							|  |  |  |       - echo "mealie[pgsql]=={{.MEALIE_VERSION}} \\" >> dist/requirements.txt
 | 
					
						
							|  |  |  |       - poetry run pip hash dist/mealie-{{.MEALIE_VERSION}}-py3-none-any.whl | tail -n1 | tr -d '\n' >> dist/requirements.txt
 | 
					
						
							|  |  |  |       - echo " \\" >> dist/requirements.txt
 | 
					
						
							|  |  |  |       - poetry run pip hash dist/mealie-{{.MEALIE_VERSION}}.tar.gz | tail -n1 >> dist/requirements.txt
 | 
					
						
							|  |  |  |     vars:
 | 
					
						
							|  |  |  |       MEALIE_VERSION:
 | 
					
						
							|  |  |  |          sh: poetry version --short
 | 
					
						
							|  |  |  |     sources:
 | 
					
						
							|  |  |  |       - poetry.lock
 | 
					
						
							|  |  |  |       - pyproject.toml
 | 
					
						
							|  |  |  |       - dist/mealie-*.whl
 | 
					
						
							|  |  |  |       - dist/mealie-*.tar.gz
 | 
					
						
							|  |  |  |     generates:
 | 
					
						
							|  |  |  |       - dist/requirements.txt
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:package:deps-parallel:
 | 
					
						
							|  |  |  |     desc: Run py:package dependencies in parallel
 | 
					
						
							|  |  |  |     internal: true
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - setup:py
 | 
					
						
							|  |  |  |       - py:package:copy-frontend
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:package:deps:
 | 
					
						
							|  |  |  |     desc: Dependencies of py:package, skippable by setting SKIP_PACKAGE_DEPS=true
 | 
					
						
							|  |  |  |     internal: true
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - task: py:package:deps-parallel
 | 
					
						
							|  |  |  |     status:
 | 
					
						
							|  |  |  |       - '{{ .SKIP_PACKAGE_DEPS | default "false"}}'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:package:
 | 
					
						
							|  |  |  |     desc: builds Python packages (sdist and wheel) in top-level dist directory
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - py:package:deps
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry build -n --output=dist
 | 
					
						
							|  |  |  |       - task: py:package:generate-requirements
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |   py:
 | 
					
						
							|  |  |  |     desc: runs the backend server
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run python mealie/app.py
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   py:postgres:
 | 
					
						
							|  |  |  |     desc: runs the backend server configured for containerized postgres
 | 
					
						
							|  |  |  |     env:
 | 
					
						
							|  |  |  |       DB_ENGINE: postgres
 | 
					
						
							|  |  |  |       POSTGRES_USER: mealie
 | 
					
						
							|  |  |  |       POSTGRES_PASSWORD: mealie
 | 
					
						
							|  |  |  |       POSTGRES_SERVER: localhost
 | 
					
						
							|  |  |  |       POSTGRES_PORT: 5432
 | 
					
						
							|  |  |  |       POSTGRES_DB: mealie
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - poetry run python mealie/app.py
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-11 20:36:55 -05:00
										 |  |  |   py:migrate:
 | 
					
						
							| 
									
										
										
										
											2024-07-23 17:43:21 +02:00
										 |  |  |     desc: generates a new database migration file e.g. task py:migrate -- "add new column"
 | 
					
						
							| 
									
										
										
										
											2024-04-11 20:36:55 -05:00
										 |  |  |     cmds:
 | 
					
						
							| 
									
										
										
										
											2024-12-05 02:57:57 +10:00
										 |  |  |       - poetry run alembic --config mealie/alembic/alembic.ini revision --autogenerate -m "{{ .CLI_ARGS }}"
 | 
					
						
							| 
									
										
										
										
											2024-04-11 20:36:55 -05:00
										 |  |  |       - task: py:format
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |   ui:build:
 | 
					
						
							|  |  |  |     desc: builds the frontend in frontend/dist
 | 
					
						
							|  |  |  |     dir: frontend
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - yarn build
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |   ui:generate:
 | 
					
						
							|  |  |  |     desc: generates a static version of the frontend in frontend/dist
 | 
					
						
							|  |  |  |     dir: frontend
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - setup:ui
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - yarn generate
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |   ui:lint:
 | 
					
						
							|  |  |  |     desc: runs the frontend linter
 | 
					
						
							|  |  |  |     dir: frontend
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - yarn lint
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ui:test:
 | 
					
						
							|  |  |  |     desc: runs the frontend tests
 | 
					
						
							|  |  |  |     dir: frontend
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - yarn test
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ui:check:
 | 
					
						
							|  |  |  |     desc: runs all frontend checks
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |       - ui:lint
 | 
					
						
							|  |  |  |       - ui:test
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ui:
 | 
					
						
							|  |  |  |     desc: runs the frontend server
 | 
					
						
							|  |  |  |     dir: frontend
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       - yarn run dev --no-fork
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |   docker:build-from-package:
 | 
					
						
							|  |  |  |     desc: Builds the Docker image from the existing Python package in dist/
 | 
					
						
							|  |  |  |     deps:
 | 
					
						
							|  |  |  |        - py:package
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |        - docker build --tag mealie:dev --file docker/Dockerfile --build-arg COMMIT={{.GIT_COMMIT}} --build-context packages=dist .
 | 
					
						
							|  |  |  |     vars:
 | 
					
						
							|  |  |  |       GIT_COMMIT:
 | 
					
						
							|  |  |  |         sh: git rev-parse HEAD
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-27 12:14:42 -06:00
										 |  |  |   docker:prod:
 | 
					
						
							|  |  |  |     desc: builds and runs the production docker image locally
 | 
					
						
							|  |  |  |     dir: docker
 | 
					
						
							|  |  |  |     cmds:
 | 
					
						
							|  |  |  |       - docker compose -f docker-compose.yml -p mealie up -d --build
 |