Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Real-World Example

The best way to understand makefile2doc is to see it in action. Below is the Result (the generated Markdown) and the Input (the raw Makefile) from our internal test suite.

Makefile Documentation

Auto-generated by makefile2doc

Cheat Sheet

CommandCategoryDescription
make upDevelopment EnvironnementStart the full development environment (Docker)
make downDevelopment EnvironnementStop all containers
make logsDevelopment EnvironnementShow live logs for all services
make shell-backDevelopment EnvironnementOpen a shell inside the PHP container (Laravel)
make shell-frontDevelopment EnvironnementOpen a shell inside the Node.js container
make shell-dbDevelopment EnvironnementOpen a shell inside the PostgreSQL container
make install-backSetup & InitializationInstall backend (Composer)
make install-frontSetup & InitializationInstall frontend (NPM) dependencies
make installSetup & InitializationRun both backend and frontend installations
make migrateDatabaseRun database migrations
make seedDatabaseReset the DB and run seeds (Test data)
Warning: This deletes all data!
make test-backCode QualityRun unit tests (Pest/PHPUnit)
make lint-frontCode QualityLint frontend code (ESLint)
make lint-backCode QualityLint backend code (PHP-CS-Fixer dry-run)
make fix-frontCode QualityFix frontend code style and format
make fix-backCode QualityFix backend code style
make lintCode QualityRun all linters (front & back)
make fixCode QualityFix all code style issues (front & back)
make build-frontDeploymentCompile Frontend assets (Vite/Mix)
make deployDeploymentDeploy to Production
1. Build frontend assets
2. Optimize Laravel cache
3. Run migrations force

Workflow Graph

flowchart LR
    subgraph Development_Environnement[Development Environnement]
        up(up)
        down(down)
        logs(logs)
        shell-back(shell-back)
        shell-front(shell-front)
        shell-db(shell-db)
    end
    style Development_Environnement fill:transparent,stroke-dasharray: 5 5
    classDef cat0 fill:#E1F5FE,stroke:#01579B,stroke-width:2px,color:#000;
    class up cat0
    class down cat0
    class logs cat0
    class shell-back cat0
    class shell-front cat0
    class shell-db cat0
    subgraph Setup_&_Initialization[Setup & Initialization]
        install-back(install-back)
        install-front(install-front)
        install(install)
    end
    style Setup_&_Initialization fill:transparent,stroke-dasharray: 5 5
    classDef cat1 fill:#E8F5E9,stroke:#1B5E20,stroke-width:2px,color:#000;
    class install-back cat1
    class install-front cat1
    class install cat1
    subgraph Database[Database]
        migrate(migrate)
        seed(seed)
    end
    style Database fill:transparent,stroke-dasharray: 5 5
    classDef cat2 fill:#FFF3E0,stroke:#E65100,stroke-width:2px,color:#000;
    class migrate cat2
    class seed cat2
    subgraph Code_Quality[Code Quality]
        test-back(test-back)
        lint-front(lint-front)
        lint-back(lint-back)
        fix-front(fix-front)
        fix-back(fix-back)
        lint(lint)
        fix(fix)
    end
    style Code_Quality fill:transparent,stroke-dasharray: 5 5
    classDef cat3 fill:#F3E5F5,stroke:#4A148C,stroke-width:2px,color:#000;
    class test-back cat3
    class lint-front cat3
    class lint-back cat3
    class fix-front cat3
    class fix-back cat3
    class lint cat3
    class fix cat3
    subgraph Deployment[Deployment]
        build-front(build-front)
        deploy(deploy)
    end
    style Deployment fill:transparent,stroke-dasharray: 5 5
    classDef cat4 fill:#FFEBEE,stroke:#B71C1C,stroke-width:2px,color:#000;
    class build-front cat4
    class deploy cat4

    logs --> up
    shell-back --> up
    shell-front --> up
    shell-db --> up
    install --> install-back
    install --> install-front
    migrate --> up
    migrate --> install
    seed --> migrate
    test-back --> install
    lint-front --> install-front
    lint-back --> install-back
    fix-front --> install-front
    fix-back --> install-back
    lint --> lint-front
    lint --> lint-back
    fix --> fix-front
    fix --> fix-back
    build-front --> install
    deploy --> build-front
    deploy --> migrate

Section Details

Development Environnement

CommandDescriptionDependenciesRequired Variables
make upStart the full development environment (Docker)-PORT
make downStop all containers--
make logsShow live logs for all servicesup-
make shell-backOpen a shell inside the PHP container (Laravel)up-
make shell-frontOpen a shell inside the Node.js containerup-
make shell-dbOpen a shell inside the PostgreSQL containerup-

Setup & Initialization

CommandDescriptionDependenciesRequired Variables
make install-backInstall backend (Composer)--
make install-frontInstall frontend (NPM) dependencies--
make installRun both backend and frontend installationsinstall-back, install-front-

Database

CommandDescriptionDependenciesRequired Variables
make migrateRun database migrationsup, install-
make seedReset the DB and run seeds (Test data)
Warning: This deletes all data!
migrateSEED_CLASS

Code Quality

CommandDescriptionDependenciesRequired Variables
make test-backRun unit tests (Pest/PHPUnit)install-
make lint-frontLint frontend code (ESLint)install-front-
make lint-backLint backend code (PHP-CS-Fixer dry-run)install-back-
make fix-frontFix frontend code style and formatinstall-front-
make fix-backFix backend code styleinstall-back-
make lintRun all linters (front & back)lint-front, lint-back-
make fixFix all code style issues (front & back)fix-front, fix-back-

Deployment

CommandDescriptionDependenciesRequired Variables
make build-frontCompile Frontend assets (Vite/Mix)install-
make deployDeploy to Production
1. Build frontend assets
2. Optimize Laravel cache
3. Run migrations force
build-front, migrateAPP_KEY, SSH_USER

2. The Input (Makefile)

This is the source Makefile using The Convention.

Pro Tip: We recommend using visual separators (like the # === lines below) to clearly delimit your categories. This keeps the raw file readable for humans, while the parser simply ignores them.

# ==============================================================================
## @category Development Environnement
# ==============================================================================

## @description Start the full development environment (Docker)
## @env PORT
up:
	# docker compose up -d

## @description Stop all containers
down:
	# docker compose down

## @description Show live logs for all services
## @depends up
logs:
	# docker compose logs -f

## @description Open a shell inside the PHP container (Laravel)
## @depends up
shell-back:
	# docker compose exec app bash

## @description Open a shell inside the Node.js container
## @depends up
shell-front:
	# docker compose exec app bash

## @description Open a shell inside the PostgreSQL container
## @depends up
shell-db:
	# docker compose exec app bash

# ==============================================================================
## @category Setup & Initialization
# ==============================================================================

## @description Install backend (Composer)
install-back:
	# docker compose run --rm app composer install

## @description Install frontend (NPM) dependencies
install-front:
	# docker compose run --rm app npm install

## @description Run both backend and frontend installations
## @depends install-back, install-front
install: install-back install-front

# ==============================================================================
## @category Database
# ==============================================================================

## @description Run database migrations
## @depends up, install
migrate:
	# docker compose exec app php artisan migrate

## @description Reset the DB and run seeds (Test data) \n Warning: This deletes all data!
## @depends migrate
## @env SEED_CLASS
seed:
	# docker compose exec app php artisan migrate:refresh --seed

# ==============================================================================
## @category Code Quality
# ==============================================================================

## @description Run unit tests (Pest/PHPUnit)
## @depends install
test-back:
	# docker-compose exec app php artisan test

## @description Lint frontend code (ESLint)
## @depends install-front
lint-front:
	# docker compose exec app npm run lint

## @description Lint backend code (PHP-CS-Fixer dry-run)
## @depends install-back
lint-back:
	# docker compose exec app php-cs-fixer

## @description Fix frontend code style and format
## @depends install-front
fix-front:
	# docker compose exec app npm run lint-fix && npm run format

## @description Fix backend code style
## @depends install-back
fix-back:
	# docker compose exec app php-cs-fixer --fix

## @description Run all linters (front & back)
## @depends lint-front, lint-back
lint: lint-front lint-back

## @description Fix all code style issues (front & back)
## @depends fix-front, fix-back
fix: fix-front fix-back

# ==============================================================================
## @category Deployment
# ==============================================================================

## @description Compile Frontend assets (Vite/Mix)
## @depends install
build-front:
	# npm run build

## @description Deploy to Production \n 1. Build frontend assets \n 2. Optimize Laravel cache \n 3. Run migrations force
## @depends build-front, migrate
## @env APP_KEY, SSH_USER
deploy:
	# git pull
	# docker compose exec app php artisan config:cache
	# docker compose exec app php artisan migrate --force