-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathbuild.sh
executable file
·75 lines (62 loc) · 2.78 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
NAME=$(node -pe 'JSON.parse(process.argv[1]).name' "$(cat ./manifest.json)");
VERSION_NAME=$(node -pe 'JSON.parse(process.argv[1]).version_name' "$(cat ./manifest.json)");
# since we don't currently do this automatically anywhere else
npm run beautify
# remove old build
rm -rf dist build;
mkdir dist;
mkdir -p build/unpackaged;
# copy the required files
cp manifest.json build/unpackaged/manifest.json;
cp schema.json build/unpackaged/schema.json;
cp -R css build/unpackaged/css;
cp -R img build/unpackaged/img;
cp -R js build/unpackaged/js;
cp -R windows build/unpackaged/windows;
mkdir -p build/unpackaged/node_modules/async/dist;
cp node_modules/async/dist/async.js build/unpackaged/node_modules/async/dist/async.js;
mkdir -p build/unpackaged/node_modules/jquery/dist;
cp node_modules/jquery/dist/jquery.js build/unpackaged/node_modules/jquery/dist/jquery.js;
mkdir -p build/unpackaged/node_modules/materialize-css/dist/css;
cp node_modules/materialize-css/dist/css/materialize.css build/unpackaged/node_modules/materialize-css/dist/css/materialize.css
mkdir -p build/unpackaged/node_modules/materialize-css/dist/js;
cp node_modules/materialize-css/dist/js/materialize.js build/unpackaged/node_modules/materialize-css/dist/js/materialize.js
mkdir -p build/unpackaged/node_modules/moment;
cp node_modules/moment/moment.js build/unpackaged/node_modules/moment/moment.js
cd build;
# package it
zip -r ../dist/$VERSION_NAME-chrome-app.zip unpackaged;
# build desktop versions
build --tasks win-x86,win-x64,linux-x86,linux-x64,mac-x64 --mirror https://dl.nwjs.io/ --chrome-app ./unpackaged;
# create osx dmg
cd mac-x64;
echo "{
\"title\": \"$NAME\",
\"icon\": \"../unpackaged/img/icon.icns\",
\"contents\": [
{ \"x\": 448, \"y\": 344, \"type\": \"link\", \"path\": \"/Applications\" },
{ \"x\": 192, \"y\": 344, \"type\": \"file\", \"path\": \"$NAME.app\" }
],
\"code-sign\": {
\"signing-identity\": \"3rd Party Mac Developer Application: Matthew Cook (5BNMYJ6L8S)\"
}
}" > appdmg.json;
node ../../node_modules/appdmg/bin/appdmg.js appdmg.json ../../dist/$VERSION_NAME-mac-x64.dmg;
cd ..;
# clean up
mv win-x64-Setup.exe ../dist/$VERSION_NAME-win-x64-setup.exe
mv win-x86-Setup.exe ../dist/$VERSION_NAME-win-x86-setup.exe
zip -r ../dist/$VERSION_NAME-linux-x86.zip linux-x86;
zip -r ../dist/$VERSION_NAME-linux-x64.zip linux-x64;
cd ../dist;
rm -rf ../build;
# generate MD5 hashes
echo "MD5 Checksums" >> checksums.txt;
echo "-------------" >> checksums.txt;
md5 -r $VERSION_NAME-chrome-app.zip >> checksums.txt;
md5 -r $VERSION_NAME-linux-x64.zip >> checksums.txt;
md5 -r $VERSION_NAME-linux-x86.zip >> checksums.txt;
md5 -r $VERSION_NAME-mac-x64.dmg >> checksums.txt;
md5 -r $VERSION_NAME-win-x64-setup.exe >> checksums.txt;
md5 -r $VERSION_NAME-win-x86-setup.exe >> checksums.txt;