From e90654533d65227eaa73ba82e4a2e32bbb1235f1 Mon Sep 17 00:00:00 2001 From: Jhonatan Lopes Date: Thu, 21 Sep 2023 18:23:11 -0300 Subject: [PATCH] Wagtail repo format and lint make commands (#60) * Fix docstring * Install make on frontend container * Lint and format commands * Update readme --- Dockerfile.frontend | 2 +- Makefile | 11 ++++++++++- README.md | 25 ++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Dockerfile.frontend b/Dockerfile.frontend index 685e685..305c174 100644 --- a/Dockerfile.frontend +++ b/Dockerfile.frontend @@ -1,7 +1,7 @@ FROM node:18-slim LABEL maintainer="hello@wagtail.org" -RUN apt-get update && apt-get install rsync -y +RUN apt-get update && apt-get install rsync make -y COPY ./wagtail/package.json ./wagtail/package-lock.json ./ RUN npm --prefix / install --loglevel info diff --git a/Makefile b/Makefile index 354f42a..7fd28f2 100644 --- a/Makefile +++ b/Makefile @@ -40,5 +40,14 @@ migrations: ## Make migrations to the wagtail bakery site migrate: ## Migrate the wagtail bakery site migrations docker-compose exec web python manage.py migrate -test: ## Run all wagtail tests or pass in a file with `make test file=wagtail.admin.tests.test_name.py` +test: ## Run all wagtail tests or pass in a file with `make test file=wagtail.admin.tests.test_name` docker-compose exec -w /code/wagtail web python runtests.py $(file) $(FILE) + +format-wagtail: ## Format Wagtail repo + docker-compose exec -w /code/wagtail web make format-server + docker-compose exec frontend make format-client + +lint-wagtail: ## Lint the Wagtail repo (server, client, docs) + docker-compose exec -w /code/wagtail web make lint-server + docker-compose exec -w /code/wagtail web make lint-docs + docker-compose exec frontend make lint-client diff --git a/README.md b/README.md index 95e0c51..5e6dbea 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,30 @@ make test file=wagtail.admin.tests.test_name.py or ```sh -docker-compose exec -w /code/wagtail web python runtests.py wagtail.admin.tests.{test_file_name_here}.py +docker-compose exec -w /code/wagtail web python runtests.py wagtail.admin.tests.{test_file_name_here} +``` + +### Format Wagtail codebase + +```sh +make format-wagtail +``` +or +```sh +docker-compose exec -w /code/wagtail web make format-server +docker-compose exec frontend make format-client +``` + +### Lint Wagtail codebase + +```sh +make lint-wagtail +``` +or +```sh +docker-compose exec -w /code/wagtail web make lint-server +docker-compose exec -w /code/wagtail web make lint-docs +docker-compose exec frontend make lint-client ``` ### Open a Django shell session