-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·54 lines (41 loc) · 1.54 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
#!/bin/bash
set -e
chrome_dir="chrome_extension"
firefox_dir="firefox_extension"
if [ "$#" -eq 0 ]; then
echo 'Building common lib...'
(cd packages/common && npm install && npm run build)
echo '`common-lib` builded.'
fi
if [ "$#" -eq 0 ] || [ "$1" = "offscreen" ]; then
echo -e '\nBuilding offscreen...'
(cd packages/offscreen && npm install && npm run build)
echo '`offscreen` builded.'
fi
if [ "$#" -eq 0 ] || [ "$1" = "service-worker" ]; then
echo -e '\nBuilding service-worker...'
(cd packages/service-worker && npm install && npm run build)
echo '`service-worker` builded.'
fi
if [ "$#" -eq 0 ] || [ "$1" = "front" ]; then
echo -e '\nBuilding front...'
(cd packages/front && npm install && npm run build)
echo '`front` builded.'
fi
echo -e '\nCopying files...'
rm -rf dist/ &&
mkdir -p dist/$chrome_dir &&
cp -r packages/front/dist/* dist/$chrome_dir/ &&
cp -r packages/offscreen/dist/* dist/$chrome_dir/ &&
cp -r packages/service-worker/dist/* dist/$chrome_dir/ &&
cp -r public/* dist/$chrome_dir/
mkdir -p dist/$firefox_dir &&
cp -r dist/$chrome_dir/* dist/$firefox_dir
(rm dist/$chrome_dir/environment-firefox.json &&
mv dist/$chrome_dir/environment-chrome.json dist/$chrome_dir/environment.json)
(rm dist/$firefox_dir/environment-chrome.json &&
mv dist/$firefox_dir/environment-firefox.json dist/$firefox_dir/environment.json)
node dist/$chrome_dir/manifest.js chrome >>dist/$chrome_dir/manifest.json
node dist/$firefox_dir/manifest.js firefox >>dist/$firefox_dir/manifest.json
rm dist/*/manifest.js
echo 'Done!'