Skip to content
Open
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
7 changes: 3 additions & 4 deletions .ddev/commands/web/install-magento
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ composer create-project \
magento-temp

# Create Magento Folder if not exist
if [[ ! -d "${MAGENTO_FOLDER}" ]]; then
if [[ ! -d ${MAGENTO_FOLDER} ]]; then
mkdir -p "${MAGENTO_FOLDER}"
fi


# copy everything from magento-temp into magento folder
cp -a magento-temp/. "${MAGENTO_FOLDER}/"

Expand Down Expand Up @@ -127,9 +126,9 @@ bin/magento setup:upgrade
HYVA_THEME_ID=$(mysql --host=db --user=db --password=db db \
--skip-column-names --silent \
--execute="SELECT theme_id FROM theme WHERE theme_path = 'Hyva/default' LIMIT 1" 2>/dev/null) || HYVA_THEME_ID=""
if [[ -n "$HYVA_THEME_ID" ]]; then
if [[ -n ${HYVA_THEME_ID} ]]; then
echo "Setting Hyvä Default (ID: ${HYVA_THEME_ID}) as storefront theme..."
bin/magento config:set design/theme/theme_id "$HYVA_THEME_ID"
bin/magento config:set design/theme/theme_id "${HYVA_THEME_ID}"
bin/magento cache:clean config
else
echo "WARNING: Hyvä Default theme not found in database, skipping theme activation."
Expand Down
24 changes: 12 additions & 12 deletions .ddev/commands/web/mago
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env bash

## Description: Run Mago (PHP analysis, formatting, and linting)
set -euo pipefail

## Description: Run Mago (PHP linter and formatter)
## Usage: mago <command> [options]
## Example: "ddev mago"
## Example: ddev mago lint
## Example: ddev mago fmt
## Example: ddev mago fmt --dry-run

set -e
cd /var/www/html

# Require Mago to be installed (avoid executing remote install scripts automatically)
if ! command -v mago >/dev/null 2>&1; then
echo "mago is not installed. Please install it first: https://carthage.software/mago"
exit 1
# Mago is a require-dev dependency of the module itself.
if [[ ! -x vendor/bin/mago ]]; then
echo "mago not found. Installing module dev dependencies..."
composer install --no-interaction
fi

# Change to module root where mago.toml is found
cd /var/www/html

# Run Mago with provided arguments
mago "$@"
vendor/bin/mago "$@"
45 changes: 11 additions & 34 deletions .ddev/commands/web/phpcbf
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
#!/usr/bin/env bash

## Description: Run phpcbf (auto-fix coding standard issues)
## Usage: phpcbf [path]
set -euo pipefail

## Description: Run PHP Code Beautifier (auto-fix Magento2 standard violations)
## Usage: phpcbf [path] [flags]
## Example: ddev phpcbf
## Example: ddev phpcbf src/Service/StaticContentCleaner.php
## Example: ddev phpcbf vendor/openforgeproject/mageforge/src/Block

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

PHPCBF_BIN="vendor-bin/coding-standard/vendor/bin/phpcbf"
PHPCBF_FALLBACK="vendor-bin/coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcbf"

if [[ ! -x "${PHPCBF_BIN}" ]]; then
PHPCBF_BIN="${PHPCBF_FALLBACK}"
fi

if [[ ! -x "${PHPCBF_BIN}" ]]; then
echo "phpcbf not found. Installing coding-standard toolchain..."
composer bin coding-standard install || exit 1
PHPCBF_BIN="${PHPCBF_FALLBACK}"
fi

if [[ ! -x "${PHPCBF_BIN}" ]]; then
echo "phpcbf binary still missing. Expected ${PHPCBF_FALLBACK}."
exit 1
fi

# 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
cd /var/www/html

# 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
# The coding standard is a require-dev dependency of the module itself.
if [[ ! -x vendor/bin/phpcbf ]]; then
echo "phpcbf not found. Installing module dev dependencies..."
composer install --no-interaction
fi

# Run PHPCBF with optional additional flags
"${PHPCBF_BIN}" -p -s --standard=Magento2 "$@" "${TARGET_PATH}"
# The ruleset (phpcs.xml.dist) defines the standard and default file list.
vendor/bin/phpcbf -p "$@"
48 changes: 11 additions & 37 deletions .ddev/commands/web/phpcs
Original file line number Diff line number Diff line change
@@ -1,45 +1,19 @@
#!/usr/bin/env bash

## Description: Run phpcs
## Usage: phpcs [path]
set -euo pipefail

## Description: Run PHP CodeSniffer (Magento2 standard) on the module source
## Usage: phpcs [path] [flags]
## Example: ddev phpcs
## Example: ddev phpcs src/Service/StaticContentCleaner.php
## Example: ddev phpcs vendor/openforgeproject/mageforge/src/Block

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

PHPCS_BIN="vendor-bin/coding-standard/vendor/bin/phpcs"
PHPCS_FALLBACK="vendor-bin/coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs"

if [[ ! -x "${PHPCS_BIN}" ]]; then
PHPCS_BIN="${PHPCS_FALLBACK}"
fi

if [[ ! -x "${PHPCS_BIN}" ]]; then
echo "phpcs not found. Installing coding-standard toolchain..."
composer bin coding-standard install || exit 1
PHPCS_BIN="${PHPCS_FALLBACK}"
fi

if [[ ! -x "${PHPCS_BIN}" ]]; then
echo "phpcs binary still missing. Expected ${PHPCS_FALLBACK}."
exit 1
fi

# 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
cd /var/www/html

# If path starts with 'src/', convert to vendor path
if [[ "${TARGET_PATH}" =~ ^src/ ]]; then
TARGET_PATH="vendor/openforgeproject/mageforge/${TARGET_PATH}"
# If path doesn't exist from magento dir, try from workspace root
elif [[ ! -e "${TARGET_PATH}" ]] && [[ -e "../${TARGET_PATH}" ]]; then
TARGET_PATH="../${TARGET_PATH}"
fi
# The coding standard is a require-dev dependency of the module itself.
if [[ ! -x vendor/bin/phpcs ]]; then
echo "phpcs not found. Installing module dev dependencies..."
composer install --no-interaction
fi

# Run PHPCS with optional additional flags
"${PHPCS_BIN}" -p -s --standard=Magento2 "$@" "${TARGET_PATH}"
# The ruleset (phpcs.xml.dist) defines the standard and default file list.
vendor/bin/phpcs -p -s "$@"
37 changes: 16 additions & 21 deletions .ddev/commands/web/phpstan
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,40 @@ cd /var/www/html/magento || exit 1

# Check if PHPStan is installed
if [[ ! -f vendor/bin/phpstan ]]; then
echo "PHPStan not found. Installing PHPStan with Magento extension..."
echo "PHPStan not found. Installing PHPStan with Magento extension..."

# Allow PHPStan extension installer
composer config --no-plugins allow-plugins.phpstan/extension-installer true
# Allow PHPStan extension installer
composer config --no-plugins allow-plugins.phpstan/extension-installer true

# Install PHPStan and Magento extension
composer require --dev --no-update bitexpert/phpstan-magento phpstan/phpstan:^2.0 phpstan/extension-installer
# Install PHPStan and Magento extension
composer require --dev --no-update bitexpert/phpstan-magento phpstan/phpstan:^2.0 phpstan/extension-installer

# Update dependencies (limit scope to PHPStan packages)
composer update bitexpert/phpstan-magento phpstan/phpstan phpstan/extension-installer --with-dependencies
# Update dependencies (limit scope to PHPStan packages)
composer update bitexpert/phpstan-magento phpstan/phpstan phpstan/extension-installer --with-dependencies

echo "PHPStan installation complete."
echo "PHPStan installation complete."
fi

# Set target path - prefer app/code mount over vendor copy if not provided or if it's a flag
if [[ -d "app/code/OpenForgeProject" ]]; then
DEFAULT_TARGET_PATH="app/code/OpenForgeProject"
else
DEFAULT_TARGET_PATH="vendor/openforgeproject/mageforge/src"
fi
TARGET_PATH="${DEFAULT_TARGET_PATH}"
if [[ $# -gt 0 ]] && [[ ! "$1" =~ ^- ]]; then
# Default target: the module source, symlinked into vendor via the Composer path repository
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
if [[ ! -e ${TARGET_PATH} ]] && [[ -e "../${TARGET_PATH}" ]]; then
Comment thread
Morgy93 marked this conversation as resolved.
TARGET_PATH="../${TARGET_PATH}"
fi
fi

# Determine config file location
if [[ -f "vendor/openforgeproject/mageforge/phpstan.neon" ]]; then
PHPSTAN_CONFIG="vendor/openforgeproject/mageforge/phpstan.neon"
PHPSTAN_CONFIG="vendor/openforgeproject/mageforge/phpstan.neon"
elif [[ -f "../phpstan.neon" ]]; then
PHPSTAN_CONFIG="../phpstan.neon"
PHPSTAN_CONFIG="../phpstan.neon"
else
echo "PHPStan config not found at vendor/openforgeproject/mageforge/phpstan.neon or ../phpstan.neon"
exit 1
echo "PHPStan config not found at vendor/openforgeproject/mageforge/phpstan.neon or ../phpstan.neon"
exit 1
fi

# Run PHPStan with the same configuration as CI pipeline
Expand Down
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig: https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

# Match Prettier's output (2-space indent) for everything it formats
[*.{js,mjs,css,json,yml,yaml,md}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

# DDEV command scripts are formatted by shfmt with tabs
[.ddev/commands/**]
indent_style = tab
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
/docs/ export-ignore
/phpstan.neon export-ignore
/mago.toml export-ignore
/phpcs.xml.dist export-ignore
/.editorconfig export-ignore
/CONTRIBUTING.md export-ignore
/context7.json export-ignore
/release-please-config.json export-ignore
Expand Down
17 changes: 9 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: 'Bug Report: '
title: "Bug Report: "
labels: bug
assignees: ''

assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. ...

Expand All @@ -22,11 +22,12 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- MageForge Version
- Magento Version
- Hyva Version
- OS: [e.g. MacOS, Linux, ... ]
- Terminal Name [e.G. Iterm, Powershell, ... ]

- MageForge Version
- Magento Version
- Hyva Version
- OS: [e.g. MacOS, Linux, ... ]
- Terminal Name [e.G. Iterm, Powershell, ... ]

**Additional context**
Add any other context about the problem here.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: 'Feature-Request: '
title: "Feature-Request: "
labels: feature-request
assignees: ''

assignees: ""
---

**Magento 2 Version**
Expand Down
Binary file modified .github/assets/cli-chooser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Structure

```
```text
magento/ # Magento 2 installation (DDEV)
src/
Console/Command # CLI commands (extend AbstractCommand)
Expand Down Expand Up @@ -105,7 +105,7 @@ When adding an admin config field, all steps must be done together:

Standalone Alpine.js component (`mageforgeToolbar`), separate from Inspector.

```
```text
src/view/frontend/web/js/
toolbar.js # Entry point
toolbar/
Expand Down Expand Up @@ -136,7 +136,7 @@ Trunk also runs checkov (see `.trunk/trunk.yaml`).

## Git

```
```text
fix/<issue-description>
feature/<issue-description>
#<issue-nr> - <message>
Expand Down
30 changes: 16 additions & 14 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# actions/labeler v5 config.
# Only changed-files, head-branch and base-branch are supported here; head-branch
# values are regexes (not globs). Labeling by PR title is handled by a separate
# step in .github/workflows/label.yml, since the action cannot match titles.

Documentation:
- changed-files:
- any-glob-to-any-file: '**/*.md'
- changed-files:
- any-glob-to-any-file: "**/*.md"

Feature:
- branch: ['add-*', 'featuere-*', 'feature/**', 'feat-*', 'feature*']
- title: ['feat:', 'feature:', 'Feature:']
- head-branch: ["^(add|feat|feature)[/-]"]

Fix:
- branch: ['fix-*', 'bugfix-*', 'fix/**', 'bugfix/**', 'fix*', 'bugfix*']
- title: ['fix:', 'bugfix:', 'Fix:']
- head-branch: ["^(fix|bugfix)[/-]"]

Next-Release:
- branch: ['chore: release*', 'release-please*']
- title: ['chore: release', 'Release']
- head-branch: [^release-please]

Command:
- changed-files:
- any-glob-to-any-file: 'src/Console/Command/**'
- changed-files:
- any-glob-to-any-file: src/Console/Command/**

Frontend:
- changed-files:
- any-glob-to-any-file: 'src/view/frontend/**'
- changed-files:
- any-glob-to-any-file: src/view/frontend/**

Theme-Builder:
- changed-files:
- any-glob-to-any-file: 'src/Service/ThemeBuilder/**'
- changed-files:
- any-glob-to-any-file: src/Service/ThemeBuilder/**
2 changes: 1 addition & 1 deletion .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: '20'
node-version: "20"

- name: Cache Composer packages
id: composer-cache
Expand Down
Loading
Loading