diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000000..1feec0de68 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,23 @@ +#!/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 diff --git a/package.json b/package.json index 804fb7b649..b99978f207 100644 --- a/package.json +++ b/package.json @@ -7,16 +7,19 @@ "packages/*" ], "scripts": { + "prepare": "husky install", "build": "turbo run build", "dev": "turbo run dev", "start": "turbo run start", "lint": "turbo run lint", "clean": "turbo run clean" }, + "devDependencies": { "eslint-config-custom": "*", "prettier": "latest", - "turbo": "latest" + "turbo": "latest", + "husky": "^8.0.3" }, "packageManager": "yarn@1.22.19" } diff --git a/yarn.lock b/yarn.lock index a48c94e92c..60cba9408c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4891,6 +4891,11 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" +husky@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" + integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== + idb@^7.0.1: version "7.1.1" resolved "https://registry.yarnpkg.com/idb/-/idb-7.1.1.tgz#d910ded866d32c7ced9befc5bfdf36f572ced72b"