-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstaller.sh
executable file
·55 lines (45 loc) · 1.67 KB
/
installer.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
#!/bin/sh
if which node > /dev/null
then
echo "node is installed ✅"
else
echo "node is NOT installed ❌"
echo "check: https://github.com/nvm-sh/nvm"
exit 1
fi
if which npm > /dev/null
then
echo "npm is installed ✅"
else
echo "npm is NOT installed ❌"
echo "check: https://github.com/nvm-sh/nvm"
exit 1
fi
if git rev-parse --git-dir > /dev/null 2>&1
then
echo 'This directory is `git` repo ✅'
else
echo 'This directory is NOT `git` repo ❌'
exit 1
fi
curl -L -k https://github.com/stepanic/flutterflow-socket/archive/refs/heads/main.zip | tar -xz --strip-components=1 flutterflow-socket-main/run flutterflow-socket-main/watch flutterflow-socket-main/tools
chmod +x ./run ./watch ./tools/sync ./tools/hotreloader.sh ./tools/github/listen
cd ./tools/github && npm install && cd ../..
NEW_GITHUB_WEBHOOK_URL=$(curl -Ls -o /dev/null -w %{url_effective} https://smee.io/new)
SEARCH='https://smee.io/<CHANNEL_ID>'
ESCAPED_SEARCH=$(printf '%s\n' "$SEARCH" | sed -e 's/[]\/$*.^[]/\\&/g');
REPLACE="$NEW_GITHUB_WEBHOOK_URL"
ESCAPED_REPLACE=$(printf '%s\n' "$REPLACE" | sed -e 's/[]\/$*.^[]/\\&/g');
WATCH_FILENAME='./watch'
sed -i '' "s/$ESCAPED_SEARCH/$ESCAPED_REPLACE/" $WATCH_FILENAME
git add ./run ./watch ./tools
git commit -m "Installed flutterflow-socket"
echo ""
echo "GITHUB_WEBHOOK_URL=$NEW_GITHUB_WEBHOOK_URL"
echo 'GITHUB_WEBHOOK_SECRET="ff-my-github-webhook-secret"'
echo ""
echo "Open the settings of your GitHub repository and configure the webhook."
echo 'https://github.com/<GITHUB_ORG>/<GITHUB_REPO>/settings/hooks/new'
echo "Payload URL=$NEW_GITHUB_WEBHOOK_URL"
echo "Content type=application/json"
echo "Secret=ff-my-github-webhook-secret"