This repository has been archived by the owner on Jul 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathmake.sh
executable file
·195 lines (173 loc) · 6.63 KB
/
make.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
bold=$(tput bold)
standout=$(tput smso)
normal=$(tput sgr0)
green=$(tput setaf 2)
red=$(tput setaf 1)
abort() {
echo
echo
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' \#
echo
echo ${red}Operation failed${normal}
echo
echo
exit 1
}
trap 'abort' 0
set -e
echo
if [ "$1" == "--debug" ]; then
echo Compiling AlienTube in ${standout}debug${normal} mode.
else
echo Compiling AlienTube in ${standout}production${normal} mode.
fi
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' \#
echo
echo ${standout}Removing old files${normal}
echo Removing TypeScript mapping folders.
rm -rf Chrome/TypeScript
rm -rf Safari.safariextension/TypeScript
rm -rf Firefox/data/TypeScript
echo Removing TypeScript code-mapping file.
rm -f Chrome/js/script.js.map
rm -f Safari.safariextension/js/script.js.map
rm -f Firefox/data/script.js.map
rm -f lib/script.js.map
rm -f lib/script-es5.js.map
echo Removing options page TypeScript code-mapping file.
rm -f Chrome/js/options.js.map
rm -f Safari.safariextension/js/options.js.map
rm -f Firefox/data/options.js.map
rm -f lib/options.js.map
rm -f lib/options-es5.js.map
echo Removing SASS stylesheet code-mapping file.
rm -f Chrome/res/style.css.map
rm -f Safari.safariextension/res/style.css.map
rm -f Firefox/data/style.css.map
echo
echo
echo ${standout}Compiling SASS style files.${normal}
echo Compiling Main SASS stylesheet.
sass res/style.scss res/style.css
echo Compiling Options SASS stylesheet
sass res/options.scss res/options.css
echo
echo
echo ${standout}Copying static browser resources${normal}
echo Copying Chrome Resources
mkdir -p Chrome/res
mkdir -p Chrome/js
cp -fr res/redditbroken.svg Chrome/res
cp -fr res/redditoverload.svg Chrome/res
cp -fr res/redditblocked.svg Chrome/res
cp -fr res/icon128.png Chrome/res
cp -fr res/options.css Chrome/res
cp -fr lib/snuownd.js Chrome/js
echo Copying Safari Resources
mkdir -p Safari.safariextension/res
mkdir -p Safari.safariextension/js
cp -fr res/redditbroken.svg Safari.safariextension/res
cp -fr res/redditoverload.svg Safari.safariextension/res
cp -fr res/redditblocked.svg Safari.safariextension/res
cp -fr res/icon128.png Safari.safariextension/res
cp -fr res/options.css Safari.safariextension/res
cp -fr lib/snuownd.js Safari.safariextension/js
cp -fr lib/handlebars-v3.0.3.js Safari.safariextension/js
echo Copying Firefox Resources
mkdir -pv Firefox/data
cp -fr res/redditbroken.svg Firefox/data
cp -fr res/redditoverload.svg Firefox/data
cp -fr res/redditblocked.svg Firefox/data
cp -fr res/icon128.png Firefox/data
cp -fr res/options.css Firefox/data
cp -fr lib/snuownd.js Firefox/data
cp -fr lib/handlebars-v3.0.3.js Firefox/data
echo
echo
echo ${standout}Updating Options HTML Page${normal}
cp -vf options.html Chrome/res/options.html
cp -vf options.html Firefox/data/options.html
cp -vf options.html Safari.safariextension/res/options.html
echo
echo
echo ${standout}Compiling TypeScript Files.${normal}
if [ "$1" == "--debug" ]; then
echo Compiling Options page TypeScript in ES5 compatibility mode without comments with source map.
tsc --target ES5 --out lib/options-es5.js TypeScript/typings/es5-compatibility.ts TypeScript/Options/Options.ts --removeComments --sourcemap
echo Compiling Application TypeScript in ES5 compatibility mode without comments with source map.
tsc --target ES5 --out lib/script-es5.js TypeScript/typings/es5-compatibility.ts TypeScript/index.ts --removeComments --sourcemap
echo Compiling Options page TypeScript file without comments with source map.
tsc --target ES6 --out lib/options.js TypeScript/Options/Options.ts --removeComments --sourcemap
echo Compiling Application TypeScript file without comments with source map.
tsc --target ES6 --out lib/script.js TypeScript/index.ts --removeComments --sourcemap
else
echo Compiling Options page TypeScript in ES5 compatibility mode with comments.
tsc --target ES5 --out lib/options-es5.js TypeScript/typings/es5-compatibility.ts TypeScript/Options/Options.ts
echo Compiling Application page TypeScript in ES5 compatibility mode with comments.
tsc --target ES5 --out lib/script-es5.js TypeScript/typings/es5-compatibility.ts TypeScript/index.ts
echo Compiling Options page TypeScript file with comments.
tsc --target ES6 --out lib/options.js TypeScript/Options/Options.ts
echo Compiling Application page TypeScript file with comments.
tsc --target ES6 --out lib/script.js TypeScript/index.ts
fi
echo
echo Copying TypeScript Files
cp -vf lib/options-es5.js Chrome/res/options.js
cp -vf lib/options-es5.js Firefox/data/options.js
cp -vf lib/options-es5.js Safari.safariextension/res/options.js
cp -vf lib/script-es5.js Chrome/js/script.js
cp -vf lib/script-es5.js Safari.safariextension/js/script.js
cp -vf lib/script-es5.js Firefox/data/script.js
echo
echo
echo ${standout}Copying Style Files${normal}
cp -vf res/style.css Chrome/res/style.css
cp -vf res/style.css Safari.safariextension/res/style.css
cp -vf res/style.css Firefox/data/style.css
echo
echo ${standout}Copying Template Files${normal}
cp -vf res/templates.html Chrome/res/templates.html
cp -vf res/templates.html Safari.safariextension/res/templates.html
cp -vf res/templates.html Firefox/data/templates.html
echo
echo
if [ "$1" == "--debug" ]; then
echo ${standout}Copying Development Sourcemaps${normal}
cp -vf lib/script.js.map Chrome/js/script.js.map
cp -vf lib/options.js.map Chrome/js/options.js.map
cp -vf lib/script-es5.js.map Safari.safariextension/js/script.js.map
cp -vf lib/options-es5.js.map Safari.safariextension/js/options.js.map
cp -vf lib/script.js.map Firefox/data/script.js.map
cp -vf lib/options.js.map Firefox/data/options.js.map
echo
cp -vf res/style.css.map Chrome/res/style.css.map
cp -vf res/style.css.map Safari.safariextension/res/style.css.map
cp -vf res/style.css.map Firefox/data/style.css.map
echo
echo Copying TypeScript source folders.
cp -fr TypeScript Chrome/
cp -fr TypeScript Safari.safariextension/
cp -fr TypeScript Firefox/data/TypeScript
echo
echo
fi
echo ${standout}Copying Localisation Files${normal}
echo Copying localisation files to Chrome
rsync -a --exclude=".*" _locales Chrome/
echo Copying localisation files to Safari
rsync -a --exclude=".*" _locales Safari.safariextension/
echo Copying localisation files to Firefox
rsync -a --exclude=".*" _locales Firefox/data/
if [ "$1" == "--debug" ] && [[ "$OSTYPE" == "darwin"* ]]; then
echo ${standout}Reloading Development Browsers${normal}
osascript reload.scpt
fi
echo
echo
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' \#
echo
echo ${green}Operation completed sucessfully${normal}
echo
echo
trap : 0