Roo-Code/.husky/pre-push
Jason Owens 87b9b72b32
Corrected bug in openrouter.ts and pre-commit and pre-push husky scripts (#1853)
- Corrected error causing free models listed under openrouter to show pricing information
- Updated pre-push and pre-commit scripts to work in Windows environments when pushing to branch (windows requires npm/npx to include the ".cmd" extension to recognize and compile.
2025-03-23 02:12:53 -04:00

25 lines
811 B
Text

branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ]; then
echo "You can't push directly to main - please check out a branch."
exit 1
fi
# Detect if running on Windows and use npm.cmd, otherwise use npm
if [ "$OS" = "Windows_NT" ]; then
npm_cmd="npm.cmd"
else
npm_cmd="npm"
fi
"$npm_cmd" run compile
# Check for new changesets.
NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
echo "Changeset files: $NEW_CHANGESETS"
if [ "$NEW_CHANGESETS" == "0" ]; then
echo "-------------------------------------------------------------------------------------"
echo "Changes detected. Please run 'npm run changeset' to create a changeset if applicable."
echo "-------------------------------------------------------------------------------------"
fi