forked from FamousWolf/week-planner-card
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (37 loc) · 1.14 KB
/
Makefile
File metadata and controls
44 lines (37 loc) · 1.14 KB
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
.DEFAULT_GOAL := help
## Install required npm packages
install:
npm install
## Build file
build:
npm run build
## Set version in README.md, package.json and package-lock.json. Option: VERSION=x.y.z
set-version:
ifndef VERSION
$(error VERSION is not set. Usage: make version VERSION=x.y.z)
endif
@echo "$(VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$' || \
(echo "VERSION must be in the format x.y.z" && exit 1)
@echo "Updating README.md..."
@sed -i 's|\(/local/week-planner-card.js?version=\)[0-9]\+\.[0-9]\+\.[0-9]\+|\1$(VERSION)|g' README.md
@echo "Updating package.json and package-lock.json..."
@npm version $(VERSION) --no-git-tag-version
@echo "Version is now set to ${VERSION}"
## Show this help message
help:
@echo "Usage:"
@echo " make <target> [options]"
@echo ""
@echo "Available targets:"
@awk '\
/^## / { desc = substr($$0, 4); next } \
/^[a-zA-Z0-9_.-]+:/ { \
if (desc) { \
line = $$0; \
sub(/:.*/, "", line); \
target = line; \
# dynamically pad to align descriptions \
printf " %-25s %s\n", target, desc; \
desc = "" \
} \
}' $(MAKEFILE_LIST)