1
0
mirror of synced 2025-11-08 21:07:23 +00:00

feat(CLI): don't attempt to commit if user.name/email is not set

This commit is contained in:
Jason Dreyzehner
2018-03-10 15:48:13 -05:00
parent abef54a412
commit 58688fc9d9
3 changed files with 38 additions and 5 deletions

View File

@@ -26,7 +26,12 @@ export interface Tasks {
readonly gitEmail: string;
readonly gitName: string;
}>;
readonly initialCommit: (hash: string, projectDir: string) => Promise<void>;
readonly initialCommit: (
hash: string,
projectDir: string,
name: string,
email: string
) => Promise<boolean>;
readonly install: (
shouldInstall: boolean,
runner: Runner,
@@ -104,7 +109,9 @@ export const getUserInfo = (spawner: ExecaStatic) => async () => {
export const initialCommit = (spawner: ExecaStatic) => async (
hash: string,
projectDir: string
projectDir: string,
name: string,
email: string
) => {
const opts: Options = {
cwd: projectDir,
@@ -113,6 +120,9 @@ export const initialCommit = (spawner: ExecaStatic) => async (
};
await spawner('git', ['init'], opts);
await spawner('git', ['add', '-A'], opts);
if (name === Placeholders.name || email === Placeholders.email) {
return false;
}
await spawner(
'git',
[
@@ -122,6 +132,7 @@ export const initialCommit = (spawner: ExecaStatic) => async (
],
opts
);
return true;
};
export const install = (spawner: ExecaStatic) => async (