has-commit.js 445 B

123456789101112131415161718192021222324
  1. "use strict";
  2. const log = require("npmlog");
  3. const childProcess = require("@lerna/child-process");
  4. module.exports.hasCommit = hasCommit;
  5. /**
  6. * @param {import("@lerna/child-process").ExecOpts} opts
  7. */
  8. function hasCommit(opts) {
  9. log.silly("hasCommit");
  10. let retVal;
  11. try {
  12. childProcess.execSync("git", ["log"], opts);
  13. retVal = true;
  14. } catch (e) {
  15. retVal = false;
  16. }
  17. log.verbose("hasCommit", retVal);
  18. return retVal;
  19. }