-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue: #34 - Create .git-coauthors file with sample file after install if it doesn't exist - function to check if authors file exists Co-authored-by: Jack Bittiner <jackbittiner@hotmail.com> Co-authored-by: Richard Kotze <rkotze@findmypast.com>
- Loading branch information
1 parent
62aac4e
commit 4b8150b
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
const DUMMY_CONTENT = { | ||
const { gitAuthors, gitCoauthorsPath } = require('../git-authors'); | ||
|
||
const SAMPLE_CONTENT = { | ||
coauthors: { | ||
hh: { | ||
name: 'Hulk Hogan', | ||
email: 'hulk_hogan22@hotmail.org', | ||
}, | ||
}, | ||
}; | ||
|
||
createFileIfNotExist(); | ||
|
||
async function createFileIfNotExist() { | ||
const instance = gitAuthors(); | ||
if (!instance.fileExists()) { | ||
try { | ||
await instance.write(SAMPLE_CONTENT); | ||
console.log('Add co-authors to: ', gitCoauthorsPath); | ||
} catch (err) { | ||
console.log('Someting went wrong adding a new co-authors file, error: ', err); | ||
} | ||
} | ||
} |