NET-Web-API-w-Angular/my-app/node_modules/@npmcli/git/lib/which.js

19 lines
339 B
JavaScript
Raw Normal View History

2024-02-09 00:38:41 +00:00
const which = require('which')
let gitPath
try {
gitPath = which.sync('git')
} catch {
// ignore errors
}
module.exports = (opts = {}) => {
if (opts.git) {
return opts.git
}
if (!gitPath || opts.git === false) {
return Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' })
}
return gitPath
}