Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c7fd435
add doctoc automation
Mudaafi May 3, 2025
c96e8c4
Sets pre_push script to be git executable
Mudaafi May 3, 2025
10b0b17
Update pre_push hook to exclude changes made by doctoc
Mudaafi May 3, 2025
f057027
test pre_push hook
Mudaafi May 3, 2025
903b6c3
test: edits to doctoc section
Mudaafi May 3, 2025
f23a253
test2: edits to doctoc section
Mudaafi May 3, 2025
7f20b16
update pre_push hook
Mudaafi May 5, 2025
fc1b5be
update readme
Mudaafi May 5, 2025
a46896a
update doctoc configs
Mudaafi May 5, 2025
6055e42
lint
Mudaafi May 5, 2025
80a7ac1
update pre-push hook to append a new commit instead of ammend
Mudaafi May 5, 2025
f757781
testing pre_push hook flow
Mudaafi May 5, 2025
e56366d
revert back to amend
Mudaafi May 5, 2025
46f8391
Test the hook
esezen May 8, 2025
4547ddf
Test
esezen May 8, 2025
43785ab
testing
Mudaafi May 8, 2025
545f1a3
Test Removing section
Mudaafi May 8, 2025
eb7d575
a
mocca102 May 20, 2025
ada0fb3
b
mocca102 May 20, 2025
fc65e42
c
mocca102 May 20, 2025
a745838
Add thing
esezen May 20, 2025
bd07dda
Add new topic
esezen May 20, 2025
46be0f7
Revert "revert back to amend"
esezen May 20, 2025
c20be72
Reapply "revert back to amend"
esezen May 20, 2025
e78adbd
Update readme
esezen May 20, 2025
2ba9e11
Change pre-push to pre-commit
Mudaafi May 29, 2025
258e176
base case
Mudaafi May 29, 2025
8dea1a3
move to post-commit
Mudaafi May 29, 2025
66f18b7
fix post-commit script
Mudaafi May 29, 2025
ca2dba1
Test: README Change outside TOC
Mudaafi May 29, 2025
e263c5f
docs: auto-update README TOC (post-commit)
Mudaafi May 29, 2025
5cfbc4e
fix post-commit script
Mudaafi May 29, 2025
e5e711f
test: local TOC change
Mudaafi May 29, 2025
92c76fe
test: addition outside TOC
Mudaafi May 29, 2025
637bb5e
docs: auto-update README TOC (post-commit)
Mudaafi May 29, 2025
bad91a8
test: removal outside TOC, TOC updated
Mudaafi May 29, 2025
7c3afc2
Merge branch 'docs-revamp' into ci-4292-os-ui-autocomplete-github-rea…
Mudaafi Jun 3, 2025
9788e38
run doctoc
Mudaafi Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# --- Configuration ---
README_FILE="README.md"
AUTO_COMMIT_MESSAGE=""

# --- Script Logic ---
echo "Husky (post-commit): Checking for ${README_FILE} changes in the last commit."

# Check if README_FILE was modified in the last commit (HEAD)
if git diff-tree --no-commit-id --name-only -r HEAD | grep -q "^${README_FILE}$"; then
echo "Husky (post-commit): ${README_FILE} was modified in the last commit."

# Get the diff content of README_FILE from the last commit (HEAD vs HEAD^)
# Ensure we handle the case of the very first commit (no HEAD^)
if git rev-parse -q --verify HEAD^ >/dev/null 2>&1; then
# Get the diff content, removing the meta-headers
DIFF_CONTENT=$(git diff HEAD HEAD^ -U1000 "${README_FILE}" | sed 1,4d)
else
# First commit, consider all content as added outside TOC if not within TOC markers
DIFF_CONTENT=$(git show HEAD:"${README_FILE}" -U1000 | sed 1,4d)
fi

# Look for added lines (+) outside the TOC section
DIFF_CONTENT_EXCLUDING_TOC=$(echo "$DIFF_CONTENT" | sed '/<!-- START doctoc/,/<!-- END doctoc/d' | grep '^[+-]' || true)

if [ -n "$DIFF_CONTENT_EXCLUDING_TOC" ]; then
echo "Husky (post-commit): Changes detected in ${README_FILE} outside of the TOC section in the last commit."
echo "Husky (post-commit): Running 'npm run doctoc-readme' to update the TOC..."

# Run doctoc. It will modify the working directory file if needed.
npm run doctoc-readme

# Check if doctoc actually modified the README_FILE in the working directory
if ! git diff --quiet "${README_FILE}"; then # True if working dir has changes for README_FILE
echo "Husky (post-commit): 'npm run doctoc-readme' has modified ${README_FILE}."
echo "Husky (post-commit): Staging these changes and creating a new commit for the TOC update."
git add "${README_FILE}"

# Create a new commit for the TOC changes. Use --no-verify to prevent hooks from running again.
git commit --no-verify -m "docs: auto-update README TOC (post-commit)"
if [ $? -ne 0 ]; then
echo "Husky (post-commit): ERROR - Failed to commit TOC update."
fi

else
echo "Husky (post-commit): 'npm run doctoc-readme' ran. No further changes were needed for ${README_FILE} or it was already up-to-date."
fi
else
echo "Husky (post-commit): No changes detected in ${README_FILE} outside of the TOC section in the last commit."
fi
else
echo "Husky (post-commit): ${README_FILE} was not modified in the last commit. Skipping TOC check."
fi

exit 0 # Post-commit hooks should always exit 0
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@

</div>

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## 📌 Table of Contents

- [Features](#features)
- [React](#react)
- [⚡ Installation & Quick Start](#-installation--quick-start)
- [Shopify](#shopify)
- [⚡ Installation & Quick Start](#-installation--quick-start-1)
- [Bundle (Vanilla JS)](#bundle-vanilla-js)
- [⚡ Installation & Quick Start](#-installation--quick-start-2)
- [💡 Code Examples](#-code-examples)
- [🎨 Customization](#-customization)
- [🚀 Advanced Features](#-advanced-features)
- [🛠 Troubleshooting](#-troubleshooting)
- [📖 API Reference](#-api-reference)
- [🔗 Complementary Resources](#-complementary-resources)
- [🤝 Contributing](#-contributing)
- [📜 License](#-license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Features

- 🔌 Easy Integration – Quickly integrate with your app as a plug-and-play React component
Expand Down
Loading
Loading