lerna
Version:
Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository
30 lines (27 loc) • 799 B
JavaScript
import {
execSync,
npmlog_default
} from "./chunk-WC2B4V4E.js";
// libs/commands/diff/src/lib/get-last-commit.ts
function getLastCommit(execOpts) {
if (hasTags(execOpts)) {
npmlog_default.silly("getLastTagInBranch", "");
return execSync("git", ["describe", "--tags", "--abbrev=0"], execOpts);
}
npmlog_default.silly("getFirstCommit", "");
return execSync("git", ["rev-list", "--max-parents=0", "HEAD"], execOpts);
}
function hasTags(opts) {
let result = false;
try {
result = !!execSync("git", ["tag"], opts);
} catch (err) {
npmlog_default.warn("ENOTAGS", "No git tags were reachable from this branch!");
npmlog_default.verbose("hasTags error", err);
}
npmlog_default.verbose("hasTags", result.toString());
return result;
}
export {
getLastCommit
};