-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
29 lines (24 loc) · 1.15 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
SRC := ./extension
DIST := ./dist
ZIP := $(shell which zip)
PACKAGE_NAME := chrome-skk
PACKAGE_VERSION := $(shell node -e "fs=require('fs');console.log(JSON.parse(fs.readFileSync(process.argv[1])).version)" ./extension/manifest.json)
NODE_MODULES := ../node_modules
MANIFEST := manifest.json
build: 3rd-party-licenses.txt
rm -rf $(DIST); \
mkdir -p $(DIST); \
cd $(SRC); \
find . -type f -not -name '$(MANIFEST)' -print | $(ZIP) ../$(DIST)/$(PACKAGE_NAME)-$(PACKAGE_VERSION).zip -@; \
$(ZIP) ../$(DIST)/$(PACKAGE_NAME)-$(PACKAGE_VERSION).zip -j $(NODE_MODULES)/pako/dist/pako_inflate.es5.min.js; \
$(ZIP) ../$(DIST)/$(PACKAGE_NAME)-$(PACKAGE_VERSION).zip -j ../3rd-party-licenses.txt; \
$(ZIP) ../$(DIST)/$(PACKAGE_NAME)-$(PACKAGE_VERSION).zip -j ../LICENSE; \
cp $(MANIFEST) ../$(DIST); \
sed -i 's/ (dev)//g' ../$(DIST)/$(MANIFEST); \
sed -i 's/.dev"/"/g' ../$(DIST)/$(MANIFEST); \
$(ZIP) ../$(DIST)/$(PACKAGE_NAME)-$(PACKAGE_VERSION).zip -j ../$(DIST)/$(MANIFEST); \
rm -f ../$(DIST)/$(MANIFEST);
3rd-party-licenses.txt: package.json
npx generate-license-file --input package.json --output 3rd-party-licenses.txt --overwrite
clean:
rm -rf $(DIST)