From d1bcbf262ecd79413761bcba62b989b136306308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hegyi=20=C3=81ron=20Ferenc?= Date: Fri, 26 Jan 2024 13:55:40 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix:=20make=20strict=20actually?= =?UTF-8?q?=20strict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/hook.sh | 7 +++++++ src/commands/run.ts | 3 ++- src/config.ts | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/hook.sh b/bin/hook.sh index 6296f47..64bd69b 100644 --- a/bin/hook.sh +++ b/bin/hook.sh @@ -2,6 +2,7 @@ LOCAL_PATH=$(npm root) NODE_PATH=$(npm root -g) REPO_ROOT=$(git rev-parse --show-toplevel) +STATUS_FILE=".git/.eemoji-status" if [ -f "$LOCAL_PATH/eemoji/bin/eemoji.mjs" ]; then node "$LOCAL_PATH/eemoji/bin/eemoji.mjs" run $1 @@ -13,3 +14,9 @@ else echo "eemoji is not properly installed locally or globally" exit 1 fi + +if [ -f "$STATUS_FILE" ]; then + ERROR_STATUS=$(cat "$STATUS_FILE") + rm "$STATUS_FILE" + if [ "$ERROR_STATUS" -eq "1" ]; then exit 1; fi +fi diff --git a/src/commands/run.ts b/src/commands/run.ts index 60e3885..a86a067 100644 --- a/src/commands/run.ts +++ b/src/commands/run.ts @@ -77,7 +77,8 @@ export default defineCommand({ } } catch (err: any) { - consola.error(err) + fs.writeFileSync(C.statusFile, '1') + consola.error(err.message) } }, }) diff --git a/src/config.ts b/src/config.ts index ce15bfb..713c2e7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -101,6 +101,7 @@ export default defineDefaultConfig({ gitCommitFile = r('.git/COMMIT_EDITMSG') hooksDir = r('.git/hooks') hookFile = r('.git/hooks/prepare-commit-msg') + statusFile = r('.git/.eemoji-status') entryDir = entryDir entryFile = path.join(this.entryDir, 'hook.sh') }