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

feat: mdbook docs #22

Merged
merged 1 commit into from
Nov 23, 2023
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ out/*/*
# Keep the latest deployment only
broadcast/*/*/*

# Docs build files
docs/book
docs/src/solidity/interfaces
docs/src/static

# Cache for the python scripts
proofs/__pycache__/*
38 changes: 38 additions & 0 deletions build-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# generate docs in a temporary directory
FOUNDRY_PROFILE=docs forge doc --out tmp/safe-liveness-technical-docs

# edit generated summary not to have container pages
# - [jobs](solidity/interfaces/jobs/README.md)
# should become
# - [jobs]()
# TODO

# edit generated summary titles to start with an uppercase letter
# - [jobs]()
# should become
# - [Jobs]()
# TODO

# edit the SUMMARY after the Interfaces section
# https://stackoverflow.com/questions/67086574/no-such-file-or-directory-when-using-sed-in-combination-with-find
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' -e '/\[Interfaces\]/q' docs/src/SUMMARY.md
else
sed -i -e '/\[Interfaces\]/q' docs/src/SUMMARY.md
fi
# copy the generated SUMMARY, from the tmp directory, without the first 5 lines
# and paste them after the Interfaces section on the original SUMMARY
tail -n +5 tmp/safe-liveness-technical-docs/src/SUMMARY.md >> docs/src/SUMMARY.md

# delete old generated interfaces docs
rm -rf docs/src/solidity/interfaces
# there are differences in cp and mv behavior between UNIX and macOS when it comes to non-existing directories
# creating the directory to circumvent them
mkdir -p docs/src/solidity/interfaces
# move new generated interfaces docs from tmp to original directory
cp -R tmp/safe-liveness-technical-docs/src/solidity/interfaces docs/src/solidity/

# delete tmp directory
rm -rf tmp
14 changes: 14 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- TODO: add links to oracles.rip, to mirror and to twitter -->

# Overview

- [Smart Contracts]()

- [Addresses](content/smart-contracts/addresses.md)
- [Interfaces]()
- [IBlockHeaderOracle](solidity/interfaces/IBlockHeaderOracle.sol/interface.IBlockHeaderOracle.md)
- [IGuardCallbackModule](solidity/interfaces/IGuardCallbackModule.sol/interface.IGuardCallbackModule.md)
- [ISafe](solidity/interfaces/ISafe.sol/interface.ISafe.md)
- [IStorageMirror](solidity/interfaces/IStorageMirror.sol/interface.IStorageMirror.md)
- [IStorageMirrorRootRegistry](solidity/interfaces/IStorageMirrorRootRegistry.sol/interface.IStorageMirrorRootRegistry.md)
- [IVerifierModule](solidity/interfaces/IVerifierModule.sol/interface.IVerifierModule.md)
1 change: 1 addition & 0 deletions docs/src/content/smart-contracts/addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Addresses
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ out = 'out-via-ir'
fuzz_runs = 5000
src = 'solidity/test'

[profile.docs]
src = './solidity/interfaces/'

[rpc_endpoints]
mainnet = "${MAINNET_RPC}"
goerli = "${GOERLI_RPC}"
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"deploy:mainnet": "bash -c 'source .env && forge script -vv --rpc-url $MAINNET_RPC --slow --broadcast --private-key $DEPLOYER_MAINNNET_PRIVATE_KEY solidity/scripts/DeployMainnet.s.sol:DeployMainnet'",
"deploy:optimism": "bash -c 'source .env && forge script -vv --rpc-url $OPTIMISM_RPC --slow --broadcast --private-key $DEPLOYER_OPTIMISM_PRIVATE_KEY solidity/scripts/DeployOptimism.s.sol:DeployOptimism'",
"deploy:optimismGoerli": "bash -c 'source .env && forge script -vv --rpc-url $OPTIMISM_GOERLI_RPC --slow --broadcast --private-key $DEPLOYER_OPTIMISM_GOERLI_PRIVATE_KEY solidity/scripts/DeployOptimismGoerli.s.sol:DeployOptimismGoerli'",
"docs:build": "./build-docs.sh",
"docs:run": "mdbook serve docs",
"lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt check",
"lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix",
"lint:sol-logic": "solhint -c .solhint.json 'solidity/contracts/**/*.sol' 'solidity/interfaces/**/*.sol'",
Expand Down