diff --git a/frontend_addon/cookiecutter.json b/frontend_addon/cookiecutter.json index 3f57afe..398721b 100644 --- a/frontend_addon/cookiecutter.json +++ b/frontend_addon/cookiecutter.json @@ -16,6 +16,7 @@ "__version_mrs_developer": "^2.2.0", "__version_pnpm": "9.1.1", "__version_release_it": "^17.1.1", + "__version_pre_commit": "3.7.1", "__gha_version_node": "20.x", "__gha_version_checkout": "v4", "__gha_version_setup_node": "v4", diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/.pre-commit-config.yaml b/frontend_addon/{{ cookiecutter.__folder_name }}/.pre-commit-config.yaml index e09f255..926c852 100644 --- a/frontend_addon/{{ cookiecutter.__folder_name }}/.pre-commit-config.yaml +++ b/frontend_addon/{{ cookiecutter.__folder_name }}/.pre-commit-config.yaml @@ -1,7 +1,27 @@ repos: - - repo: https://github.com/pre-commit/mirrors-eslint - rev: 'v9.2.0' + - repo: local hooks: + - id: prettier + name: prettier + entry: pnpm exec prettier --write + language: system + files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$' + types: [file] - id: eslint - files: '^packages/.*/src/.*/*.(js,jsx,ts,tsx)$' + name: eslint + entry: pnpm exec eslint --max-warnings=0 --fix + language: system + files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$' + types: [file] + - id: stylelint + name: stylelint + entry: pnpm exec stylelint --fix + language: system + files: '^packages/.*/src/.*/?.*.(css|scss|less)$' + types: [file] + - id: i18n + name: i18n + entry: make ci-i18n + language: system + files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$' types: [file] diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile b/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile index 1e2db16..9680b36 100644 --- a/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile +++ b/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile @@ -19,6 +19,9 @@ GREEN=`tput setaf 2` RESET=`tput sgr0` YELLOW=`tput setaf 3` +GIT_FOLDER=$(CURRENT_DIR)/.git +PRE_COMMIT=pipx run --spec 'pre-commit=={{cookiecutter.__version_pre_commit}}' pre-commit + PLONE_VERSION=6 DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION} DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION} @@ -33,6 +36,8 @@ help: ## Show this help .PHONY: install install: ## Installs the add-on in a development environment + @echo "$(GREEN)Install$(RESET)" + if [ -d $(GIT_FOLDER) ]; then $(PRE_COMMIT) install; else echo "$(RED) Not installing pre-commit$(RESET)";fi pnpm dlx mrs-developer missdev --no-config --fetch-https pnpm i pnpm build:deps