-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (62 loc) · 2.02 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env
.PHONY: help build clean cdn dev docs deploy dist install publish test
STATUS:="\x1b[96;01m\xE2\x80\xA2\x1b[0m"
ECHO = @echo "\033[0;34m$(1)\033[0m$(2)"
# HELP
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@echo
@echo 🚀 DOMX:
@echo
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-10s\033[0m %s\n", $$1, $$2}'
@echo
@echo USAGE:
@echo See README.md
@echo
.DEFAULT_GOAL := help
# TASKS
clean: ## Clean the project
@echo $(STATUS) Cleaning...
@rm -rf ./node_modules
@rm -rf ./dist
deploy: ## Deploy the project
@echo $(STATUS) Deploying...
@git branch -D gh-pages
@git checkout -b gh-pages
@git merge main --no-commit --no-ff
@make clean
@make install
@make docs
@git add .
@git commit -m 'deploy'
@git push -f origin gh-pages
@git checkout main
dev: ## Run the project in development mode
@echo $(STATUS) Running in development mode...
@${MAKE} -j 2 dev-docs dev-js
dev-js: ## Run the js in development mode
@echo $(STATUS) Running js in development mode...
@npx esbuild ./src/domx.ts --outdir=docs/static/scripts --watch --bundle --sourcemap
dev-docs: ## Run the docs in development mode
@echo $(STATUS) Running docs in development mode...
@npx http-server docs --gzip
dist: ## Build the project for distribution
@echo $(STATUS) Building...
@rm -rf dist
@mkdir dist
@npx esbuild ./src/domx.ts --outdir=dist --bundle --sourcemap --minify --out-extension:.js=.min.js
@zip -r dist/domx.zip dist
docs: ## Build the project documentation
@npx esbuild ./src/domx.ts --outdir=docs/static/scripts --bundle --sourcemap --minify
install: ## Install the project
@echo $(STATUS) Installing...
@npm install
kill: ## Kill the project
@echo $(STATUS) Killing...
@lsof -i :8081 | grep LISTEN | awk '{print $2}' | xargs kill -9
publish: ## Publish the project to npm
@echo $(STATUS) Publish package...
@npm publish --access public
test: ## Run tests
@echo $(STATUS) Testing...
@node ./cmd/test.js FILTER=$(FILTER)