From 0e9049de9509a1248277b7b075bbe9c058909084 Mon Sep 17 00:00:00 2001 From: Pawel Bartusiak <21136755+uFloppyDisk@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:24:29 -0700 Subject: [PATCH 1/2] feat: add git init step; --- src/index.ts | 15 +++++++++++++++ src/parameters.ts | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/src/index.ts b/src/index.ts index c8bb5e8..b03d009 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,6 +22,11 @@ const dotnetCommands = [ 'dotnet build', ]; +const gitCommands = [ + "git init", + "git add .", +]; + async function execShellCommand(command: string, targetPath: string) { const startTime = performance.now(); const spinner = createSpinner(`Running '${command}'...`).start(); @@ -84,6 +89,16 @@ const generateProject = new Promise(async (resolve, reject) => { } } + if (answers.initGitRepo) { + try { + for (const command of gitCommands) { + await execShellCommand(command, targetPath); + } + } catch (e) { + return reject(e); + } + } + console.timeEnd("Done in"); return resolve(); }); diff --git a/src/parameters.ts b/src/parameters.ts index ed1bfba..b0e9535 100644 --- a/src/parameters.ts +++ b/src/parameters.ts @@ -86,6 +86,14 @@ export default [ message: 'Initial version', initial: '0.0.1', }, + { + type: 'toggle', + name: 'initGitRepo', + message: 'Initialize a git repo?', + initial: true, + active: 'yes', + inactive: 'no', + }, { type: 'toggle', name: 'setupUsingDotnetCli', From a0a75f2b842e60b92272789ee1071676aa510901 Mon Sep 17 00:00:00 2001 From: Pawel Bartusiak <21136755+uFloppyDisk@users.noreply.github.com> Date: Mon, 24 Mar 2025 18:41:53 -0700 Subject: [PATCH 2/2] chore: expand 'repo'; --- src/parameters.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parameters.ts b/src/parameters.ts index b0e9535..a8e77e5 100644 --- a/src/parameters.ts +++ b/src/parameters.ts @@ -89,7 +89,7 @@ export default [ { type: 'toggle', name: 'initGitRepo', - message: 'Initialize a git repo?', + message: 'Initialize a git repository?', initial: true, active: 'yes', inactive: 'no',