Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 16x 16x 3x | /**
* Get SHA utility
* Returns the git SHA for the current commit
*/
import { execSync } from 'node:child_process';
/**
* Get the SHA for the current git commit
* @param {string} cwd - Current working directory
* @returns {string} SHA or 'development' if not in a git repo
*/
export function getSha(cwd) {
try {
return execSync('git rev-parse --short HEAD', {
cwd,
encoding: 'utf8',
}).trim();
} catch (e) {
return 'development';
}
}
export default getSha;
|