-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathbuild.sh
executable file
·42 lines (32 loc) · 1.05 KB
/
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
40
41
42
#!/bin/bash
set -e
# this script's parent directory
cd $(dirname $0)
parentDir=$(pwd)
[ ! -d output ] && mkdir output
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_mug.png ./icon.png
echo "Creating emoji pack ..."
cd ${parentDir}
node ./lib/genpack.js
echo "Generating jxa compatible source ..."
npm run webpack
echo "Updating version ..."
cd output
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