Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -84,6 +89,16 @@ const generateProject = new Promise<void>(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();
});
Expand Down
8 changes: 8 additions & 0 deletions src/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ export default <PromptObject[]>[
message: 'Initial version',
initial: '0.0.1',
},
{
type: 'toggle',
name: 'initGitRepo',
message: 'Initialize a git repository?',
initial: true,
active: 'yes',
inactive: 'no',
},
{
type: 'toggle',
name: 'setupUsingDotnetCli',
Expand Down