Skip to content
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

1943 docs fix #2031

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/update-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: 18
- uses: webfactory/ssh-agent@v0.5.0
with:
ssh-private-key: ${{ secrets.OPENKFWCI_SSH_PRIVATE_KEY }}
Expand Down
57 changes: 57 additions & 0 deletions build-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
typedoc --entryPointStrategy expand ./src
cd ./docs/developer/api-docs

case "$OSTYPE" in
darwin*)
delimiter=true
esac

# move title to top of the page for all files
# add folder titles
# refactor title for Event and RequestData
echo "Formatting titles for all files"

for file in ./*.md ./*/*.md; do
lineNum="$(grep -n '^#\ ' "$file" | head -n 1 | cut -d: -f1)"
(grep '^#\ ' "$file" && grep -v '^#\ ' "$file") > temp.md
sed -e "${lineNum}d" temp.md>"$file"
sed -i ${delimiter:+""} '2 i\ ' "$file"
sed -i ${delimiter:+""} 's/# Class:/#/g' $file
sed -i ${delimiter:+""} 's/# Interface:/#/g' $file
sed -i ${delimiter:+""} 's/# Enumeration:/#/g' $file
sed -i ${delimiter:+""} 's/# Module:/#/g' $file

title=$(sed '1q;d' $file)

if [[ $title == "# Event" ]]; then
pathToDoc=$(echo $(sed '4q;d' $file) | sed 's/.*\[\([^]]*\)\].*/\1/g')
sed -i ${delimiter:+""} 's|# Event|# Event: '$pathToDoc'|g' $file

fi
if [[ $title == "# RequestData" ]]; then
pathToDoc=$(echo $(sed '4q;d' $file) | sed 's/.*\[\([^]]*\)\].*/\1/g')
sed -i ${delimiter:+""} 's|# RequestData|# RequestData: '$pathToDoc'|g' $file
fi
rm temp.md
done

# set title of root readme and modules file
echo "Setting title of root readme"
sed -i ${delimiter:+""} '1s/^/---\nsidebar_position: 1\nsidebar_label: Introduction\n---\n/' ./README.md
echo "Setting title of modules file"
sed -i ${delimiter:+""} '1s/^/---\nsidebar_position: 2\nsidebar_label: Table of Contents\n---\n/' ./modules.md

# set the api code docs folder name and fix position
echo "Generating the category file for the api folder"
echo '{"label": "Api Code Documentation","position": 7}' > _category_.json

echo "Generating the category file for all folders"
echo '{"label": "Functions","position": 3}' > ./modules/_category_.json
echo '{"label": "Classes","position": 4}' > ./classes/_category_.json
echo '{"label": "Enums","position": 5}' > ./enums/_category_.json
echo '{"label": "Interfaces","position": 6}' > ./interfaces/_category_.json


# for local testing copy docs to trubudget-website repo, e.g.
# cp -a ../api-docs ../../../../trubudget-website/docs/developer/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"danger": "danger",
"audit": "better-npm-audit audit",
"generate-changelog": "node generate-latest-changelog.js",
"update-logging": "(cd provisioning && npm i trubudget-logging-service@latest --save); (cd blockchain && npm i trubudget-logging-service@latest --save); (cd api && npm i trubudget-logging-service@latest --save); (cd email-notification-service && npm i trubudget-logging-service@latest --save); (cd excel-export-service && npm i trubudget-logging-service@latest --save); (cd storage-service && npm i trubudget-logging-service@latest --save); (cd frontend-collector && npm i trubudget-logging-service@latest --save)"
"update-logging": "(cd provisioning && npm i trubudget-logging-service@latest --save); (cd blockchain && npm i trubudget-logging-service@latest --save); (cd api && npm i trubudget-logging-service@latest --save); (cd email-notification-service && npm i trubudget-logging-service@latest --save); (cd excel-export-service && npm i trubudget-logging-service@latest --save); (cd storage-service && npm i trubudget-logging-service@latest --save); (cd frontend-collector && npm i trubudget-logging-service@latest --save)",
"build-docs": "bash ./build-docs.sh"
},
"type": "module",
"dependencies": {
Expand Down
Loading