git-auto-badger
Version:
A npm cli tool that reads your package.json/project metadata and git config and connects your readme with multiple badge providers (shields.io, badgen.net etc)
15 lines • 411 B
JavaScript
const nodegit = require('nodegit');
let url = null;
const detectRepoUrl = async function () {
if (url) {
return url;
}
url = await nodegit.Repository.open(".git")
.then(repo => repo.config())
.then(config => {
return config.getStringBuf("remote.origin.url")
})
.then(buf => buf.toString());
return url;
}
exports.detectRepoUrl = detectRepoUrl;