Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automating the doc schema generation using husky. #2851

Closed
wants to merge 14 commits into from
22 changes: 12 additions & 10 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
[ -n "$CI" ] && exit 0

# Change to the current directory
npm run dev &
SERVER_PID=$!

# Checks code for typescript type errors and throws errors if found.
npm run typecheck
# Wait for server to be ready (adjust sleep time as needed)
sleep 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove server management from pre-commit hook.

Starting a server in a pre-commit hook introduces several risks:

  • Race conditions if multiple developers commit simultaneously
  • Potential port conflicts if a server is already running
  • Unreliable sleep-based timing
  • Resource overhead for every commit

Based on the PR discussion with @palisadoes, this should be moved to a CI/CD workflow instead.

🧰 Tools
🪛 GitHub Actions: PR Workflow

[error] Unauthorized file modification or deletion attempt


# Formats staged code using prettier
# Checks and fixes all lint issues in code which don't require manual intervention.
# Throws errors if lint issues requiring manual intervention are found in code.
# Run your commands
npm run format:fix
# npm run lint:fix
npm run lint-staged

npm run gen:schema

# Generate table of contents for markdown files in root directory
npm run typecheck
npm run update:toc
npm run generate:graphql-markdown
npm run generate:graphql-schema

# Kill the background server process

# Add the changes made to the stage
git add .
Loading
Loading