cloneAndSetupProject static method

Future cloneAndSetupProject({
  1. required AppDataModel appInfo,
  2. required String dirName,
})

Clone repository from GitHub and create folder and setup main packages. and other main feature

Implementation

static Future cloneAndSetupProject(
    {required AppDataModel appInfo, required String dirName}) async {
  print("\n\nšŸ”ƒšŸ”ƒ Thunder will initialize your app. Please wait for seconds");

  final ProcessResult processResult =
      await CloneRepoAndSetupProject._cloneRepo(
    repoUrl: appInfo.stateManagement.getRepoUrl(),
    dirName: dirName,
  );

  if (processResult.exitCode == 0) {
    bool setupResult =
        await CloneRepoAndSetupProject._setupClonedProject(appInfo);

    if (setupResult) {
      print('⚔ Init app successfully šŸŽ‰\n');

      await PublishProjectToGithub.publishProjectToGithub();

      await OpenProjectInVSCode.openProjectInVSCode();
    } else {
      print('šŸ˜… An error occurred during project setup.');
    }
  } else {
    print(
        'šŸ˜… Failed to clone the repository.\n Exit code : ${processResult.exitCode}\n Error : ${processResult.stderr}');
  }
}