forked from piroor/tst-tab-drag-handle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (23 loc) · 1.28 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
NPM_MOD_DIR := $(CURDIR)/node_modules
NPM_BIN_DIR := $(NPM_MOD_DIR)/.bin
.PHONY: xpi install_dependency install_hook lint format update_extlib install_extlib
all: xpi
install_dependency:
[ -e "$(NPM_BIN_DIR)/eslint" -a -e "$(NPM_BIN_DIR)/jsonlint-cli" ] || npm install
install_hook:
echo '#!/bin/sh\nmake lint' > "$(CURDIR)/.git/hooks/pre-commit" && chmod +x "$(CURDIR)/.git/hooks/pre-commit"
lint: install_dependency
"$(NPM_BIN_DIR)/eslint" . --ext=.js --report-unused-disable-directives
find . -type d -name node_modules -prune -o -type f -name '*.json' -print | xargs "$(NPM_BIN_DIR)/jsonlint-cli"
format: install_dependency
"$(NPM_BIN_DIR)/eslint" . --ext=.js --report-unused-disable-directives --fix
xpi: update_extlib install_extlib lint
rm -f ./*.xpi
zip -r -9 tst-tab-drag-handle.xpi manifest.json _locales extlib common background options resources -x '*/.*' >/dev/null 2>/dev/null
update_extlib:
git submodule update --init
install_extlib:
rm -f extlib/*.js
cp submodules/webextensions-lib-configs/Configs.js extlib/; echo 'export default Configs;' >> extlib/Configs.js
cp submodules/webextensions-lib-options/Options.js extlib/; echo 'export default Options;' >> extlib/Options.js
cp submodules/webextensions-lib-l10n/l10n.js extlib/; echo 'export default l10n;' >> extlib/l10n.js