|
1 | 1 | .PHONY: compile release test
|
2 | 2 | GULP=node_modules/.bin/gulp
|
3 | 3 | CURRENT_VERSION := $(shell sed -n '/"version":/{s/.*"version": "\([^"]*\)".*/\1/p;q}' package.json)
|
| 4 | +version ?= $(CURRENT_VERSION) ## Version to release |
4 | 5 |
|
5 |
| -all: compile test |
6 |
| -test: |
| 6 | +all: compile test ## (default) Run Compile and test targets |
| 7 | +test: ## runs all tests (equivalent to `npm test`) |
7 | 8 | npm test
|
8 |
| -compile: |
| 9 | +compile: ## compile the project, update package versions if specified, installs dependencies, and builds the project |
| 10 | + @echo "making v${version}" |
| 11 | + sed -i 's/"version": "[^"]*"/"version": "$(version)"/' selectize.jquery.json |
| 12 | + sed -i 's/"version": "[^"]*"/"version": "$(version)"/' package.json |
| 13 | + sed -i "s/\"version\": \"$(CURRENT_VERSION)\"/\"version\": \"$(version)\"/" package-lock.json |
9 | 14 | npm i
|
10 | 15 | rm -rf dist
|
11 | 16 | $(GULP) loadDependencies
|
12 | 17 | npm run build
|
13 |
| -release: |
| 18 | +release: ## make release version=x.x.x -- commit, tag, and npm publish the specified version |
14 | 19 | ifeq ($(strip $(version)),)
|
15 | 20 | @echo "\033[31mERROR:\033[0;39m No version provided."
|
16 | 21 | @echo "\033[1;30mmake release version=1.0.0\033[0;39m"
|
17 | 22 | else
|
18 |
| - sed -i.bak 's/"version": "[^"]*"/"version": "$(version)"/' selectize.jquery.json |
19 |
| - sed -i.bak 's/"version": "[^"]*"/"version": "$(version)"/' package.json |
20 |
| - sed -i.bak "s/\"version\": \"$(CURRENT_VERSION)\"/\"version\": \"$(version)\"/" package-lock.json |
21 | 23 | rm *.bak
|
22 | 24 | make compile
|
23 | 25 | npm test || exit 1
|
|
29 | 31 | npm publish --access public
|
30 | 32 | @echo "\033[32mv${version} released\033[0;39m"
|
31 | 33 | endif
|
| 34 | + |
| 35 | +help: ## show this help |
| 36 | + @sed -ne "s/^##\(.*\)/\1/p" $(MAKEFILE_LIST) |
| 37 | + @printf "────────────────────────`tput bold``tput setaf 2` Make Commands `tput sgr0`────────────────────────────────\n" |
| 38 | + @sed -ne "/@sed/!s/\(^[^#?=]*:\).*##\(.*\)/`tput setaf 2``tput bold`\1`tput sgr0`\2/p" $(MAKEFILE_LIST) |
| 39 | + @printf "────────────────────────`tput bold``tput setaf 4` Make Variables `tput sgr0`───────────────────────────────\n" |
| 40 | + @sed -ne "/@sed/!s/\(.*\)?=\(.*\)##\(.*\)/`tput setaf 4``tput bold`\1:`tput setaf 5`\2`tput sgr0`\3/p" $(MAKEFILE_LIST) |
| 41 | + @printf "───────────────────────────────────────────────────────────────────────\n" |
0 commit comments