chore(development): Add makefile

ref: #252 #248
This commit is contained in:
2024-08-26 15:14:04 +09:30
parent 8edb209d16
commit 3c44561b19
2 changed files with 117 additions and 0 deletions

View File

@ -1,6 +1,76 @@
# Contribution Guide
Development of this project has been setup to be done from VSCodium. The following additional requirements need to be met:
- npm has been installed. _required for `markdown` linting_
`sudo apt install -y --no-install-recommends npm`
- setup of other requirements can be done with `make prepare`
- **ALL** Linting must pass for Merge to be conducted.
_`make lint`_
## TL;DR
from the root of the project to start a test server use:
``` bash
# activate python venv
/tmp/centurion_erp/bin/activate
# enter app dir
cd app
# Start dev server can be viewed at http://127.0.0.1:8002
python manage.py runserver 8002
# Run any migrations, if required
python manage.py migrate
# Create a super suer if required
python manage.py createsuperuser
```
## Makefile
!!! tip "TL;DR"
Common make commands are `make prepare` then `make docs` and `make lint`
Included within the root of the repository is a makefile that can be used during development to check/run different items as is required during development. The following make targets are available:
- `prepare`
_prepare the repository. init's all git submodules and sets up a python virtual env and other make targets_
- `docs`
_builds the docs and places them within a directory called build, which can be viewed within a web browser_
- `lint`
_conducts all required linting_
- `docs-lint`
_lints the markdown documents within the docs directory for formatting errors that MKDocs may/will have an issue with._
- `clean`
_cleans up build artifacts and removes the python virtual environment_
> this doc is yet to receive a re-write
# Old working docs
## Dev Environment
It's advised to setup a python virtual env for development. this can be done with the following commands.

47
makefile Normal file
View File

@ -0,0 +1,47 @@
.ONESHELL:
PATH_VENV := /tmp/centurion_erp
ACTIVATE_VENV :=. ${PATH_VENV}/bin/activate
.PHONY: clean prepare docs ansible-lint lint
prepare:
git submodule update --init;
git submodule foreach git submodule update --init;
python3 -m venv ${PATH_VENV};
${ACTIVATE_VENV};
pip install -r website-template/gitlab-ci/mkdocs/requirements.txt;
pip install -r gitlab-ci/lint/requirements.txt;
pip install -r requirements.txt;
pip install -r requirements_test.txt;
npm install markdownlint-cli2;
npm install markdownlint-cli2-formatter-junit;
cp -f "website-template/.markdownlint.json" ".markdownlint.json";
cp -f "gitlab-ci/lint/.markdownlint-cli2.jsonc" ".markdownlint-cli2.jsonc";
markdown-mkdocs-lint:
PATH=${PATH}:node_modules/.bin markdownlint-cli2 "docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template"
docs-lint: markdown-mkdocs-lint
docs: docs-lint
${ACTIVATE_VENV}
mkdocs build --clean
lint: markdown-mkdocs-lint
clean:
rm -rf ${PATH_VENV}
rm -rf pages
rm -rf build
rm -rf node_modules
rm -f package-lock.json
rm -f package.json