forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuselage.sh
executable file
·86 lines (67 loc) · 1.99 KB
/
fuselage.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
#!/bin/bash
if [[ $1 == "--help" || $1 == "-h" ]]; then
echo "Usage: fuselage.sh -a link|undo|next|latest -p fuselage;fuselage-icons"
exit 1
fi
while getopts ":a:p:" opt; do
case $opt in
a) action="$OPTARG"
;;
p) packages="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac
case $OPTARG in
-*) echo "Option $opt needs a valid argument"
exit 1
;;
esac
done
echo "action: $action"
action="${action:-link}"
packages="${packages:-fuselage}"
if [[ $action != "link" && $action != "undo" && $action != 'next' && $action != 'latest' ]]; then
echo "Invalid action"
exit 1
fi
if [[ $action == "next" || $action == "latest" ]]; then
eval "yarn up @rocket.chat/emitter@$action @rocket.chat/fuselage-polyfills@$action @rocket.chat/fuselage-toastbar@$action @rocket.chat/fuselage-tokens@$action @rocket.chat/css-in-js@$action @rocket.chat/styled@$action @rocket.chat/fuselage@$action @rocket.chat/fuselage-hooks@$action @rocket.chat/icons@$action @rocket.chat/logo@$action @rocket.chat/memo@$action @rocket.chat/message-parser@$action @rocket.chat/onboarding-ui@$action @rocket.chat/string-helpers@$action @rocket.chat/ui-kit@$action @rocket.chat/layout@$action"
exit 1
fi
if [[ $action != "undo" ]]; then
echo "linking local project"
else
echo "unlinking local project"
fi
cd ./node_modules/@rocket.chat
for i in $(echo $packages | tr ";" "\n")
do
rm -rf $i
if [[ $action != "undo" ]]; then
ln -s "../../../fuselage/packages/$i" $i
echo "root $i"
fi
done
cd ../..
cd ./apps/meteor/node_modules/@rocket.chat
for i in $(echo $packages | tr ";" "\n")
do
rm -rf $i
if [[ $action != "undo" ]]; then
rm -rf $i
fi
done
if [[ $action != "undo" ]]; then
echo "linking local project"
for i in $(echo $packages | tr ";" "\n")
do
ln -s "../../../../../fuselage/packages/$i" $i
echo "apps/meteor $i"
done
fi
cd ../../../../
if [[ $action == "undo" ]]; then
yarn
fi