-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdeploy.sh
More file actions
47 lines (35 loc) Β· 1 KB
/
deploy.sh
File metadata and controls
47 lines (35 loc) Β· 1 KB
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
#!/bin/bash
echo "π Installing node modules"
npm install
echo "π Building minified javascript"
npm run build
# Trim node modules down to the essentials:
# we want the WASM to be loadable from our host
# so that CORS isn't triggered
cd node_modules
for ext in "svg" "png" "wasm" "css"
do
echo "π¦ Preserving $ext files for upload"
find . -name "*.$ext" | xargs -n1 dirname | uniq | xargs -I '{}' mkdir -p ../tmp/{}
find . -name "*.$ext" -exec mv {} ../tmp/{} \;
done
echo "π Deleting the rest of the node_modules directory"
cd ..
rm -rf ./node_modules
mkdir node_modules
cd tmp
for ext in "svg" "png" "wasm" "css"
do
echo "π Repositioning $ext files"
find . -name "*.$ext" | xargs -n1 dirname | uniq | xargs -I '{}' mkdir -p ../node_modules/{}
find . -name "*.$ext" -exec mv {} ../node_modules/{} \;
done
cd ..
echo "π Deploying"
firebase deploy
echo
echo "π Re-installing node modules"
npm install
echo "π Cleaning up temporary files"
rm -rf ./tmp
echo "π Done!"