From 551b98e14dfbf7c4d23a3344c6c80b2efca75ce6 Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Wed, 29 Nov 2023 09:51:01 -0500 Subject: [PATCH] feat: add git diff command (#201) [MHUB-422] Redo with semantic-commit Co-authored-by: Sam Thomas <10165959+samuelfullerthomas@users.noreply.github.com> --- src/git/doGitDiff.ts | 10 ++++++++++ src/index.ts | 1 + 2 files changed, 11 insertions(+) create mode 100644 src/git/doGitDiff.ts diff --git a/src/git/doGitDiff.ts b/src/git/doGitDiff.ts new file mode 100644 index 00000000..8281a24f --- /dev/null +++ b/src/git/doGitDiff.ts @@ -0,0 +1,10 @@ +import spawn from "../utils/spawn.js"; +import gitLogger from "./utils/gitLogger.js"; + +export default async function gitDiff() { + return ( + await spawn("git", ["--no-pager", "diff", "--name-only"], gitLogger) + ).stdout + .trim() + .split("\n"); +} diff --git a/src/index.ts b/src/index.ts index be90664f..6ca9c322 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,7 @@ export { default as gitSetRefOnCommit } from "./git/doGitSetRefOnCommit.js"; export { default as gitDeleteRemoteBranch } from "./git/doGitPushDelete.js"; export { default as gitPublishBranch } from "./git/doGitPublishBranch.js"; export { default as gitReset } from "./git/doGitReset.js"; +export { default as gitDiff } from "./git/doGitDiff.js"; export { default as npmBumpVersion } from "./npm/doNpmBumpVersion.js"; export { default as npmPublish } from "./npm/doNpmPublish.js";