Skip to content

Commit

Permalink
Merge branch 'develop' into feature/GPHWPP-3655_dashboard-nba
Browse files Browse the repository at this point in the history
  • Loading branch information
DerHerrFeldmann committed Feb 20, 2025
2 parents 3427acb + 854fb27 commit 3ff0393
Show file tree
Hide file tree
Showing 43 changed files with 3,742 additions and 2,035 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WP_ENV_HOME=./wp-env-home

# automatically create wp-plugin localizations for the given languages
# (if not set or empty, no localizations will be created)
WP_CLI_I18N_LOCALES='en_US de_DE es_ES'
WP_CLI_I18N_LOCALES='en_US de_DE de_DE_formal es_ES fr_FR it_IT nl_NL pl_PL sv_SE'

# used for docker image metadata generation
VENDOR='IONOS Group'
7 changes: 5 additions & 2 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# `.env.local` files can even be placed in any su package directory (example: `./packages/wp-plugin/foo/.env.local`)
#

# enable automatic lint-fix on 'git commit'
# LINTFIX_ON_COMMIT=true
# enable automatic linting before 'git push'
# LINT_ON_PUSH=true

# additional options attached to wp-env related commands
# default to wp-env debug mode
Expand All @@ -25,3 +25,6 @@

# used for docker image metadata generation
# VENDOR='IONOS Group'

# set BUILD_UP_TO_DATE=1 will disable automatic (re)building the sources on start / test
# BUILD_UP_TO_DATE=1
19 changes: 0 additions & 19 deletions .githooks/pre-commit

This file was deleted.

20 changes: 20 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
#
# script implements the prepush hook for automatically run lint on "git push"
#
# this feature is a opt-in - it will only be executed if the LINT_ON_PUSH is set to true in the .env file
#
# this script is executed by the pre-push hook in .git/hooks and will automatically lint everything before pushing
# in case anything could not be fixed, the push will be aborted
#
# If you want to disable git hooks for some reason you can disable the git hooks by adding `--no-verify` to the git command.
# Example : `git push --no-verify`
#

# bootstrap the environment
source "./scripts/includes/bootstrap.sh"

if [[ "$LINT_ON_PUSH" == 'true' ]]; then
pnpm lint
# pnpm lint-fix && git add -u $(git diff --cached --name-only --diff-filter=ACMRT)
fi
2 changes: 0 additions & 2 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
const config = {
stories: [
'../stories/**/*.mdx',
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
// find all stories below the src folder of workspace packages
'../packages/*/*/src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"johnbillion.vscode-wordpress-hooks",
"bmewburn.vscode-intelephense-client",
"ms-playwright.playwright",
"Gruntfuggly.todo-tree"
"Gruntfuggly.todo-tree",
"xdebug.php-debug"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ The changets file will be taken under version control as long as it takes to cre

The project uses git hooks at various stages.

For example the `pre-commit` hook will automatically lint-fix the code before committing and will abort the commit process if lint-fix was not successful (MUST BE enabled by environment variable `LINTFIX_ON_COMMIT`, see `./.env.local`).
For example the `pre-push` hook will automatically lint the code before push and will abort the if lint was not successful (MUST BE enabled by environment variable `LINT_ON_PUSH`, see `./.env.local`).

Git hooks are located in the `./.githooks` directory.

Expand Down
89 changes: 0 additions & 89 deletions ecs-config.php

This file was deleted.

53 changes: 33 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@
"changeset": "./scripts/changeset.sh",
"release": "./scripts/release.sh",
"lint": "./scripts/lint.sh",
"lint:php": "./scripts/lint.sh --use php",
"lint:prettier": "./scripts/lint.sh --use prettier",
"lint:wp": "./scripts/lint.sh --use wp",
"lint:js": "./scripts/lint.sh --use js",
"lint:css": "./scripts/lint.sh --use css",
"lint:pnpm": "./scripts/lint.sh --use pnpm",
"lint:i18n": "./scripts/lint.sh --use i18n",
"lint-fix": "./scripts/lint.sh --fix",
"lint-fix:php": "./scripts/lint.sh --fix --use php",
"lint-fix:prettier": "./scripts/lint.sh --fix --use prettier",
"lint-fix:wp": "./scripts/lint.sh --fix --use wp",
"lint-fix:js": "./scripts/lint.sh --fix --use js",
"lint-fix:css": "./scripts/lint.sh --fix --use css",
"lint-fix:i18n": "./scripts/lint.sh --fix --use i18n",
"update-dependencies": "./scripts/update-dependencies.sh",
"storybook:start": "./scripts/storybook.sh dev -p 6006",
"storybook:build": "./scripts/storybook.sh build -o ./build/storybook-static",
Expand Down Expand Up @@ -47,46 +60,46 @@
"homepage": "https://ionos-wordpress.github.io/ionos-wordpress/",
"license": "MIT",
"devDependencies": {
"@changesets/cli": "2.27.12",
"@changesets/cli": "2.28.0",
"@chromatic-com/storybook": "^3.2.4",
"@commitlint/cli": "19.7.1",
"@commitlint/config-conventional": "19.7.1",
"@devcontainers/cli": "^0.73.0",
"@eslint/compat": "1.2.6",
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.19.0",
"@eslint/js": "9.20.0",
"@playwright/browser-chromium": "^1.50.1",
"@playwright/experimental-ct-react": "^1.50.1",
"@playwright/test": "1.50.1",
"@storybook/addon-essentials": "^8.5.3",
"@storybook/addon-interactions": "^8.5.3",
"@storybook/addon-links": "^8.5.3",
"@storybook/addon-onboarding": "^8.5.3",
"@storybook/addon-webpack5-compiler-swc": "^2.0.0",
"@storybook/blocks": "^8.5.3",
"@storybook/react": "^8.5.3",
"@storybook/react-webpack5": "^8.5.3",
"@storybook/test": "^8.5.3",
"@types/node": "22.13.1",
"@storybook/addon-essentials": "^8.5.6",
"@storybook/addon-interactions": "^8.5.6",
"@storybook/addon-links": "^8.5.6",
"@storybook/addon-onboarding": "^8.5.6",
"@storybook/addon-webpack5-compiler-swc": "^2.1.0",
"@storybook/blocks": "^8.5.6",
"@storybook/react": "^8.5.6",
"@storybook/react-webpack5": "^8.5.6",
"@storybook/test": "^8.5.6",
"@types/node": "22.13.4",
"@wordpress/components": "catalog:",
"@wordpress/e2e-test-utils-playwright": "^1.17.0",
"@wordpress/env": "^10.17.0",
"@wordpress/scripts": "^30.10.0",
"@wordpress/e2e-test-utils-playwright": "^1.18.0",
"@wordpress/env": "^10.18.0",
"@wordpress/scripts": "^30.11.0",
"@wp-now/wp-now": "0.1.74",
"eslint": "9.19.0",
"eslint": "9.20.1",
"eslint-config-prettier": "10.0.1",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-prettier": "5.2.3",
"eslint-plugin-react": "7.37.4",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-storybook": "^0.11.2",
"eslint-plugin-storybook": "^0.11.3",
"git-cz": "4.9.0",
"globals": "15.14.0",
"prettier": "3.4.2",
"globals": "15.15.0",
"prettier": "3.5.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"storybook": "^8.5.3",
"storybook": "^8.5.6",
"stylelint": "^16.14.1",
"stylelint-config-recommended-scss": "^14.1.0",
"stylelint-prettier": "^5.0.3",
Expand Down
25 changes: 15 additions & 10 deletions packages/docker/ecs-php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,28 @@ ARG WORDPRESS_CODING_STANDARDS_VERSION
ENV COMPOSER_HOME=/composer
ENV COMPOSER_ALLOW_SUPERUSER=1

RUN composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true \
&& composer global require --dev wp-coding-standards/wpcs:${WORDPRESS_CODING_STANDARDS_VERSION}

RUN composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer false \
&& composer global require symplify/easy-coding-standard:${ECS_VERSION} --with-dependencies

# install apk packages to create a user
# install i18n support into php
RUN apk add --no-cache icu-dev shadow && docker-php-ext-install intl
RUN <<EOF
# install apk packages to create a user
# install i18n support into php
apk add --no-cache icu-dev shadow && docker-php-ext-install intl

composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --dev symplify/easy-coding-standard:${ECS_VERSION} --with-dependencies
composer global require --dev wp-coding-standards/wpcs:${WORDPRESS_CODING_STANDARDS_VERSION}

# tell phpcs dependency of easy-coding-standard where to find the used standards
/composer/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs \
--config-set installed_paths \
"/composer/vendor/phpcsstandards/phpcsextra,/composer/vendor/phpcsstandards/phpcsutils,/composer/vendor/wp-coding-standards/wpcs"
EOF

COPY --chmod=755 <<EOF /usr/bin/entrypoint.sh
#!/bin/sh

exec /composer/vendor/bin/ecs \$@
EOF

COPY packages/docker/ecs-php/ruleset.xml /ruleset.xml
# COPY packages/docker/ecs-php/ruleset.xml /ruleset.xml

# create user/group to run ecs as non-root
RUN groupadd --gid 1000 php && useradd --uid 1000 --gid php --shell /bin/sh --create-home php
Expand Down
4 changes: 4 additions & 0 deletions packages/docker/ecs-php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ I needed a way to provide [PHP easy-coding-standard](https://github.com/easy-cod

=> That's exactly what a Docker image can do :-)

# Debugging

Debugging into ecs can be done like here : https://github.com/lgersman/docker-ecs-xdebug

# Usage

@TODO: add usage documentation
Expand Down
66 changes: 66 additions & 0 deletions packages/docker/ecs-php/ecs-config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

use Symplify\EasyCodingStandard\Config\ECSConfig;
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;

$codeSnifferConfig = new PHP_CodeSniffer\Config(["--standard=./packages/docker/ecs-php/ruleset.xml"]);
PHP_CodeSniffer\Autoload::addSearchPath('/composer/vendor/wp-coding-standards/wpcs/WordPress', "WordPressCS\WordPress");
PHP_CodeSniffer\Autoload::addSearchPath('/composer/vendor/wp-coding-standards/wpcs/WordPress-Extra', "WordPressCS\WordPress-Extra");
PHP_CodeSniffer\Autoload::addSearchPath('/composer/vendor/wp-coding-standards/wpcs/WordPress-Core', "WordPressCS\WordPress-Core");

$configure = ECSConfig::configure();

$codeSnifferRuleset = new PHP_CodeSniffer\Ruleset($codeSnifferConfig);

return $configure->withRules([
// import the rules from our loaded codesniffer config
...array_values($codeSnifferRuleset->sniffCodes),
])
->withPaths(['.'])
->withRootFiles()
->withSkip(
[
'*/vendor/*',
'*/build/*',
'*/dist/*',
'*/node_modules/*',
'*/languages/*',
'/phpunit/*',
'*/wp-env-home/*',
'*/.git/*',
'/tmp/*',
'**/ecs-config.php',
'rector-config-php7.4.php',
]
)
->withPreparedSets(
symplify: true,
psr12: true,
// arrays: true,
common: true, // (arrays | spaces | namespaces | docblocks | controlStructures | phpunit | comments)
cleanCode: true,
// comments: true,
// docblocks: true,
// spaces: true,
// namespaces : true,
// controlStructures: true,
// phpunit : true
// strict: true,
// docblocks: true,
)
// use editor config if available
// ->withEditorConfig(true)
// use 2 spaces instead of psr12 default (4 spaces)
->withSpacing(indentation: ' ')

->withConfiguredRule(YodaStyleFixer::class, [
'equal' => true,
'identical' => true,
'less_and_greater' => true,
])
// align assoc arrays
->withConfiguredRule(BinaryOperatorSpacesFixer::class, [
'default' => 'align',
])
;
2 changes: 1 addition & 1 deletion packages/docker/ecs-php/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ionos-wordpress/ecs-php",
"description": "Docker image providing the most recent PHP easy-coding-standard in a docker image",
"version": "0.0.4",
"version": "0.0.5",
"private": true,
"keywords": [
"php",
Expand Down
Loading

0 comments on commit 3ff0393

Please sign in to comment.