Line data Source code
1 : import 'package:mason/mason.dart'; 2 : import 'package:path/path.dart' as path; 3 : import 'package:universal_io/io.dart'; 4 : import 'package:very_good_cli/src/commands/create/templates/templates.dart'; 5 : import 'package:very_good_cli/src/logger_extension.dart'; 6 : 7 : /// {@template very_good_core_template} 8 : /// A core Flutter app template. 9 : /// {@endtemplate} 10 : class VeryGoodCoreTemplate extends Template { 11 : /// {@macro very_good_core_template} 12 1 : VeryGoodCoreTemplate() 13 1 : : super( 14 : name: 'core', 15 1 : bundle: veryGoodCoreBundle, 16 : help: 'Generate a Very Good Flutter application.', 17 : ); 18 : 19 1 : @override 20 : Future<void> onGenerateComplete(Logger logger, Directory outputDir) async { 21 1 : if (await installFlutterPackages(logger, outputDir)) { 22 1 : await applyDartFixes(logger, outputDir); 23 : } 24 1 : _logSummary(logger, outputDir); 25 : } 26 : 27 1 : void _logSummary(Logger logger, Directory outputDir) { 28 1 : final relativePath = path.relative( 29 1 : outputDir.path, 30 2 : from: Directory.current.path, 31 : ); 32 : 33 : final projectPath = relativePath; 34 : final projectPathLink = 35 2 : link(uri: Uri.parse(projectPath), message: projectPath); 36 : 37 1 : final readmePath = path.join(relativePath, 'README.md'); 38 : final readmePathLink = 39 2 : link(uri: Uri.parse(readmePath), message: readmePath); 40 : 41 : final details = ''' 42 : • To get started refer to $readmePathLink 43 : • Your project code is in $projectPathLink 44 1 : '''; 45 : 46 : logger 47 1 : ..info('\n') 48 1 : ..created('Created a Very Good App! 🦄') 49 1 : ..info(details) 50 1 : ..info( 51 1 : lightGray.wrap( 52 : ''' 53 : +----------------------------------------------------+ 54 : | Looking for more features? | 55 : | We have an enterprise-grade solution for companies | 56 : | called Very Good Start. | 57 : | | 58 : | For more info visit: | 59 : | https://verygood.ventures/solution/very-good-start | 60 : +----------------------------------------------------+''', 61 : ), 62 : ); 63 : } 64 : }