firebase_multi_env_manager 1.0.0 copy "firebase_multi_env_manager: ^1.0.0" to clipboard
firebase_multi_env_manager: ^1.0.0 copied to clipboard

A production-ready Dart CLI to manage multiple Firebase environments (dev, staging, prod) for Flutter projects.

Firebase Multi-Env Manager ๐Ÿš€ #

A production-ready Dart CLI tool designed to streamline Firebase environment management for Flutter projects. Safely switch between dev, staging, and prod environments with automatic configuration updates, backups, and validation.

โœจ Features #

  • Platform-Specific Handlers:
    • Android: Automatically updates google-services.json, applicationId in build.gradle, and android:label in AndroidManifest.xml.
    • iOS: Updates GoogleService-Info.plist, PRODUCT_BUNDLE_IDENTIFIER in project.pbxproj, and CFBundleDisplayName in Info.plist.
  • Safety First:
    • Automatic Backups: Creates a timestamped backup of sensitive files before every switch.
    • Rollback System: Quickly restore previous configurations if a switch fails.
    • Validation: Checks for project integrity and missing config files before making changes.
  • Advanced CLI:
    • Interactive Mode: Select environments from a menu.
    • CI/CD Ready: Supports non-interactive flags and proper exit codes for automation.
    • Diffing: Compare environment configurations directly from the terminal.
  • Modular & Extensible: Clean architecture with separate layers for services, handlers, and CLI logic.

๐Ÿš€ Getting Started #

Prerequisites #

  • Dart SDK (^3.10.0)
  • A Flutter project with standard android/ and ios/ structures.

Configuration #

Add the firebase_multi_env section to your pubspec.yaml:

firebase_multi_env:
  default: dev
  environments:
    dev:
      android_config: firebase/dev/google-services.json
      ios_config: firebase/dev/GoogleService-Info.plist
      android_application_id: com.example.app.dev
      ios_bundle_id: com.example.app.dev
      app_name: MyApp Dev
    prod:
      android_config: firebase/prod/google-services.json
      ios_config: firebase/prod/GoogleService-Info.plist
      android_application_id: com.example.app
      ios_bundle_id: com.example.app
      app_name: MyApp

๐Ÿ›  Usage #

Run the tool using dart bin/firebase_multi_env_manager.dart or activate it globally.

Common Commands #

  • List environments:

    firebase_multi_env --list
    
  • Switch environment:

    firebase_multi_env --env dev
    
  • Compare configurations:

    firebase_multi_env --diff dev,prod
    
  • Rollback to last backup:

    firebase_multi_env --rollback
    
  • CI Mode:

    firebase_multi_env --env prod --ci
    

๐Ÿ“‚ Project Structure #

lib/
โ”œโ”€โ”€ cli/          # Argument parsing and user interaction
โ”œโ”€โ”€ core/         # Shared constants, logger, and exceptions
โ”œโ”€โ”€ handlers/     # Platform-specific (Android/iOS) modification logic
โ”œโ”€โ”€ services/     # Core business logic (Backup, Config, Validator)
โ””โ”€โ”€ env_switcher.dart  # Main orchestrator

๐Ÿงช Testing #

Run the full test suite with:

dart test -j 1

๐Ÿ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
130
points
31
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A production-ready Dart CLI to manage multiple Firebase environments (dev, staging, prod) for Flutter projects.

Topics

#firebase #flutter #cli #devops #environment-management

License

MIT (license)

Dependencies

ansicolor, args, path, yaml

More

Packages that depend on firebase_multi_env_manager