mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-03 06:23:22 -04:00
- Rename `proxy.ts` to `_proxy.ts` temporarily during build scripts and clean up backup files. - Adjust Compass URLs to consistently include "www." - Introduce WebView debugging toggle via `BuildConfig.ENABLE_WEBVIEW_DEBUG`. - Bump Android version code to 79 and enable `buildConfig` features.
65 lines
1.6 KiB
Bash
Executable File
65 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"/..
|
|
|
|
# Paths
|
|
ROOT_ENV=".env" # your root .env
|
|
WEB_ENV="web/.env" # target for frontend
|
|
|
|
# Backup existing web/.env if it exists
|
|
if [ -f "$WEB_ENV" ]; then
|
|
cp "$WEB_ENV" "${WEB_ENV}.bak"
|
|
echo "Backed up existing $WEB_ENV to ${WEB_ENV}.bak"
|
|
fi
|
|
|
|
# Filter NEXT_PUBLIC_* lines
|
|
if [ -f "$ROOT_ENV" ]; then
|
|
set -a
|
|
source "$ROOT_ENV"
|
|
set +a
|
|
echo "Sourced variables from $ROOT_ENV"
|
|
fi
|
|
env | grep '^NEXT_PUBLIC_' > "$WEB_ENV" || true
|
|
|
|
echo "Copied NEXT_PUBLIC_ variables to $WEB_ENV:"
|
|
|
|
echo "NEXT_PUBLIC_FIREBASE_ENV=prod" >> "$WEB_ENV"
|
|
|
|
cat "$WEB_ENV"
|
|
|
|
cd web
|
|
|
|
export NEXT_PUBLIC_WEBVIEW=1
|
|
|
|
rm -rf .next/* .next/.* 2>/dev/null || true
|
|
|
|
# Hack to ignore getServerSideProps, getStaticProps and getStaticPaths for mobile webview build
|
|
# as Next.js doesn't support SSG, SSR and ISR on mobile
|
|
USERNAME_PAGE=pages/[username]/index.tsx
|
|
HOME_PAGE=pages/index.tsx
|
|
|
|
# rename getStaticProps to _getStaticProps
|
|
sed -i.bak 's/\bgetStaticProps\b/_getStaticProps/g' $USERNAME_PAGE
|
|
|
|
# rename getStaticPaths to _getStaticPaths
|
|
sed -i.bak 's/\bgetStaticPaths\b/_getStaticPaths/g' $USERNAME_PAGE
|
|
|
|
# rename getServerSideProps to _getServerSideProps
|
|
sed -i.bak 's/\bgetServerSideProps\b/_getServerSideProps/g' $HOME_PAGE
|
|
|
|
# rename proxy to _proxy
|
|
mv proxy.ts _proxy.ts
|
|
|
|
yarn build
|
|
|
|
sed -i.bak 's/\b_getStaticProps\b/getStaticProps/g' $USERNAME_PAGE
|
|
sed -i.bak 's/\b_getStaticPaths\b/getStaticPaths/g' $USERNAME_PAGE
|
|
sed -i.bak 's/\b_getServerSideProps\b/getServerSideProps/g' $HOME_PAGE
|
|
|
|
mv _proxy.ts proxy.ts
|
|
|
|
# Remove backup files
|
|
rm -f "$USERNAME_PAGE.bak" "$HOME_PAGE.bak"
|