.PHONY: default
default: help

_MISE_EN_PLACE_PACKAGE_NAME = @meistrari/mise-en-place

## Public commands

.editorconfig: ./node_modules/$(_MISE_EN_PLACE_PACKAGE_NAME)/.editorconfig ## Copy/update .editorconfig file from @meistrari/mise-en-place package
	@cp ./node_modules/$(_MISE_EN_PLACE_PACKAGE_NAME)/.editorconfig .editorconfig

.PHONY: update-meistrari-libs
update-meistrari-libs: ## Update @meistrari/* packages recursively in the workspace
	@npx exec mise-en-place update-meistrari-libraries

.PHONY: mise-en-place
mise-en-place: .editorconfig ## Setup the mise en place to start cooking
	@echo "export { default } from '$(_MISE_EN_PLACE_PACKAGE_NAME)/eslint'" > eslint.config.mjs
	@echo "Mise en place is ready! 🍳"

## Hidden commands

.PHONY: help
help:
	@echo "Make tasks:"
	@grep -hE '^[%a-zA-Z_-]+:.*?## .*$$' Makefile ./node_modules/$(_MISE_EN_PLACE_PACKAGE_NAME)/Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m  %-17s\033[0m %s\n", $$1, $$2}'
	@echo ""
