Skip to content

Commit

Permalink
refactor(diff): Use named exports internally
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Dec 10, 2020
1 parent c7e37a1 commit 496552d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions commands/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const ChildProcessUtilities = require("@lerna/child-process");
const { Command } = require("@lerna/command");
const { ValidationError } = require("@lerna/validation-error");
const getLastCommit = require("./lib/get-last-commit");
const hasCommit = require("./lib/has-commit");
const { getLastCommit } = require("./lib/get-last-commit");
const { hasCommit } = require("./lib/has-commit");

module.exports = factory;

Expand Down
8 changes: 7 additions & 1 deletion commands/diff/lib/get-last-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
const log = require("npmlog");
const childProcess = require("@lerna/child-process");

module.exports = getLastCommit;
module.exports.getLastCommit = getLastCommit;

/**
* @param {{ cwd: string }} execOpts
*/
function getLastCommit(execOpts) {
if (hasTags(execOpts)) {
log.silly("getLastTagInBranch");
Expand All @@ -16,6 +19,9 @@ function getLastCommit(execOpts) {
return childProcess.execSync("git", ["rev-list", "--max-parents=0", "HEAD"], execOpts);
}

/**
* @param {{ cwd: string }} opts
*/
function hasTags(opts) {
let result = false;

Expand Down
5 changes: 4 additions & 1 deletion commands/diff/lib/has-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
const log = require("npmlog");
const childProcess = require("@lerna/child-process");

module.exports = hasCommit;
module.exports.hasCommit = hasCommit;

/**
* @param {{ cwd: string }} opts
*/
function hasCommit(opts) {
log.silly("hasCommit");
let retVal;
Expand Down

0 comments on commit 496552d

Please sign in to comment.