From 9085287fc6dd39c4a3d758531eda5f248fe7dac8 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Wed, 4 Dec 2024 18:17:58 +0100 Subject: [PATCH] revert: "chore: Move pre-commit commands to pre-push (#17996)" (#18009) This reverts commit f63c06d68ae26327c87135ba75fec55bd8e47c0f. --- .husky/pre-commit | 6 ++++++ .husky/pre-push | 22 ---------------------- CONTRIBUTING.md | 1 + package.json | 1 + 4 files changed, 8 insertions(+), 22 deletions(-) create mode 100755 .husky/pre-commit delete mode 100755 .husky/pre-push diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000000000..c6a7938b7c5a11 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn lint-staged + +yarn app-store:build && git add packages/app-store/*.generated.* diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100755 index f9a539162e1f32..00000000000000 --- a/.husky/pre-push +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -set -e - -echo "Info: Running lint-staged" -yarn lint-staged - -echo "Info: Running app-store:build" -yarn app-store:build && git add packages/app-store/*.generated.* - -git stash -q --keep-index - -# Check for new file changes after running the above commands -if ! git diff --cached --quiet; then - echo "Error: The build process modified files. Please commit the changes and try again." - git stash pop -q - exit 1 -fi - -# Restore stashed changes if nothing went wrong. -git stash pop -q diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 487c568dc8967c..b09839e929a783 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -182,6 +182,7 @@ git checkout HEAD~1 yarn.lock git commit -m "Revert yarn.lock changes" ``` +_NB_: You may have to bypass the pre-commit hook with by appending `--no-verify` to the git commit If you've pushed the commit with the `yarn.lock`: 1. Correct the commit locally using the above method. diff --git a/package.json b/package.json index a67af097965d46..b8ddd812f61141 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "lint:report": "turbo run lint:report", "lint": "turbo run lint", "postinstall": "husky install && turbo run post-install", + "pre-commit": "lint-staged", "predev": "echo 'Checking env files'", "prisma": "yarn workspace @calcom/prisma prisma", "start": "turbo run start --scope=\"@calcom/web\"",