renameProject static method
Rename and configure the project based on user input
Implementation
static Future<void> renameProject(ProjectConfig config) async {
final projectPath = path.join(Directory.current.path, config.projectDirectoryName);
// Change to project directory
final originalDir = Directory.current;
Directory.current = projectPath;
try {
// 1. Replace template placeholders in files
await _replaceTemplatePlaceholders(config, projectPath);
// 2. Use package_rename to configure the project
await _configurePackage(config);
// 3. Update pubspec.yaml with correct name and description
await _updatePubspec(config, projectPath);
} finally {
// Restore original directory
Directory.current = originalDir;
}
}