#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo '🏗️ Styling, testing and building your portfolio before committing.'

# Check Prettier standards
echo '🎨 Prettifying your code.'
npm run check-format ||
(
    echo '❌ 🎨 Prettier Check Failed. Run npm run format, add changes and try committing again. 🎨 ❌';
    false;
)
echo '🤵 Checkign ESLint standards.'
# Check ESLint Standards
npm run check-lint ||
(
        echo '🤵 ❌ ESLint Check Failed. Make the changes required above and try committing again. ❌ 🤵'
        false; 
)

echo '⌨️ Type checking.'
# Check tsconfig standards
npm run check-types ||
(
    echo '❌ ⌨️ Failed Type check. Make the changes required above and try committing again. ⌨️ ❌'
    false;
)

# If everything passes... Now we can commit
echo '✅ ✅Your checked-in code looks good. Commiting... ✅ ✅'
