Skip to content

Commit

Permalink
Update dev tool setup script to address Firebase emulator error (#95)
Browse files Browse the repository at this point in the history
# *Update dev tool setup script to address Firebase emulator error*

## ♻️ Current situation & Problem
If the development tool setup script is run in a directory without a
`firebase.json` file (i.e. outside of the Spezi Template Application
repository) it throws an error when attempting to test the Firebase
emulator suite. As this script installs tools that are independent of
the Spezi Template Application itself, it should be able to run
completely on its own.

## ⚙️ Release Notes 
This PR adds a step in the setup script to create a temporary
`firebase.json` if one does not exist before testing the firebase
emulator suite. The file is removed before the script exits.

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [X] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
vishnuravi authored Jan 7, 2025
1 parent 630c1b7 commit 5ea6670
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Scripts/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,36 @@ brew upgrade


# 3. Test and start the firebase emulator

# Check if firebase.json exists and create if it doesn't
CREATED_FIREBASE_JSON=false

if [ ! -f "firebase.json" ]; then
echo "Creating firebase.json file..."
CREATED_FIREBASE_JSON=true
cat << 'EOL' > firebase.json
{
"emulators": {
"auth": {
"port": 9099
},
"firestore": {
"port": 8080
},
"ui": {
"enabled": true,
"port": 4000
},
"singleProjectMode": true
}
}
EOL
fi

firebase emulators:exec --project test "echo 'Firebase emulator installed and started successfully!'"

# Clean up the firebase.json file only if we created it
if [ "$CREATED_FIREBASE_JSON" = true ]; then
echo "Cleaning up temporary firebase.json file..."
rm firebase.json
fi

0 comments on commit 5ea6670

Please sign in to comment.