Skip to content

Instantly share code, notes, and snippets.

@abundis29
Created January 9, 2024 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abundis29/334a5b50694a46854e0ef0786969e155 to your computer and use it in GitHub Desktop.
Save abundis29/334a5b50694a46854e0ef0786969e155 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Helper functions to print success and error messages
function logSuccess {
echo "✅ $1"
}
function logError {
echo "❌ $1"
}
function checkDependency {
if command -v "$1" >/dev/null 2>&1 ; then
logSuccess "$2 installed"
return 0
else
logError "$2 is not installed. Please install Homebrew first."
return 1
fi
}
# Check if Homebrew is installed
if command -v brew >/dev/null 2>&1 ; then
logSuccess "Homebrew is installed"
else
logError "Homebrew is not installed. Please install Homebrew first."
exit 1
fi
# Check if Xcode developer tools are installed
if xcode-select -p >/dev/null 2>&1 ; then
logSuccess "Xcode developer tools are installed"
else
logError "Xcode developer tools are not installed. Please install Xcode and try again."
exit 1
fi
function installDependency() {
if checkDependency "$1" "$2" ; then
return
fi
if [[ "$process_arch" == "arm64" || "$process_arch" == "arm64e" ]]; then
arch -arm64e brew install "$1"
else
brew install "$1"
fi
logSuccess "$1 installed with Homebrew"
}
installDependency "podman" "podman"
installDependency "nvm" "nvm"
installDependency "git-lfs" "git-lfs"
# Install git-lfs hooks
if ! git lfs install >/dev/null 2>&1 ; then
if ! (cd ~ && git lfs install) >/dev/null 2>&1 ; then
logError "Failed to install git-lfs hooks."
exit 1
fi
fi
logSuccess "git-lfs hooks installed"
# Pull git-lfs files
if ! git lfs pull >/dev/null 2>&1 ; then
logError "Failed to pull git-lfs files."
exit 1
fi
logSuccess "git-lfs files pulled"
if [[ "$PROCESSOR_ARCHITECTURE" == "arm64" || "$PROCESSOR_ARCHITEW6432" == "arm64" ]]; then
installDependency "pkg-config" "pkg-config"
installDependency "cairo" "cairo"
installDependency "pango" "pango"
installDependency "libpng" "libpng"
installDependency "jpeg" "jpeg"
installDependency "giflib" "giflib"
installDependency "librsvg" "librsvg"
fi
if ! brew doctor >/dev/null 2>&1 ; then
logError "Failed to run brew doctor"
exit 1
fi
logSuccess "brew doctor"
# Setup and build app
npm run app:setup && logSuccess "🛠️ App setup completed , 📦 Dependencies installed with npm, 🏗️ App build completed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment