| 62 | }; |
| 63 | |
| 64 | export const getChangedFiles = async (): Promise<string[]> => { |
| 65 | const gitDir = await getGitDir(); |
| 66 | |
| 67 | const { stdout: modified } = await execa('git', ['ls-files', '--modified'], { |
| 68 | cwd: gitDir |
| 69 | }); |
| 70 | |
| 71 | const { stdout: others } = await execa( |
| 72 | 'git', |
| 73 | ['ls-files', '--others', '--exclude-standard'], |
| 74 | { cwd: gitDir } |
| 75 | ); |
| 76 | |
| 77 | const files = [...modified.split('\n'), ...others.split('\n')].filter( |
| 78 | (file) => !!file |
| 79 | ); |
| 80 | |
| 81 | return files.sort(); |
| 82 | }; |
| 83 | |
| 84 | export const gitAdd = async ({ files }: { files: string[] }) => { |
| 85 | const gitDir = await getGitDir(); |