end()

in generators/git-hub/index.js [87:116]


  end() {
    this.spawnSync("git", ["init", "-b", "main"]);
    if (this.spawnSync("git", ["status", "--porcelain"], {
      stdio: 'pipe'
    }).stdout.length > 0) {
      this.spawnSync("git", ["add", "."]);
      this.spawnSync("git", ["commit", "-m", "Initial commit"]);
      this.log(chalk.green("✅ Git repository initialized."));
    } else {
      this.log(chalk.yellow("⚠️ No changes to commit."));
    }

    if (this.props.withGitHub) {
      if ((this.props.withGitHubPush + '').toLowerCase() === 'true') {
        this.spawnSync("gh", [
          "repo",
          "create",
          `${this.props.gitHubOrg}/${this.props.gitHubRepo}`,
          "--private",
          "--source=.",
          "--remote=origin",
          "--push",
          "--description",
          `${this.props.solutionName} - ${this.props.solutionDescription}`,
          "--homepage", this.props.gitHubRepoUrl
        ]);
        this.log(chalk.green("✅ Successfully pushed to GitHub."));
      }
    }
  }