62 lines
1.2 KiB
Makefile
62 lines
1.2 KiB
Makefile
# ENV
|
|
|
|
ifeq (,$(shell which bun))
|
|
NPM ?= npm
|
|
endif
|
|
|
|
NPM ?= bun
|
|
GIT ?= git
|
|
|
|
.PHONY: help
|
|
help: ## show this message
|
|
@echo "Usage: $(MAKE) [target1] [target2] ..."
|
|
@echo ""
|
|
@echo "Commands/Targets:"
|
|
@cat $(MAKEFILE_LIST) | grep -E '(^[a-zA-Z0-9_%-]+:.*?##.*$$)|(^##)' | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
|
|
@echo ""
|
|
@echo "Environment:"
|
|
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z0-9_-]+\s*\??=.*$$' | grep -Eo '^[a-zA-Z0-9_-]+' | xargs -I {} $(MAKE) -s print-{} 2> /dev/null
|
|
|
|
.PHONY: print-%
|
|
print-%:
|
|
@echo -e '\033[32m$*\033[0m = $($*)'
|
|
|
|
# FILES
|
|
|
|
node_modules: bun.lock
|
|
@$(MAKE) -s npm-install
|
|
|
|
# ACTIONS
|
|
|
|
.PHONY: install
|
|
install: npm-install ## install project
|
|
|
|
.PHONY: install
|
|
install: npm-update ## update project
|
|
|
|
.PHONY: build
|
|
build: npm-run-build ## build static site in "dist"
|
|
|
|
.PHONY: dev
|
|
dev: npm-run-dev ## run dev server
|
|
|
|
.PHONY: lint
|
|
lint: npm-run-lint npm-run-type-check ## lint code
|
|
|
|
.PHONY: format
|
|
format: npm-run-lint-fix ## fix and reformat code
|
|
|
|
# TOOLS
|
|
|
|
.PHONY: npm-install
|
|
npm-install: ## npm install
|
|
$(NPM) install
|
|
|
|
.PHONY: npm-update
|
|
npm-update: ## npm update
|
|
$(NPM) update
|
|
|
|
.PHONY: npm-run-%
|
|
npm-run-%: node_modules ## npm run (script)
|
|
$(NPM) run $*
|