Skip to content

Commit

Permalink
Merge pull request #51 from AntaresSimulatorTeam/fix/add_built_to_pre…
Browse files Browse the repository at this point in the history
…_commit

fix: add npm run build to pre-commit
  • Loading branch information
vargastat authored Feb 5, 2025
2 parents a368870 + c3d1e18 commit 5b63ed9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .husky/pre-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)\/.*/;
Expand Down

0 comments on commit 5b63ed9

Please sign in to comment.