BB Tournament Manager is a web app for managing BB tournaments. In includes the following key features.
Admin
Participant
This guide will walk you through setting up the necessary tools and environment to run this project. We'll be using Homebrew, Node Version Manager (NVM), and Flutter Version Manager (FVM).
Homebrew is a package manager for macOS. If you don't have it installed, run this command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, follow the instructions in the terminal to add Homebrew to your PATH.
NVM allows you to install and manage multiple versions of Node.js. Install it using Homebrew:
brew install nvm
And follow the provided steps to update and re-source your profile.
Install the Node.js version required for this project:
nvm use
FVM helps manage Flutter SDK versions.
brew install fvm
And follow the provided steps to update and re-source your profile.
See below (optional but useful)
Install the Flutter and Dart version required for this project:
fvm use
Install Node.js dependencies:
npm install
Install Flutter dependencies:
fvm flutter pub get
To run the Flutter part of your project:
fvm flutter run
To run any Node.js scripts:
npm run [script-name]
fvm flutter
and fvm dart
commands within this project to ensure you're using the correct Flutter version.nvm use
and fvm use
to use the correct framework version.Currently examples are specific to zsh terminal
Use the zsh-nvm
plugin e.g. with zinit
:
# Load zsh-nvm plugin
export NVM_AUTO_USE=true
zinit ice wait lucid
zinit light lukechilds/zsh-nvm
Copy this script to a file .zsh_fvm_auto_use.zsh
and source it from within your .zshrc
# Function to auto-switch Flutter version using FVM
fvm_auto_use() {
if [[ -x "$(command -v fvm)" ]]; then
echo "Warning: FVM is not installed or not in PATH. Please install FVM to enable auto-use."
return 1
fi
local fvmrc_file=".fvmrc"
local fvm_release_file=".fvm/release"
if [[ -f "$fvmrc_file" ]]; then
local npmrc_version=$(grep '"flutter":' "$fvmrc_file" | sed 's/.*"flutter": *"\(.*\)".*/\1/')
if [[ -n "$npmrc_version" ]]; then
echo "Found $fvmrc_file with version <$npmrc_version>"
if [[ ! -f "$fvm_release_file" || $(cat "$fvm_release_file") != "$npmrc_version" ]]; then
echo "Switching Flutter version to $npmrc_version"
fvm use "$npmrc_version"
fi
echo "Now using Flutter version $npmrc_version."
fi
fi
}
# Add the function to the chpwd hook (called when changing directories)
autoload -U add-zsh-hook
add-zsh-hook chpwd fvm_auto_use
# Run the function on shell startup
fvm_auto_use
Two Google Firebase projects are setup for production
and development
respesctively.
Production Firebase projectId: bbtournaments-eaa1e
Development Firebase projectId: bbtm-dev
When running locally in debug mode (e.g., using VSCode
), the project contains two configurations in the launch.json
file, one for bbtm - prod
and one for bbtm - dev
. These can be selected and run locally.
When building, the flutter web project can be built for production
or development
environments, as outlined below, by specifying the dart-define
. Note that the default ENV
is prod
.
flutter build web --dart-define=ENV=dev
flutter build web --dart-define=ENV=prod
To view the currently selected Firebase project, you can use firebase projects:list
. Scripts were added to the package.json
file so that we can easily, and clearly, run flutter builds (using above dart-define
) and firebase deploy
to the correct environment.
npm run deploy:prod
npm run deploy:dev
Note: if you are running into issues (e.g., “path” argument must be of type string. Received undefined), try clearing the firebase hosting cache and re-building, as follows (e.g., in bash):
rm -rf .firebase
flutter clean
flutter build web --dart-define=ENV=dev
firebase deploy