refactor: refresh from template
This commit is contained in:
@@ -1,40 +1,78 @@
|
||||
BUN ?= bun
|
||||
# ENV
|
||||
|
||||
ifeq (,$(shell which bun))
|
||||
NPM ?= npm
|
||||
endif
|
||||
|
||||
NPM ?= bun
|
||||
GIT ?= git
|
||||
TEMPLATE_REPOSITORY ?= ssh://git@git.klemek.fr:42617/klemek/vue-template.git
|
||||
TEMPLATE_REMOTE ?= template
|
||||
|
||||
.PHONY: help
|
||||
help: ## show this message
|
||||
@echo "Usage: make [target1] (target2) ..."
|
||||
@echo "Usage: $(MAKE) [target1] [target2] ..."
|
||||
@echo ""
|
||||
@echo "Commands/Targets:"
|
||||
@grep -E '(^[a-zA-Z0-9_%-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
|
||||
@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:"
|
||||
@grep -E '^[a-zA-Z0-9_-]+\s*[?:]?=.*$$' $(MAKEFILE_LIST) | grep -Eo '^[a-zA-Z0-9_-]+' | xargs -I {} make -s print-{}
|
||||
@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 = $($*)'
|
||||
|
||||
node_modules: bun.lock
|
||||
@$(BUN) install
|
||||
# FILES
|
||||
|
||||
build: node_modules ## build static site in "dist"
|
||||
@$(BUN) run build
|
||||
node_modules: bun.lock
|
||||
@$(MAKE) -s npm-install
|
||||
|
||||
# ACTIONS
|
||||
|
||||
.PHONY: install
|
||||
install: npm-install ## install project
|
||||
|
||||
.PHONY: update
|
||||
update: npm-update ## update project
|
||||
|
||||
.PHONY: build
|
||||
build: npm-run-build ## build static site in "dist"
|
||||
|
||||
.PHONY: dev
|
||||
dev: node_modules ## run dev version of static site
|
||||
@$(BUN) run dev
|
||||
dev: npm-run-dev ## run dev server
|
||||
|
||||
lint: node_modules ## lint code
|
||||
@$(BUN) run lint
|
||||
@$(BUN) run type-check
|
||||
.PHONY: lint
|
||||
lint: npm-run-lint npm-run-type-check ## lint code
|
||||
|
||||
format: node_modules ## fix and reformat code
|
||||
@$(BUN) run format
|
||||
@$(BUN) run lint-fix
|
||||
.PHONY: format
|
||||
format: npm-run-lint-fix ## fix and reformat code
|
||||
|
||||
update-template: ## fetch and merge core changes from template
|
||||
@(git remote | grep template &>/dev/null) || git remote add template https://github.com/klemek/vue-boilerplate.git
|
||||
git fetch template
|
||||
git merge template/master --allow-unrelated-histories
|
||||
.PHONY: update-template
|
||||
update-template: git-remote-template git-fetch-template git-merge-template ## fetch and merge core changes from template
|
||||
|
||||
# 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 $*
|
||||
|
||||
.PHONY: git-remote-template
|
||||
git-remote-template: ## git remote add template
|
||||
@(git remote | grep $(TEMPLATE_REMOTE) &>/dev/null) || git remote add $(TEMPLATE_REMOTE) $(TEMPLATE_REPOSITORY)
|
||||
|
||||
.PHONY: git-fetch-template
|
||||
git-fetch-template: ## git fetch template
|
||||
$(GIT) fetch $(TEMPLATE_REMOTE)
|
||||
|
||||
.PHONY: git-merge-template
|
||||
git-merge-template: ## git merge template/main
|
||||
$(GIT) merge $(TEMPLATE_REMOTE)/main --allow-unrelated-histories
|
||||
|
||||
Reference in New Issue
Block a user