forked from jsumners/alfred-emoji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·39 lines (27 loc) · 935 Bytes
/
build.sh
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
#!/bin/bash
PWD=$(pwd)
# this script's parent directory
cd $(dirname $0)
parentDir=$(pwd)
cd ${PWD}
npm run webpack
cd output
cp ${parentDir}/src/info.plist.xml ./info.plist
echo "Generating icons ..."
[ ! -d icons ] && mkdir icons
cd icons
node ${parentDir}/lib/genicons.js
cd ..
cp icons/beer.png ./icon.png
echo "Updating version ..."
curVersion=$(node -e "console.log(require('${parentDir}/package.json').version)")
sed -i '' 's/{{version}}/'${curVersion}'/' info.plist
echo "Injecting readme ..."
readme="${parentDir}/src/Readme.md"
sed -i '' -e "/{{readme}}/{r ${readme}" -e 'd' -e '}' info.plist
echo "Injecting auto-update script ..."
update="$(mktemp)"
cat ${parentDir}/src/update.sh | sed 's/&/\&/g; s/</\</g; s/>/\>/g' > ${update}
sed -i '' -e "/{{update_script}}/{r ${update}" -e 'd' -e '}' info.plist
echo "Bundling workflow ..."
zip -Z deflate -rq9 ${parentDir}/alfred-emoji.alfredworkflow * -x etc