plane/.husky/pre-push
Henit Chobisa 63d799310b
[chore] Added Husky for Automating Building and Linting Projects Before Push (#2032)
* chore: Added Husky as Root Dependency

* chore: Added Husky Prepush Script

* chore: Modified Husky Pre-Push Script to Conditionally Build Projects

* chore: added husky as dev dependency
2023-09-02 13:47:21 +05:30

24 lines
747 B
Bash
Executable File

#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"
changed_files=$(git diff --name-only HEAD~1)
app_changed=$(echo "$changed_files" | grep -E '^apps/app/' || true)
space_changed=$(echo "$changed_files" | grep -E '^apps/space/' || true)
echo $app_changed
echo $space_changed
if [ -n "$app_changed" ] && [ -n "$space_changed" ]; then
echo "Changes detected in both apps/app and apps/space. Building..."
yarn run lint
yarn run build
elif [ -n "$app_changed" ]; then
echo "Changes detected in apps/app. Building..."
yarn run lint --filter=app
yarn run build --filter=app
elif [ -n "$space_changed" ]; then
echo "Changes detected in apps/space. Building..."
yarn run lint --filter=space
yarn run build --filter=space
fi