-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (80 loc) · 1.97 KB
/
Makefile
File metadata and controls
107 lines (80 loc) · 1.97 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#
# Binaries
#
BIN := ./node_modules/.bin
#
# Variables
#
PORT ?= 8080
SCRIPTS = $(shell find . -type f -name '*.js' -not -path "*build*")
BROWSERIFY_ARGS = -t vueify -t [ babelify --presets es2015-loose ] -t envify
DOMAIN = ysdn-admin.surge.sh
REPO = ysdn-2016/admin
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
#
# Tasks
#
build: install build-css build-assets build-js
build-js: build/bundle.js
build-css: build/styles.css
build-assets: build/favicon.png build/index.html build/assets
@cp build/index.html build/404.html
watch: install
@$(BIN)/budo index.js:bundle.js \
--port $(PORT) \
--live \
--css styles.css \
--pushstate -- $(BROWSERIFY_ARGS)
deploy: test
@echo "Building site for \033[0;33mproduction\033[0m environment..."
@make clean
@NODE_ENV=production make build
@echo "Deploying branch \033[0;33m$(BRANCH)\033[0m to Github pages..."
@(cd build && \
git init -q . && \
git add . && \
git commit -q -m "Deployment (auto-commit)" && \
echo "\033[0;90m" && \
git push "git@github.com:$(REPO).git" HEAD:gh-pages --force && \
echo "\033[0m")
@make clean
@echo "Deployed to \033[0;32mhttp://ysdn2016.com/admin/\033[0m"
ssh:
@ssh root@159.203.25.109
db\:connect:
@ssh -tt root@159.203.25.109 'dokku mongo:connect gradshow'
lint:
@xo
test: lint
clean:
@rm -rf build
clean-deps:
@rm -rf node_modules
#
# Shorthands
#
install: node_modules
#
# Targets
#
node_modules: package.json
@npm install
build/%: %
@mkdir -p $(@D)
@cp -r $< $@
build/index.html: index.html
@sed \
-e "s/\/bundle.js/\/admin\/bundle.js?`date +%s`/" \
-e "s/\/styles.css/\/admin\/styles.css?`date +%s`/" \
-e "s/\/favicon.png/\/admin\/favicon.png/" $< > $@
build/bundle.js: $(SCRIPTS)
@mkdir -p build/
@$(BIN)/browserify index.js $(BROWSERIFY_ARGS) -o $@
@if [[ "$(NODE_ENV)" == "production" ]]; then $(BIN)/uglifyjs $@ -o $@; fi
build/styles.css:
@mkdir -p build/
@cp styles.css build/styles.css
#
# Phony
#
.PHONY: develop clean clean-deps