frontend-standards-checker
Version:
A comprehensive frontend standards validation tool with TypeScript support
28 lines (27 loc) • 963 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGitLastAuthor = getGitLastAuthor;
const child_process_1 = require("child_process");
const path_1 = __importDefault(require("path"));
const which_1 = __importDefault(require("which"));
function getGitLastAuthor(filePath, cwd) {
try {
const absPath = path_1.default.resolve(filePath);
const gitPath = which_1.default.sync('git');
const args = ['log', '-1', '--pretty=format:%an', '--', absPath];
const result = (0, child_process_1.spawnSync)(gitPath, args, {
cwd,
encoding: 'utf8',
shell: false,
});
if (result.error)
return 'Unknown';
return result.stdout.trim() || 'Unknown';
}
catch {
return 'Unknown';
}
}