-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
245 lines (227 loc) · 7.94 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
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/bin/bash
writeHeader() {
echo '<!DOCTYPE html>'
echo '<html lang="en">'
echo '<head>'
echo '<title>GridSound</title>'
echo '<meta charset="utf-8"/>'
echo '<meta name="viewport" content="width=device-width, user-scalable=no"/>'
echo '<meta name="description" content="A free and Open-Source DAW (digital audio workstation)"/>'
echo '<meta name="google" content="notranslate"/>'
echo '<meta name="theme-color" content="#1b1b31"/>'
echo '<meta property="og:type" content="website"/>'
echo '<meta property="og:title" content="GridSound"/>'
echo '<meta property="og:url" content="https://gridsound.com/"/>'
echo '<meta property="og:image" content="https://gridsound.com/assets/og-image.jpg"/>'
echo '<meta property="og:image:width" content="800"/>'
echo '<meta property="og:image:height" content="400"/>'
echo '<meta property="og:description" content="an online digital audio workstation"/>'
echo '<link rel="shortcut icon" href="assets/favicon.png"/>'
}
writeBody() {
echo '</head>'
echo '<body>'
echo '<noscript>GridSound needs JavaScript to run</noscript>'
}
writeEnd() {
echo '</body>'
echo '</html>'
}
writeCSS() {
printf '<link rel="stylesheet" href="%s"/>\n' "${CSSfiles[@]}"
}
writeJS() {
printf '<script src="%s"></script>\n' "${JSfiles[@]}"
}
writeCSScompress() {
echo -n '' > allCSS.css
cat "${CSSfiles[@]}" >> allCSS.css
echo '<style>'
csso allCSS.css
echo '</style>'
rm allCSS.css
}
writeJScompress() {
echo '"use strict";' > allJS.js
cat "${JSfiles[@]}" >> allJS.js
echo '<script>'
terser allJS.js --compress --mangle --toplevel --mangle-props "regex='^[$]'"
echo '</script>'
rm allJS.js
}
declare -a CSSfiles=(
"assets/fonts/fonts.css"
"gs-ui-components/gsui.css"
"gs-ui-components/gsuiIcon/gsuiIcon.css"
"gs-ui-components/gsuiRipple/gsuiRipple.css"
"gs-ui-components/gsuiDropdown/gsuiDropdown.css"
"gs-ui-components/gsuiActionMenu/gsuiActionMenu.css"
"gs-ui-components/gsuiComAvatar/gsuiComAvatar.css"
"gs-ui-components/gsuiComButton/gsuiComButton.css"
"gs-ui-components/gsuiComProfile/gsuiComProfile.css"
"gs-ui-components/gsuiComPlayer/gsuiComPlayer.css"
"gs-ui-components/gsuiComPlaylist/gsuiComPlaylist.css"
"gs-ui-components/gsuiPopup/gsuiPopup.css"
"src/css/form.css"
"src/css/root.css"
"src/css/reset.css"
"src/css/main.css"
"src/css/head.css"
"src/css/footer.css"
"src/css/homePage.css"
"src/css/authPages.css"
"src/css/cmpPage.css"
)
declare -a JSfiles=(
"gs-utils/gs-utils.js"
"gs-utils/gs-utils-dom.js"
"gs-utils/gs-utils-json.js"
"gs-utils/gs-utils-audio.js"
"gs-utils/gs-utils-files.js"
"gs-api-client/gsapiClient.js"
"daw-core/src/json/composition.js"
"daw-core/src/json/block.js"
"daw-core/src/json/channel.js"
"daw-core/src/json/channelMain.js"
"daw-core/src/json/channels.js"
"daw-core/src/json/drum.js"
"daw-core/src/json/drumcut.js"
"daw-core/src/json/drumrow.js"
"daw-core/src/json/effects.delay.js"
"daw-core/src/json/effects.filter.js"
"daw-core/src/json/effects.reverb.js"
"daw-core/src/json/effects.waveshaper.js"
"daw-core/src/json/env.js"
"daw-core/src/json/key.js"
"daw-core/src/json/lfo.js"
"daw-core/src/json/oscillator.js"
"daw-core/src/json/synth.js"
"daw-core/src/json/track.js"
"daw-core/src/DAWCore.js"
"daw-core/src/DAWCoreBuffers.js"
"daw-core/src/DAWCoreCompositionExportWAV.js"
"daw-core/src/DAWCoreCompositionFormat.js"
"daw-core/src/DAWCoreDestination.js"
"daw-core/src/DAWCoreHistory.js"
"daw-core/src/DAWCoreHistoryTexts.js"
"daw-core/src/DAWCoreSlicesBuffers.js"
"daw-core/src/DAWCoreComposition.js"
"daw-core/src/DAWCoreSlices.js"
"daw-core/src/DAWCoreDrums.js"
"daw-core/src/DAWCoreKeys.js"
"daw-core/src/controllers/blocks.js"
"daw-core/src/controllers/drumrows.js"
"daw-core/src/controllers/drums.js"
"daw-core/src/controllers/effects.js"
"daw-core/src/controllers/keys.js"
"daw-core/src/controllers/mixer.js"
"daw-core/src/controllers/synth.js"
"daw-core/src/controllers/tracks.js"
"daw-core/src/controllers/slicer.js"
"daw-core/src/actions/common/addPatternBuffer.js"
"daw-core/src/actions/common/calcNewDuration.js"
"daw-core/src/actions/common/calcNewKeysDuration.js"
"daw-core/src/actions/common/createUniqueName.js"
"daw-core/src/actions/common/getDrumrowName.js"
"daw-core/src/actions/common/getNextIdOf.js"
"daw-core/src/actions/common/getNextOrderOf.js"
"daw-core/src/actions/common/patternOpenedByType.js"
"daw-core/src/actions/common/toggleSolo.js"
"daw-core/src/actions/common/updatePatternDuration.js"
"gs-wa-components/gswaNoise/gswaNoise.js"
"gs-wa-components/gswaReverbIR/gswaReverbIR.js"
"gs-wa-components/gswaLFO/gswaLFO.js"
"gs-wa-components/gswaEnvelope/gswaEnvelope.js"
"gs-wa-components/gswaMixer/gswaMixer.js"
"gs-wa-components/gswaSynth/gswaSynth.js"
"gs-wa-components/gswaKeysScheduler/gswaKeysScheduler.js"
"gs-wa-components/gswaDrumsScheduler/gswaDrumsScheduler.js"
"gs-wa-components/gswaSlicer/gswaSlicer.js"
"gs-wa-components/gswaBPMTap/gswaBPMTap.js"
"gs-wa-components/gswaEffects/gswaEffects.js"
"gs-wa-components/gswaFxDelay/gswaFxDelay.js"
"gs-wa-components/gswaFxFilter/gswaFxFilter.js"
"gs-wa-components/gswaFxReverb/gswaFxReverb.js"
"gs-wa-components/gswaFxWaveShaper/gswaFxWaveShaper.js"
"gs-wa-components/gswaDrumrows/gswaDrumrows.js"
"gs-wa-components/gswaScheduler/gswaScheduler.js"
"gs-wa-components/gswaEncodeWAV/gswaEncodeWAV.js"
"gs-wa-components/gswaStereoPanner/gswaStereoPanner.js"
"gs-wa-components/gswaPeriodicWaves/gswaPeriodicWaves.js"
"gs-wa-components/gswaMIDIParser/gswaMIDIParser.js"
"gs-wa-components/gswaMIDIParser/gswaMIDIToKeys.js"
"gs-wa-components/gswaMIDIDevices/gswaMIDIDevices.js"
"gs-wa-components/gswaMIDIDevices/gswaMIDIInput.js"
"gs-wa-components/gswaMIDIDevices/gswaMIDIOutput.js"
"src/html/main.html.js"
"src/html/cmpPage.html.js"
"src/html/homePage.html.js"
"src/html/userPage.html.js"
"src/html/authPage.html.js"
"src/html/forgotpassPage.html.js"
"src/html/resetpassPage.html.js"
"gs-ui-components/gsuiComProfile/gsuiComProfile.html.js"
"gs-ui-components/gsuiComPlayer/gsuiComPlayer.html.js"
"gs-ui-components/gsuiComPlaylist/gsuiComPlaylist.html.js"
"gs-ui-components/gsuiDotlineSVG/gsuiDotlineSVG.html.js"
"gs-ui-components/gsuiPopup/gsuiPopup.html.js"
"gs-ui-components/gsui0ne/gsui0ne.js"
"gs-ui-components/gsuiRipple/gsuiRipple.js"
"gs-ui-components/gsuiDropdown/getAbsPos.js"
"gs-ui-components/gsuiDropdown/gsuiDropdown.js"
"gs-ui-components/gsuiActionMenu/gsuiActionMenu.js"
"gs-ui-components/gsuiComAvatar/gsuiComAvatar.js"
"gs-ui-components/gsuiComButton/gsuiComButton.js"
"gs-ui-components/gsuiComProfile/gsuiComProfile.js"
"gs-ui-components/gsuiComPlayer/gsuiComPlayer.js"
"gs-ui-components/gsuiComPlaylist/gsuiComPlaylist.js"
"gs-ui-components/gsuiDotlineSVG/gsuiDotlineSVG.js"
"gs-ui-components/gsuiPopup/gsuiPopup.js"
"src/js/main.js"
"src/js/authPage.js"
"src/js/homePage.js"
"src/js/userPage.js"
"src/js/cmpPage.js"
"src/js/resetpassPage.js"
"src/js/forgotpassPage.js"
"src/js/run.js"
)
buildDev() {
filename='index.html'
echo "Build $filename"
writeHeader > $filename
writeCSS >> $filename
writeBody >> $filename
echo '<script>function lg( a ) { return console.log.apply( console, arguments ), a; }</script>' >> $filename
writeJS >> $filename
writeEnd >> $filename
}
buildProd() {
filename='index-prod.html'
echo "Build $filename"
writeHeader > $filename
writeCSScompress >> $filename
writeBody >> $filename
echo '<script>function lg(a){return a}</script>' >> $filename
writeJScompress >> $filename
writeEnd >> $filename
}
updateDep() {
git submodule init
git submodule update --remote
}
if [ $# = 0 ]; then
echo ' -------------------------------'
echo ' .:: GridSound build shellscript ::.'
echo ' -----------------------------------'
echo ''
echo './build.sh dev ---> create "index.html" for development'
echo './build.sh prod --> create "index-prod.html" for production'
echo './build.sh dep ---> update all the submodules'
elif [ $1 = "dep" ]; then
updateDep
elif [ $1 = "dev" ]; then
buildDev
elif [ $1 = "prod" ]; then
buildProd
fi