Skip to content

Commit

Permalink
generate docs from submodules into docs project directory
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint committed Sep 30, 2024
1 parent f0c04e9 commit c589fd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ typechain/

.env

# ignore forge-doc artifacts as they are copied to the proper location
forge-docs/v4-core/*
forge-docs/v4-periphery/*

# Debugging logs
npm-debug.log*
yarn-debug.log*
Expand Down
12 changes: 7 additions & 5 deletions scripts/v4-forge-doc.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Usage: ./scripts/v4-forge-doc.sh, called from the root directory

# Find all the .md files in the source directory
# @dev assumes that v4-periphery and v4-core are in the parent directory
# i.e. /home/user/docs, /home/user/v4-periphery, /home/user/v4-core
# regenerate docs
forge doc --root submodules/v4-core --out forge-docs/v4-core
rm -rf submodules/v4-core/forge-docs
forge doc --root submodules/v4-periphery --out forge-docs/v4-periphery
rm -rf submodules/v4-periphery/forge-docs

# Copy v4-core
find ../v4-core/docs/src -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' | while read file; do
find forge-docs/v4-core/src -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' | while read file; do
# Extract the directory part (e.g., base, base/hooks, libraries)
dir_structure=$(echo "$file" | sed -r 's|.*/src/([^/]+)/.*\.sol/.*|\1|')

Expand Down Expand Up @@ -43,7 +45,7 @@ find ../v4-core/docs/src -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' | while read
done

# Copy v4-periphery
find ../v4-periphery/docs/src -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' | while read file; do
find forge-docs/v4-periphery/src -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' | while read file; do
# Extract the directory part (e.g., base, base/hooks, libraries)
dir_structure=$(echo "$file" | sed -r 's|.*/src/([^/]+)/.*\.sol/.*|\1|')

Expand Down

0 comments on commit c589fd6

Please sign in to comment.