-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 1.17 KB
/
Makefile
File metadata and controls
49 lines (39 loc) · 1.17 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
45
46
47
48
49
.DELETE_ON_ERROR:
NODE_BIN := ./node_modules/.bin
export PATH := $(NODE_BIN):$(PATH)
BUILD_DIR := ./dist
SRC_DIR := ./src
ZIP := $(shell pwd -P)/extension.zip
UPDATE := major minor patch
# Create a release archive for the extension
$(ZIP): clean build
@rm -f $@
cd $(BUILD_DIR) && zip -r $@ .
$(UPDATE): node_modules/.install
@source `git --exec-path`/git-sh-setup && require_clean_work_tree "bump version" "Please commit or stash them."
$(eval NEW_VERSION := $(shell $(NODE_BIN)/semver --increment $@ `$(NODE_BIN)/json -f package.json version`))
@json --in-place -f package.json -e "this.version='$(NEW_VERSION)'";
@json --in-place -f $(SRC_DIR)/manifest.json -e "this.version='$(NEW_VERSION)'";
@git add package.json $(SRC_DIR)/manifest.json
@npm install
@git add package-lock.json
git commit -m "$(NEW_VERSION)"
git tag -a "v$(NEW_VERSION)" -m "$(NEW_VERSION)"
.PHONY: release
release: $(ZIP)
# Install Node based dependencies
node_modules/.install: package.json
@npm install
@touch $@
.PHONY: build
build: node_modules/.install
@npm run build
.PHONY: clean
clean:
@rm -rf $(BUILD_DIR)
.PHONY: lint
lint:
@npm run lint
.PHONY: start
start: node_modules/.install
@npm start