-
Notifications
You must be signed in to change notification settings - Fork 6
new tool for running the docs server #117
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/bash | ||
| # convient script to run the docs server. It automatically rebuilds and restarts when you change code. You just need to refresh your browser. | ||
| cd "$(dirname "$0")" | ||
| WATCH_PATH="." | ||
| START_SERVER_CMD="make develop-docs-comprehensive" | ||
| while true; do | ||
| $START_SERVER_CMD & | ||
|
|
||
| echo "Server started" | ||
|
|
||
| echo "Waiting for 15 seconds before starting to watch for file changes..." | ||
| sleep 15 | ||
|
|
||
| if [[ "$OSTYPE" == "darwin"* ]]; then | ||
| CHANGED_FILE=$(fswatch -1 --exclude 'docs/static/api-reference-docs' --exclude 'build/' --exclude '/docs/.docusaurus' --exclude 'changes.log' --exclude 'docs/node_modules/.cache/webpack' --exclude '.git/' $WATCH_PATH) | ||
| echo "Detected changes in: $CHANGED_FILE" | ||
| else | ||
| echo "OS not supported" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Code changed. Attempting to kill server on port 3000..." | ||
|
|
||
| # Send SIGTERM to the process listening on port 3000 | ||
| lsof -ti:3000 | xargs kill | ||
|
|
||
| # Wait for a bit to give the process a chance to shut down gracefully | ||
| sleep 5 | ||
|
|
||
| # Check if any process is still listening on port 3000 | ||
| if lsof -ti:3000 > /dev/null; then | ||
| echo "Process didn't shut down gracefully. Force killing..." | ||
| lsof -ti:3000 | xargs kill -9 | ||
| sleep 2 | ||
|
|
||
| # Final check | ||
| if lsof -ti:3000 > /dev/null; then | ||
| echo "ERROR: Unable to kill the process running on port 3000. Exiting..." | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
|
|
||
| # Additional sleep to ensure port is released before restarting the server. | ||
| echo "Waiting for an additional 5 seconds before restarting server..." | ||
| sleep 5 | ||
|
|
||
| done | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.