From c3d1e186f13d60a6dac2ff8543a60dd1093acd6a Mon Sep 17 00:00:00 2001 From: vargastat Date: Wed, 5 Feb 2025 13:20:53 +0100 Subject: [PATCH] fix: add npm run build to pre-commit --- .husky/pre-commit.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.husky/pre-commit.js b/.husky/pre-commit.js index 4fb2459..40004d7 100755 --- a/.husky/pre-commit.js +++ b/.husky/pre-commit.js @@ -6,6 +6,15 @@ import path from 'path'; const CONSOLE_ORANGE_COLOR = '\x1b[33m%s\x1b[0m'; const CONSOLE_RED_COLOR = '\x1b[31m%s\x1b[0m'; +// Run the build and show output +try { + console.log(CONSOLE_ORANGE_COLOR, 'Running npm build check...'); + execSync('npm run build', { stdio: 'inherit' }); +} catch (error) { + console.error(CONSOLE_RED_COLOR, 'Build failed. Fix the errors before committing.'); + process.exit(1); +} + // Check if branch matches naming convention const localBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim(); const regex = /^master|(feature|fix|test)\/.*/;