UNPKG

shipthis

Version:

ShipThis manages building and uploading your Godot games to the App Store and Google Play.

33 lines (30 loc) 677 B
import { promises } from 'node:fs'; import git from 'isomorphic-git'; async function isCWDGitRepo() { const dir = process.cwd(); try { await git.log({ depth: 1, dir, fs: promises }); return true; } catch { return false; } } async function getCWDGitInfo() { const dir = process.cwd(); const empty = {}; try { const commits = await git.log({ depth: 1, dir, fs: promises }); const branch = await git.currentBranch({ dir, fs: promises, fullname: false }); return { gitBranch: branch, gitCommitHash: commits[0].oid }; } catch { return empty; } } export { getCWDGitInfo as g, isCWDGitRepo as i };