Skip to main content
Glama
pre-pushβ€’3.58 kB
#!/bin/bash # pre-push: Run comprehensive tests before pushing set -euo pipefail echo "[pre-push] Running pre-push checks..." # Clean up any leftover test processes first if [ -f "scripts/cleanup-test-processes.sh" ]; then echo "[pre-push] 🧹 Cleaning up leftover test processes..." ./scripts/cleanup-test-processes.sh echo "[pre-push] βœ… Process cleanup complete." fi # Check if we're in a Node.js project if [ ! -f "package.json" ]; then echo "[pre-push] No package.json found, skipping Node.js checks" exit 0 fi # Run full test suite if grep -q '"test"' package.json; then echo "[pre-push] Running full test suite..." if ! npm test; then echo "[pre-push] ❌ Tests failed. Push aborted." echo "[pre-push] πŸ§ͺ To fix: Review test failures above and fix the issues" exit 1 fi echo "[pre-push] βœ… All tests passed." else echo "[pre-push] No test script found in package.json, skipping tests." fi # Run test coverage check if available if grep -q '"test:coverage"' package.json; then echo "[pre-push] Running test coverage check..." if ! npm run test:coverage; then echo "[pre-push] ❌ Coverage check failed. Push aborted." echo "[pre-push] πŸ“Š To fix: Add tests to improve coverage or review coverage requirements" exit 1 fi echo "[pre-push] βœ… Coverage check passed." fi # Run security audit check if command -v npm >/dev/null 2>&1; then echo "[pre-push] Running security audit..." if ! npm audit --audit-level=high; then echo "[pre-push] ❌ Security audit failed. Push aborted." echo "[pre-push] πŸ”’ To fix: Run 'npm audit fix' to fix vulnerabilities automatically" echo "[pre-push] Or run 'npm audit' to see detailed vulnerability information" echo "[pre-push] For manual fixes, review and update vulnerable dependencies" exit 1 fi echo "[pre-push] βœ… Security audit passed." fi # Run lint check to ensure code quality if command -v npx >/dev/null 2>&1; then echo "[pre-push] Running comprehensive lint check..." # Check JavaScript files if find . -name "*.js" -not -path "./node_modules/*" -not -path "./coverage/*" | head -1 | grep -q .; then if ! npx eslint .; then echo "[pre-push] ❌ ESLint check failed. Push aborted." echo "[pre-push] πŸ”§ To fix: Run 'npm run lint:fix' and commit the changes" exit 1 fi echo "[pre-push] βœ… ESLint check passed." fi # Check formatting if ! npx prettier --check "**/*.{js,mjs,cjs,json,md}" --ignore-path .gitignore; then echo "[pre-push] ❌ Prettier formatting check failed. Push aborted." echo "[pre-push] πŸ’… To fix: Run 'npm run format' and commit the changes" exit 1 fi echo "[pre-push] βœ… Prettier formatting check passed." # Check markdown if find . -name "*.md" -not -path "./node_modules/*" | head -1 | grep -q .; then if ! npx markdownlint-cli2; then echo "[pre-push] ❌ Markdown lint failed. Push aborted." echo "[pre-push] πŸ“ To fix: Run 'npm run markdown:fix' and commit the changes" exit 1 fi echo "[pre-push] βœ… Markdown lint passed." # Check for dead links in markdown files echo "[pre-push] Checking for dead links in markdown files..." if ! npm run links:check:ci; then echo "[pre-push] ❌ Dead links found in markdown files. Push aborted." echo "[pre-push] πŸ”— To fix: Run 'npm run links:check' to see details and update broken links" exit 1 fi echo "[pre-push] βœ… Link checking passed." fi fi echo "[pre-push] All pre-push checks passed! πŸš€" exit 0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/egarcia74/warp-sql-server-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server