-
Notifications
You must be signed in to change notification settings - Fork 13
add logic to ensure that the hooks inside of the woocommerce/src/ are parsed #29
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
base: trunk
Are you sure you want to change the base?
Conversation
… being parsed and add some steps to run this site locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the local environment didn't work for me - it comes up but it doesn't have any of the actual file references. This isn't critical if you know it's working for you, but maybe we should screenshare to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @piinthecloud!
Thanks for the PR 💯. It works beautifully and I can confirm that the missing hooks are now present in the docs.
As for the local script, I left some small suggestions. Nothing's really a blocker, though. Please let me know what you think! Thanks again!
# Copy only the directories we want for documentation | ||
cp -r "$WOOCOMMERCE_DIR"/includes woocommerce/ 2>/dev/null || true | ||
cp -r "$WOOCOMMERCE_DIR"/src woocommerce/ 2>/dev/null || true | ||
cp -r "$WOOCOMMERCE_DIR"/templates woocommerce/ 2>/dev/null || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you prefer this to the symbolic link you tried first?
If the symlink-based approach worked correctly, that'd be faster and less error prone than copying directories as we wouldn't need to keep this script in sync with paths inside the plugin. Everything could be handled from the phpcs.xml
file as today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piinthecloud I tested the new, non-symlinked approach and it's working for me 👍
run-local.sh
Outdated
# Run PHPDocumentor directly with the local source | ||
./vendor/bin/phpdoc run \ | ||
--template="data/templates/woocommerce" \ | ||
--sourcecode \ | ||
--defaultpackagename="WooCommerce" | ||
|
||
# Generate hook documentation AFTER PHPDocumentor completes | ||
echo "🔧 Generating hook documentation..." | ||
php generate-hook-docs.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid duplication, I'd suggest we call the ./deploy.sh
script here instead.
For example:
./deploy.sh --no-download --build-only --source-version 0.0.0
This will also take care of deleting the build/
directory if needed.
Note the 0.0.0
version. deploy.sh
shouldn't require --source-version
when --build-only
and --no-download
are used but we can probably fix that later. For now the 0.0.0
does the trick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, didn't know i could run that. That also obviates the need for lines 74-77
@jorgeatorres any additional concerns? |
This PR enhances the WooCommerce Code Reference Generator to support local development workflows by and improving the recursive file scanning to detect hooks in woocommerce/src and deeper subdirectories.
Expanded file parsing
Added
woocommerce/src
to parsed files: The logic ingenerate-hook-docs.php
has been updated to know also look insidewoocommerce/src
to detect hooks and filters in use.Fixed
generate-hook-docs.php
recursion: During testing, I detected that thegetFiles()
function wasn't going deep enough into the directories to appropriately retrieve all hook references. I simplified the logic on line 113 to directly merge the files from each subdirectory directly into the$files
array.Hook and filter detection: Increased from 1,732 to 2,580 hooks.
Local development
To facilitate development, I've added the
run-local.sh
which lets you easily set up a local server with a local copy of the docs.Tweaks
Updated the .gitignore to ensure linked
/woocommerce
files never get committed.