UNPKG

505 BJavaScriptView Raw
1"use strict";
2
3const log = require("npmlog");
4const childProcess = require("@lerna/child-process");
5
6module.exports.isAnythingCommitted = isAnythingCommitted;
7
8/**
9 * @param {import("@lerna/child-process").ExecOpts} opts
10 */
11function isAnythingCommitted(opts) {
12 log.silly("isAnythingCommitted");
13
14 const anyCommits = childProcess.execSync("git", ["rev-list", "--count", "--all", "--max-count=1"], opts);
15
16 log.verbose("isAnythingCommitted", anyCommits);
17
18 return Boolean(parseInt(anyCommits, 10));
19}