-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37ec426
commit b7eaa67
Showing
16 changed files
with
154 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,4 @@ module.exports = { | |
}, | ||
}, | ||
], | ||
ignores: ['build/**/*'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
// Not part of bundle, just for local development | ||
import './src/entries/worker'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
startNgrokHTTPSForwarding() { | ||
processesIncludeNgrok=$(ps aux | grep ngrok | wc -l) | ||
if [ $processesIncludeNgrok -gt 3 ]; then | ||
existing_url=$(cat ngrok_last_url) | ||
echo "ngrok is already running on at: $existing_url" | ||
echo -e "run 'killall ngrok' if you want a new URL or it isn't working.\n" | ||
retval=$existing_url | ||
return | ||
fi | ||
|
||
# Start ngrok | ||
rm ngrok.log | ||
ngrok http https://localhost:4001 --log=ngrok.log > /dev/null & | ||
echo "starting ngrok..." | ||
|
||
# Wait for ngrok to start | ||
sleep 5 | ||
|
||
# Get the ngrok url | ||
read -r rawurl < <(curl localhost:4040/api/tunnels | jq -r '.tunnels | .[0] | .public_url') | ||
url=$(echo $rawurl | sed 's/https:\/\///') | ||
echo "ngrok url: $url" | ||
rm -f ngrok_last_url | ||
echo $url > ngrok_last_url | ||
echo "" | ||
|
||
retval=$url | ||
return | ||
} | ||
|
||
buildSDK() { | ||
local url=${1} | ||
|
||
# Build the SDK | ||
echo -e "Building SDK with build origin $url\n" | ||
# If you want to test with staging, change to build:dev-stag and add -a MY_API_URL | ||
docker-compose exec onesignal-web-sdk-dev BUILD_ORIGIN=$url NO_DEV_PORT=true npm run build:dev-prod | ||
|
||
echo -e "BuildSDK() Done.\n" | ||
} | ||
|
||
# Open the ngrok url in your default browser | ||
openBrowserToUrl() { | ||
local url=${1} | ||
|
||
if [ -x "$(command -v open)" ]; then | ||
# macOS | ||
open $url | ||
else | ||
# Linux | ||
xdg-open $url | ||
fi | ||
} | ||
|
||
updateSiteUrlNoteToUserAndOpenTestSite() { | ||
local url=${1} | ||
|
||
echo -e "Open your default browser to $url" | ||
|
||
echo -e \ | ||
"#############################\n" \ | ||
"NOTE: Last Step:\n" \ | ||
"Open your browser to" \ | ||
"https://dashboard.onesignal.com/apps/{{ONESIGNAL_APP_ID_HERE}}/settings/webpush/configure\n" \ | ||
"then update your site URL to https://$url/\n" \ | ||
"#############################\n" | ||
|
||
openBrowserToUrl "https://$url" | ||
} | ||
|
||
checkIfNgrokIsInstalled() { | ||
# Check if ngrok is installed | ||
if ! [ -x "$(command -v ngrok)" ]; then | ||
echo 'ngrok is not installed.' | ||
echo 'Please install ngrok to use this script.' | ||
exit 1 | ||
fi | ||
|
||
echo -e 'ngrok is installed. Continuing with script execution.\n' | ||
} | ||
|
||
checkIfNgrokIsInstalled | ||
|
||
startNgrokHTTPSForwarding | ||
url=$retval | ||
|
||
buildSDK $url | ||
updateSiteUrlNoteToUserAndOpenTestSite $url |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.