Skip to content

Commit 5746d08

Browse files
RafaelAPBRafael Belchior
andcommitted
docs(satp-hermes): enhance typedoc documentation
Co-authored-by: Rafael Belchior <[email protected]> Signed-off-by: Rafael Belchior <[email protected]>
1 parent 7958f2c commit 5746d08

File tree

107 files changed

+5155
-1395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+5155
-1395
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
**/node_modules/**
22
**/dist/**
33
**/build/**
4+
**/public/**
45
docs/*
56
examples/cactus-example-carbon-accounting-frontend/www/
67
examples/cactus-example-supply-chain-frontend/www/

.github/workflows/satp-hermes-docker.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ jobs:
6565
- name: Set image tags
6666
id: set_tags
6767
run: |
68-
# Extract SATP package version from package.json customMetadata
69-
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').customMetadata['satp-package-version'])")
68+
# Extract SATP package version from package.json version field
69+
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)")
7070
7171
# Check if this is a release build (manual trigger with is_release=true)
7272
IS_RELEASE="${{ inputs.is_release }}"
7373
if [ "$IS_RELEASE" = "true" ]; then
74-
# Release mode: Use package.json satp-package-version or custom version as the main tag
74+
# Release mode: Use package.json version or custom version as the main tag
7575
if [ -n "${{ inputs.custom_version }}" ]; then
7676
TAG_VERSION="${{ inputs.custom_version }}"
7777
echo "Building release version with custom version: ${{ inputs.custom_version }}"
7878
else
7979
TAG_VERSION="${PACKAGE_VERSION}"
80-
echo "Building release version with satp-package-version: ${PACKAGE_VERSION}"
80+
echo "Building release version with package.json version: ${PACKAGE_VERSION}"
8181
fi
8282
TAG_SUFFIX="release"
8383
else
@@ -103,7 +103,7 @@ jobs:
103103
104104
- name: Debug Build Info
105105
run: |
106-
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').customMetadata['satp-package-version'])")
106+
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)")
107107
{
108108
echo "Debug: Current ref = ${{ github.ref }}"
109109
echo "Debug: Event name = ${{ github.event_name }}"
@@ -112,7 +112,7 @@ jobs:
112112
echo "Debug: Building for tag version = ${{ steps.set_tags.outputs.tag_version }}"
113113
echo "Debug: Building for dockerhub image = ${{ steps.set_tags.outputs.dockerhub_image }}"
114114
echo "Debug: Node.js version = v22.18.0"
115-
echo "Debug: SATP package version = ${PACKAGE_VERSION}"
115+
echo "Debug: Package version = ${PACKAGE_VERSION}"
116116
echo "Debug: Commit hash = $(git rev-parse --short HEAD)"
117117
}
118118
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: SATP Hermes Gateway Documentation
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
deploy_docs:
7+
description: 'Deploy documentation to GitHub Pages'
8+
required: false
9+
default: true
10+
type: boolean
11+
docs_branch:
12+
description: 'Branch to build docs from'
13+
required: false
14+
default: 'main'
15+
type: string
16+
workflow_dispatch:
17+
inputs:
18+
deploy_docs:
19+
description: 'Deploy documentation to GitHub Pages'
20+
required: false
21+
default: true
22+
type: boolean
23+
docs_branch:
24+
description: 'Branch to build docs from'
25+
required: false
26+
default: 'main'
27+
type: string
28+
29+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
30+
permissions:
31+
contents: read
32+
pages: write
33+
id-token: write
34+
35+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
36+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
37+
concurrency:
38+
group: "pages"
39+
cancel-in-progress: false
40+
41+
jobs:
42+
# =============================================================================
43+
# BUILD DOCUMENTATION
44+
# =============================================================================
45+
# This job builds the TypeDoc documentation for the SATP Hermes Gateway
46+
47+
build-docs:
48+
runs-on: ubuntu-latest-16-cores
49+
steps:
50+
- name: Checkout code
51+
uses: actions/[email protected]
52+
with:
53+
ref: ${{ inputs.docs_branch || github.ref }}
54+
fetch-depth: 0
55+
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: '18'
60+
cache: 'yarn'
61+
62+
- name: Install system dependencies for Puppeteer
63+
run: |
64+
sudo apt-get update
65+
sudo apt-get install -y \
66+
libnss3 \
67+
libatk-bridge2.0-0 \
68+
libdrm2 \
69+
libxkbcommon0 \
70+
libxcomposite1 \
71+
libxdamage1 \
72+
libxfixes3 \
73+
libxrandr2 \
74+
libgbm1 \
75+
libasound2
76+
77+
- name: Install dependencies
78+
working-directory: ./packages/cactus-plugin-satp-hermes
79+
run: |
80+
yarn install --frozen-lockfile
81+
82+
- name: Generate TypeDoc documentation
83+
working-directory: ./packages/cactus-plugin-satp-hermes
84+
run: |
85+
echo "Building TypeScript project..."
86+
yarn tsc
87+
88+
echo "Generating Mermaid diagrams and TypeDoc documentation..."
89+
yarn docs:generate
90+
91+
echo "Validating documentation..."
92+
yarn docs:validate || true
93+
94+
- name: Verify documentation build
95+
working-directory: ./packages/cactus-plugin-satp-hermes
96+
run: |
97+
if [ ! -d "./public/typedoc" ]; then
98+
echo "Error: Documentation directory not found!"
99+
exit 1
100+
fi
101+
102+
if [ ! -f "./public/typedoc/index.html" ]; then
103+
echo "Error: Documentation index.html not found!"
104+
exit 1
105+
fi
106+
107+
# Verify diagrams were generated
108+
if [ ! -d "./docs/assets/diagrams" ]; then
109+
echo "Error: Diagrams source directory not found!"
110+
exit 1
111+
fi
112+
113+
if [ ! -d "./public/typedoc/assets/diagrams" ]; then
114+
echo "Error: Diagrams not copied to documentation output!"
115+
exit 1
116+
fi
117+
118+
echo "✅ Documentation built successfully!"
119+
echo ""
120+
echo "📊 Generated diagrams:"
121+
find ./docs/assets/diagrams/ -type f -ls
122+
echo ""
123+
echo "📚 Documentation structure:"
124+
find ./public/typedoc/ -maxdepth 1 -ls | head -20
125+
126+
- name: Prepare documentation structure for GitHub Pages
127+
run: |
128+
mkdir -p ./gh-pages/cacti/satp
129+
cp -r ./packages/cactus-plugin-satp-hermes/public/typedoc/* ./gh-pages/cacti/satp/
130+
131+
# Create a root index.html that redirects to /cacti/satp
132+
cat > ./gh-pages/index.html << 'EOF'
133+
<!DOCTYPE html>
134+
<html>
135+
<head>
136+
<meta charset="utf-8">
137+
<title>Redirecting to SATP Documentation</title>
138+
<meta http-equiv="refresh" content="0; url=/cacti/satp/">
139+
<link rel="canonical" href="/cacti/satp/">
140+
</head>
141+
<body>
142+
<p>Redirecting to <a href="/cacti/satp/">SATP Hermes Gateway Documentation</a>...</p>
143+
</body>
144+
</html>
145+
EOF
146+
147+
echo "GitHub Pages structure prepared:"
148+
find ./gh-pages -type f | head -20
149+
150+
- name: Create documentation metadata
151+
run: |
152+
VERSION=$(node -p "require('./packages/cactus-plugin-satp-hermes/package.json').version")
153+
SATP_VERSION=$(node -p "require('./packages/cactus-plugin-satp-hermes/package.json').customMetadata['satp-package-version']")
154+
155+
cat > ./gh-pages/cacti/satp/metadata.json << EOF
156+
{
157+
"version": "${VERSION}",
158+
"satp_version": "${SATP_VERSION}",
159+
"build_date": "$(date -u '+%Y-%m-%d %H:%M:%S UTC')",
160+
"commit": "${{ github.sha }}",
161+
"branch": "${{ inputs.docs_branch || github.ref }}",
162+
"workflow_run": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
163+
}
164+
EOF
165+
166+
echo "Documentation metadata created:"
167+
cat ./gh-pages/cacti/satp/metadata.json
168+
169+
- name: Setup Pages
170+
if: inputs.deploy_docs == true
171+
uses: actions/configure-pages@v5
172+
173+
- name: Upload documentation artifact
174+
if: inputs.deploy_docs == true
175+
uses: actions/upload-pages-artifact@v3
176+
with:
177+
path: './gh-pages'
178+
179+
# =============================================================================
180+
# DEPLOY TO GITHUB PAGES
181+
# =============================================================================
182+
# This job deploys the built documentation to GitHub Pages
183+
184+
deploy-docs:
185+
if: inputs.deploy_docs == true
186+
environment:
187+
name: github-pages
188+
url: ${{ steps.deployment.outputs.page_url }}
189+
runs-on: ubuntu-latest
190+
needs: build-docs
191+
steps:
192+
- name: Deploy to GitHub Pages
193+
id: deployment
194+
uses: actions/deploy-pages@v4
195+
196+
- name: Post deployment summary
197+
run: |
198+
{
199+
echo "## 📚 Documentation Deployment Successful"
200+
echo ""
201+
echo "**Documentation URL:** ${{ steps.deployment.outputs.page_url }}"
202+
echo "**Branch:** ${{ inputs.docs_branch || github.ref }}"
203+
echo "**Deployed:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
204+
} >> "$GITHUB_STEP_SUMMARY"

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,3 @@ supply-chain-attack-09082025-audit-scan.out
8080
packages/cactus-plugin-satp-hermes/.config
8181

8282
*.sqlite3
83-
packages/cactus-plugin-satp-hermes/src/test/solidity/generated/build-info
84-
packages/cactus-plugin-satp-hermes/public/typedoc/** */

examples/cactus-example-cbdc-bridging-backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"@hyperledger/cactus-plugin-ledger-connector-besu": "2.1.0",
102102
"@hyperledger/cactus-plugin-ledger-connector-fabric": "2.1.0",
103103
"@hyperledger/cactus-plugin-object-store-ipfs": "2.1.0",
104-
"@hyperledger/cactus-plugin-satp-hermes": "2.1.0",
104+
"@hyperledger/cactus-plugin-satp-hermes": "workspace:*",
105105
"@hyperledger/cactus-test-tooling": "2.1.0",
106106
"@openzeppelin/contracts": "4.9.6",
107107
"@openzeppelin/contracts-upgradeable": "4.9.6",

packages/cactus-plugin-satp-hermes/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,11 @@ reports/junit/satp-hermes-tests-integration.xml
1212

1313
# TypeDoc generated documentation
1414
public/typedoc/
15+
16+
# Generated diagrams (keep only .mmd source files)
17+
assets/diagrams/*.svg
18+
assets/diagrams/*.png
19+
assets/diagrams/*.pdf
20+
src/test/solidity/generated/build-info
21+
typedoc/** */
22+
docs/assets/diagrams

0 commit comments

Comments
 (0)