Add build testing and pre-commit hooks
- Add test-build.js script to verify standalone build locally - Add pre-commit hook with security, build, and test checks - Copy required-server-files.json to root of standalone for Amplify - Add husky for automatic pre-commit validation This ensures we test builds locally before pushing
This commit is contained in:
29
scripts/pre-commit.sh
Executable file
29
scripts/pre-commit.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🔍 Running pre-commit checks..."
|
||||
|
||||
# Run security check
|
||||
echo "🔐 Checking for credential leaks..."
|
||||
npm run security:check
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Security check failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run build test
|
||||
echo "🏗️ Testing build..."
|
||||
node scripts/test-build.js
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Build test failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run tests
|
||||
echo "🧪 Running tests..."
|
||||
npm test -- --passWithNoTests
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Tests failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ All pre-commit checks passed!"
|
||||
Reference in New Issue
Block a user