forked from silverwind/droppy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (56 loc) · 2.68 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
# os deps: node npm git jq docker
# npm deps: eslint eslint-plugin-unicorn stylelint uglify-js grunt npm-check-updates yarn
X86 := $(shell uname -m | grep 86)
ifeq ($(X86),)
IMAGE=silverwind/armhf-droppy
else
IMAGE=silverwind/droppy
endif
JQUERY_FLAGS=-ajax,-css,-deprecated,-effects,-event/alias,-event/focusin,-event/trigger,-wrap,-core/ready,-deferred,-exports/amd,-sizzle,-offset,-dimensions,-serialize,-queue,-callbacks,-event/support,-event/ajax,-attributes/prop,-attributes/val,-attributes/attr,-attributes/support,-manipulation/setGlobalEval,-manipulation/support,-manipulation/var/rcheckableType,-manipulation/var/rscriptType
deps:
yarn global add eslint@latest eslint-plugin-unicorn@latest stylelint@latest uglify-js@latest grunt@latest npm-check-updates@latest
lint:
eslint --color --ignore-pattern *.min.js --plugin unicorn --rule 'unicorn/catch-error-name: [2, {name: err}]' --rule 'unicorn/throw-new-error: 2' server client *.js
stylelint client/*.css
build:
touch client/client.js
node droppy.js build
publish:
if git ls-remote --exit-code origin &>/dev/null; then git push -u -f --tags origin master; fi
if git ls-remote --exit-code gogs &>/dev/null; then git push -u -f --tags gogs master; fi
npm publish
docker:
@echo Preparing docker image $(IMAGE)...
docker pull mhart/alpine-node:latest
docker rm -f "$$(docker ps -a -f='ancestor=$(IMAGE)' -q)" 2>/dev/null || true
docker rmi "$$(docker images -qa $(IMAGE))" 2>/dev/null || true
docker build --no-cache=true -t $(IMAGE) .
docker tag "$$(docker images -qa $(IMAGE):latest)" $(IMAGE):"$$(cat package.json | jq -r .version)"
docker-push:
docker push $(IMAGE):"$$(cat package.json | jq -r .version)"
docker push $(IMAGE):latest
update:
ncu --packageFile package.json -ua
rm -rf node_modules
yarn
touch client/client.js
deploy:
git commit --allow-empty --allow-empty-message -m ""
if git ls-remote --exit-code demo &>/dev/null; then git push -f demo master; fi
if git ls-remote --exit-code droppy &>/dev/null; then git push -f droppy master; fi
git reset --hard HEAD~1
jquery:
git clone --depth 1 https://github.com/silverwind/jquery /tmp/jquery
cd /tmp/jquery; npm run build; grunt custom:$(JQUERY_FLAGS); grunt remove_map_comment
cat /tmp/jquery/dist/jquery.min.js | perl -pe 's|"3\..+?"|"3"|' > $(CURDIR)/client/jquery-custom.min.js
rm -rf /tmp/jquery
npm-patch:
npm version patch
npm-minor:
npm version minor
npm-major:
npm version major
patch: lint build npm-patch deploy publish docker docker-push
minor: lint build npm-minor deploy publish docker docker-push
major: lint build npm-major deploy publish docker docker-push
.PHONY: deps lint publish docker update deploy jquery npm-patch npm-minor npm-major patch minor major