-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
35 lines (25 loc) · 1.41 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
NPM_MOD_DIR := $(CURDIR)/node_modules
NPM_BIN_DIR := $(NPM_MOD_DIR)/.bin
.PHONY: xpi install_dependency install_hook lint format init_extlib 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: init_extlib install_extlib lint
rm -f ./*.xpi
zip -r -9 tst-lock-tree-collapsed.xpi manifest.json _locales extlib common background options resources -x '*/.*' >/dev/null 2>/dev/null
init_extlib:
git submodule update --init
update_extlib:
git submodule foreach 'git checkout trunk || git checkout main || git checkout master && git pull'
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