Skip to content
Snippets Groups Projects
Commit ccc86641 authored by Roang's avatar Roang
Browse files

Add prettier and djLint to GitLab and tox

parent 232edde3
Branches
Tags
No related merge requests found
......@@ -35,8 +35,9 @@ default:
- key:
files:
- src/plainui/yarn.lock
- yarn.lock
paths:
- .yarn-cache/
- .yarn/cache/
.django_runner_settings:
before_script:
......@@ -109,10 +110,9 @@ generate_css:
- .default-rules
image: node:20-bookworm
stage: prepare
needs: []
script:
- cd src/plainui/
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
- echo 'yarn-offline-mirror ".yarn/cache/"' >> .yarnrc
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc
- yarn install --non-interactive --no-progress --frozen-lockfile
- yarn run build
......@@ -139,6 +139,8 @@ meta_build:
extends:
- .django_runner_settings
image: $CI_REGISTRY_IMAGE/build_image:$CI_PIPELINE_ID
variables:
PDM_CACHE_DIR: .cache/pdm
needs:
- meta_build
......@@ -175,6 +177,23 @@ format:
- python3 -V
- pdm sync -d --no-editable -G dev
- pdm run format
- git diff --exit-code -- . ':!src/version.json'
allow_failure: true
rules:
- when: always
format_prettier:
image: node:22-alpine
stage: test
needs: []
before_script:
- apk add --no-cache git
- corepack enable
- 'echo "cacheFolder: \".yarn/cache/\"" > .yarnrc.yml'
- yarn install --immutable
script:
- yarn format
- git diff --exit-code -- . ':!src/version.json'
allow_failure: true
rules:
- when: always
......
......
......@@ -3,5 +3,8 @@
"packageManager": "yarn@4.5.0",
"devDependencies": {
"prettier": "^3.3.3"
},
"scripts": {
"format": "prettier --write --ignore-unknown ."
}
}
......@@ -88,10 +88,12 @@ all = "tox"
check-migrations = "tox -e migrations"
coverage-report = "tox -e coverage-report"
style-check = {composite = ["format", "lint"]}
format = {composite = ["py-format"]}
lint = {composite = ["py-lint"]}
format = {composite = ["py-format", "html-format"]}
lint = {composite = ["py-lint", "html-lint"]}
py-format = "tox -e py-format"
py-lint = "tox -e py-lint"
html-format = "tox -e html-format"
html-lint = "tox -e html-lint"
test = "tox -e django-test"
live-test = "tox -e live-test"
......
......
[tox]
requires =
tox>=4
env_list = py-lint, py-format, migrations, django-test, coverage-report
env_list = py-lint, py-format, html-lint, html-format, migrations, django-test, coverage-report
work_dir = .tools/tox
[hub]
......@@ -30,6 +30,18 @@ commands = ruff check .
groups = lint
commands = ruff format . --diff
[testenv:html-lint]
groups = lint
commands =
djlint --profile jinja -e j2 --lint .
djlint --profile django -e html --lint .
[testenv:html-format]
groups = lint
commands =
djlint --profile jinja -e j2 --reformat .
djlint --profile django -e html --reformat .
[testenv:migrations]
groups = dev
change_dir = {toxinidir}/src
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment