Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .ddev/commands/web/install-magento
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ bin/magento setup:install \
--base-url=https://mageforge.ddev.site/ \
--language=en_US

# set developer mode
bin/magento deploy:mode:set developer

# disable 2FA
bin/magento module:disable Magento_TwoFactorAuth Magento_AdminAdobeImsTwoFactorAuth

# install sample data
bin/magento sampledata:deploy

Expand Down
27 changes: 27 additions & 0 deletions .ddev/commands/web/phpcbf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

## #ddev-generated
## Description: Run phpcbf (auto-fix coding standard issues)
## Usage: phpcbf [path]
## Example: ddev phpcbf
## Example: ddev phpcbf src/src/Service/StaticContentCleaner.php
## Example: ddev phpcbf vendor/openforgeproject/mageforge/src/Block

cd /var/www/html/magento || exit 1

PHPCBF_BIN="vendor/bin/phpcbf"

# Set target path - default to vendor/openforgeproject/mageforge/src if not provided
TARGET_PATH="vendor/openforgeproject/mageforge/src"
if [[ $# -gt 0 ]] && [[ ! "$1" =~ ^- ]]; then
TARGET_PATH="$1"
shift # Remove the first argument

# If path doesn't exist from magento dir, try from workspace root
if [[ ! -e "${TARGET_PATH}" ]] && [[ -e "../${TARGET_PATH}" ]]; then
TARGET_PATH="../${TARGET_PATH}"
fi
fi

# Run PHPCBF with optional additional flags
"${PHPCBF_BIN}" -p -s --standard=Magento2 "$@" "${TARGET_PATH}"
27 changes: 18 additions & 9 deletions .ddev/commands/web/phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

## #ddev-generated
## Description: Run phpcs
## Usage: phpcs
## Usage: phpcs [path]
## Example: ddev phpcs
## Example: ddev phpcs src/src/Service/StaticContentCleaner.php
## Example: ddev phpcs vendor/openforgeproject/mageforge/src/Block

TEMP_DIR="/tmp/magento-coding-standard"
PHPCS_BIN="${TEMP_DIR}/vendor/bin/phpcs"
cd /var/www/html/magento || exit 1

# Check if Magento Coding Standard is installed
if [[ ! -d ${TEMP_DIR} ]]; then
echo "Magento Coding Standard not found. Installing..."
composer create-project magento/magento-coding-standard --stability=dev "${TEMP_DIR}"
PHPCS_BIN="vendor/bin/phpcs"

# Set target path - default to vendor/openforgeproject/mageforge/src if not provided
TARGET_PATH="vendor/openforgeproject/mageforge/src"
if [[ $# -gt 0 ]] && [[ ! "$1" =~ ^- ]]; then
TARGET_PATH="$1"
shift # Remove the first argument

# If path doesn't exist from magento dir, try from workspace root
if [[ ! -e "${TARGET_PATH}" ]] && [[ -e "../${TARGET_PATH}" ]]; then
TARGET_PATH="../${TARGET_PATH}"
fi
fi

# Run PHPCS
"${PHPCS_BIN}" -p -s --standard=Magento2 src/
# Run PHPCS with optional additional flags
"${PHPCS_BIN}" -p -s --standard=Magento2 "$@" "${TARGET_PATH}"
18 changes: 16 additions & 2 deletions .ddev/commands/web/phpstan
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## #ddev-generated
## Description: Run PHPStan analysis with Magento extension (same as CI pipeline)
## Usage: phpstan
## Usage: phpstan [path]
## Example: ddev phpstan
## Example: ddev phpstan src/src/Block/Inspector.php
## Example: ddev phpstan vendor/openforgeproject/mageforge/src/Service

# Navigate to Magento root
cd /var/www/html/magento || exit 1
Expand All @@ -24,6 +26,18 @@ if [[ ! -f vendor/bin/phpstan ]]; then
echo "PHPStan installation complete."
fi

# Set target path - default to vendor/openforgeproject/mageforge/src if not provided or if it's a flag
TARGET_PATH="vendor/openforgeproject/mageforge/src"
if [[ $# -gt 0 ]] && [[ ! "$1" =~ ^- ]]; then
TARGET_PATH="$1"
shift # Remove the first argument

# If path doesn't exist from magento dir, try from workspace root
if [[ ! -e "${TARGET_PATH}" ]] && [[ -e "../${TARGET_PATH}" ]]; then
TARGET_PATH="../${TARGET_PATH}"
fi
fi

# Run PHPStan with the same configuration as CI pipeline
echo "Running PHPStan analysis..."
vendor/bin/phpstan analyse -c vendor/openforgeproject/mageforge/phpstan.neon vendor/openforgeproject/mageforge/src
vendor/bin/phpstan analyse -c vendor/openforgeproject/mageforge/phpstan.neon "$@" "${TARGET_PATH}"