feat: add default branch prop for publish:github

Signed-off-by: shoukoo <shoukoo.koike@gmail.com>
This commit is contained in:
shoukoo
2021-06-30 19:38:58 +10:00
parent 66da60bc43
commit c2db794f5a
7 changed files with 95 additions and 5 deletions
+2 -1
View File
@@ -183,8 +183,9 @@ export class Git {
logger?: Logger | undefined;
}) => Git;
// (undocumented)
init({ dir }: {
init({ dir, defaultBranch, }: {
dir: string;
defaultBranch?: string;
}): Promise<void>;
// (undocumented)
merge({ dir, theirs, ours, author, committer, }: {
+3 -1
View File
@@ -201,14 +201,16 @@ describe('Git', () => {
describe('init', () => {
it('should call isomorphic-git with the correct arguments', async () => {
const dir = '/some/mock/dir';
const defaultBranch = 'master';
const git = Git.fromAuth({});
await git.init({ dir });
await git.init({ dir, defaultBranch });
expect(isomorphic.init).toHaveBeenCalledWith({
fs,
dir,
defaultBranch,
});
});
});
+8 -1
View File
@@ -150,12 +150,19 @@ export class Git {
});
}
async init({ dir }: { dir: string }): Promise<void> {
async init({
dir,
defaultBranch = 'master',
}: {
dir: string;
defaultBranch?: string;
}): Promise<void> {
this.config.logger?.info(`Init git repository {dir=${dir}}`);
return git.init({
fs,
dir,
defaultBranch,
});
}