An advanced CLI tool for managing multiple Flutter app flavors across different platforms with interactive step-by-step setup and real-time validation
npm install flutter-flavor-managerAn advanced TypeScript-based CLI tool for managing multiple Flutter app flavors across different platforms with interactive step-by-step setup and real-time validation.
- š Multi-app support - Configure different apps with unique bundle IDs
- š Environment management - dev, staging, prod with different configurations
- š± Platform synchronization - Updates build configurations for all Flutter platforms
- šÆ Interactive runner - CLI interface for selecting and running specific flavor combinations
- š Environment fusion - Mix configurations from different environments
- š¾ Backup/restore - Automatic backup before configuration updates
- š¦ Simple entry points - Auto-generates Dart entry points for each flavor combination
- šØ Advanced TUI - Beautiful terminal user interface with visual feedback
- š§ Interactive Setup Wizard - Step-by-step guided configuration
- š Flutter Version Management - Detect and switch between Flutter versions
- ā
Real-time Validation - Instant feedback on configuration inputs
- š Smart Detection - Automatically detects project structure and settings
- š· TypeScript Powered - Full type safety and IntelliSense support
- šļø Modern Architecture - Clean, modular, and maintainable codebase
- Node.js >= 16.0.0
- Flutter SDK
- TypeScript >= 4.5.0 (for development)
``bash`
npm install -g flutter-flavor-manager
Or install locally in your project:
`bash`
npm install flutter-flavor-manager
bash
flutter-flavor setup
`
This launches a beautiful step-by-step wizard that guides you through entire setup process with real-time validation.$3
`bash
flutter-flavor init
`
Creates a basic configuration with sensible defaults.$3
`bash
npm install -g flutter-flavor-manager
flutter-flavor dev # Run in development mode with hot reload
`š® CLI Commands
$3
Run interactive setup wizard with step-by-step guidance
`bash
flutter-flavor setup
`$3
Initialize a new flavor configuration file
`bash
flutter-flavor init [--force] [--interactive]
`$3
Manage Flutter versions and channels
`bash
flutter-flavor flutter [--list] [--switch ] [--channel ]
`$3
Interactive runner for selecting and running flavors
`bash
flutter-flavor run [--quick]
`$3
Generate Dart entry points for all flavor combinations
`bash
flutter-flavor generate
`$3
Validate flavor configuration with real-time feedback
`bash
flutter-flavor validate
`š§ Development
$3
`bash
npm run build
`$3
`bash
npm run dev
`$3
`bash
npm run build:watch
`$3
`bash
npm test
npm run test:watch
`$3
`bash
npm run lint
npm run lint:fix
`š Project Structure
`
src/
āāā types/ # TypeScript type definitions
āāā core/ # Core business logic
āāā tui/ # Terminal User Interface components
āāā utils/ # Utility functions
āāā cli.ts # Main CLI entry pointdist/ # Compiled JavaScript output
āāā cli.js # Built CLI entry point
āāā index.js # Main library exports
āāā *.d.ts # Type declaration files
`šļø Architecture
The TypeScript-based architecture provides:
$3
- Full type coverage - All modules have complete type definitions
- IntelliSense support - Excellent IDE autocompletion
- Compile-time checking - Catch errors before runtime$3
- Separation of concerns - Clean separation between UI, core logic, and utilities
- Reusable components - Modular TUI components
- Extensible architecture - Easy to add new features$3
- Async/await - Modern promise handling
- ES6+ features - Latest JavaScript features
- Error handling - Comprehensive error managementš TypeScript API
$3
`typescript
import {
FlavorController,
EntryPointGenerator,
InteractiveSetupWizard,
FlutterVersionManager,
RealTimeValidator,
AdvancedTUI
} from 'flutter-flavor-manager';// Setup wizard
const wizard = new InteractiveSetupWizard();
await wizard.run();
// Flutter version management
const flutterManager = new FlutterVersionManager();
const versions = await flutterManager.detectInstalledVersions();
// Validation
const validator = new RealTimeValidator();
const issues = await validator.validateConfiguration(config);
// TUI components
const tui = new AdvancedTUI();
tui.showHeader('My Title', 'Subtitle');
tui.showSuccessBox('Operation completed');
`$3
`typescript
interface FlavorConfig {
project: ProjectInfo;
apps: App[];
platforms: Platform[];
options: FlavorConfigOptions;
version: string;
generatedAt: string;
}interface Environment {
name: string;
displayName: string;
baseUrl: string;
apiKey: string;
bundleIdSuffix: string;
versionSuffix: string;
}
interface FlutterVersion {
version: string;
channel: string;
path?: string;
date?: string;
isCurrent: boolean;
isActive: boolean;
}
`šØ Advanced TUI Features
The TypeScript-powered TUI provides:
- Type-safe components - All UI functions have proper types
- Consistent API - Uniform interface across all components
- Error handling - Built-in error management
- Accessibility - Screen reader compatible output
`typescript
const tui = new AdvancedTUI();// Type-safe method calls
tui.showHeader('Title', 'Subtitle');
tui.showProgressBar(5, 10, 'Processing');
tui.showSuccessBox('Operation completed');
// Type-safe tables
const table = tui.createFancyTable(
['Header 1', 'Header 2'],
[['Row 1 Col 1', 'Row 1 Col 2']],
{ borderStyle: 'round' }
);
`š Flutter Version Management
Enhanced with type safety:
`typescript
const manager = new FlutterVersionManager();// Returns typed array
const versions: FlutterVersion[] = await manager.detectInstalledVersions();
// Type-safe operations
const success: boolean = await manager.switchVersion(versions[0]);
// Enum support for channels
enum FlutterChannel {
STABLE = 'stable',
BETA = 'beta',
DEV = 'dev',
MASTER = 'master'
}
`ā
Real-time Validation
Type-safe validation with comprehensive error handling:
`typescript
const validator = new RealTimeValidator();// Type-safe field validation
const result = await validator.validateField('packageName', 'com.example.app', {
type: 'packageName'
});
if (!result.valid) {
console.log(
Error: ${result.message});
}// Configuration validation
const issues = await validator.validateConfiguration(config);
`š¤ Contributing
$3
1. Clone the repository
`bash
git clone https://github.com/digitwhale/flutter-flavor-manager.git
cd flutter-flavor-manager
`2. Install dependencies
`bash
npm install
`3. Run in development mode
`bash
npm run dev
`4. Build and test
`bash
npm run build
npm test
npm run lint
`$3
All new code must:
- Have complete type definitions
- Use strict TypeScript settings
- Pass ESLint checks
- Include proper error handling
$3
1. Define types in
src/types/index.ts
2. Implement logic in appropriate src/core/ module
3. Add TUI components if needed in src/tui/
4. Update CLI in src/cli.ts
5. Write tests in test/`This project is licensed under the MIT License - see the LICENSE file for details.
- TypeScript team - For the amazing language and tooling
- Node.js community - For the ecosystem and packages
- Flutter team - For the excellent cross-platform framework
---
Built with ā¤ļø and TypeScript for type safety and developer experience.