| 9 | |
| 10 | // Get Git config |
| 11 | export const getGitConfig = async (): Promise<Git> => { |
| 12 | const configPath = path.join(os.homedir(), '.gitconfig'); |
| 13 | try { |
| 14 | await fs.stat(configPath); |
| 15 | const gitconfig = await parse({ cwd: '/', path: configPath }); |
| 16 | const author: Git = { |
| 17 | name: gitconfig?.user.name, |
| 18 | email: gitconfig?.user.email, |
| 19 | }; |
| 20 | return author; |
| 21 | } catch { |
| 22 | throw new Error('Error reading Git config.'); |
| 23 | } |
| 24 | }; |
| 25 | |
| 26 | export const gitAdd = async (): Promise<void> => { |
| 27 | await execa('git', ['add', '--all']); |