SW_ROOT=../../../
PLUGIN_NAME={{pluginName}}

.DEFAULT_GOAL := help

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help

install: # installs project dependencies
	npm install --prefix src/Resources/app/administration;\
	npm install --prefix src/Resources/app/storefront;
.PHONY: install

activate: ## Installs and activate plugin
	cd $(SW_ROOT) && \
	bin/console plugin:refresh && \
	bin/console plugin:install --activate $(PLUGIN_NAME);
.PHONY: activate

ecs-fix: ## Run easy coding style in fix mode
	php ../../../dev-ops/analyze/vendor/bin/ecs check --fix --config=../../../vendor/shopware/platform/easy-coding-standard.php src\
		&& php ../../../dev-ops/analyze/vendor/bin/ecs check --fix --config=easy-coding-standard.php src
.PHONY: ecs-fix

ecs-dry: ## Run easy coding style in dry mode
	php ../../../dev-ops/analyze/vendor/bin/ecs check --config=../../../vendor/shopware/platform/easy-coding-standard.php src\
		&& php ../../../dev-ops/analyze/vendor/bin/ecs check --config=easy-coding-standard.php src
.PHONY: ecs-dry

administration-fix: ## Run eslint on the administration files
	../../../vendor/shopware/platform/src/Administration/Resources/app/administration/node_modules/.bin/eslint --ignore-path .eslintignore --no-error-on-unmatched-pattern --config ../../../vendor/shopware/platform/src/Administration/Resources/app/administration/.eslintrc.js --ext .js,.vue --fix src/Resources/app/administration
.PHONY: administration-fix

storefront-fix: ## Run eslint on the storefront files
	../../../vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/.bin/eslint --ignore-path .eslintignore --no-error-on-unmatched-pattern --config ../../../vendor/shopware/platform/src/Storefront/Resources/app/storefront/.eslintrc.js --ext .js,.vue --fix src/Resources/app/storefront
.PHONY: storefront-fix

administration-lint: ## Run eslint on the administration files
	src/Resources/app/administration/node_modules/.bin/eslint --ignore-path .eslintignore --no-error-on-unmatched-pattern --config ../../../vendor/shopware/platform/src/Administration/Resources/app/administration/.eslintrc.js --ext .js,.vue src/Resources/app/administration
.PHONY: administration-lint

storefront-lint: ## Run eslint on the storefront files
	src/Resources/app/storefront/node_modules/.bin/eslint --ignore-path .eslintignore --no-error-on-unmatched-pattern --config ../../../vendor/shopware/platform/src/Storefront/Resources/app/storefront/.eslintrc.js --ext .js,.vue src/Resources/app/storefront;
.PHONY: storefront-lint

eslint: administration-lint ## Synonym to 'administration-lint'
.PHONY: eslint

eslint-fix: administration-fix ## Synonym to 'administration-fix'
.PHONY: eslint-fix


storefront-lint-styles: ## Lints the stylesheets using Stylelint
	cd src/Resources/app/storefront/ && \
	npm run lint-styles
.PHONY: lint-styles

storefront-fix-styles: ## Fixes the stylesheets using Stylelint
	cd src/Resources/app/storefront/ && \
	npm run fix-styles
.PHONY: fix-styles