From e92d3410fcb90de775f26608d480304094b1bda5 Mon Sep 17 00:00:00 2001 From: Yorke Rhodes Date: Wed, 5 Jul 2023 12:48:53 -0400 Subject: [PATCH] Add markdown docs generation (#2437) ### Description Adds markdown doc generation to solidity and token package May be preferable to our gitbook contract API docs --- solidity/.gitignore | 1 + solidity/README.md | 10 ++++++---- solidity/package.json | 4 +++- typescript/token/.gitignore | 5 ++++- typescript/token/foundry.toml | 7 +++++++ typescript/token/package.json | 6 ++++-- typescript/token/remappings.txt | 3 +++ 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 typescript/token/foundry.toml create mode 100644 typescript/token/remappings.txt diff --git a/solidity/.gitignore b/solidity/.gitignore index 0fbb6fa98..596b25d7e 100644 --- a/solidity/.gitignore +++ b/solidity/.gitignore @@ -10,3 +10,4 @@ coverage.json # Foundry out forge-cache +docs diff --git a/solidity/README.md b/solidity/README.md index a5795e809..e1ab27f2d 100644 --- a/solidity/README.md +++ b/solidity/README.md @@ -4,10 +4,12 @@ On-chain implementations of Hyperlane in Solidity. ## Setup -- `npm install --dev` -- `brew install jq`   OR   `sudo apt-get install jq` +- `yarn install` ## Build -- `npm run compile` -- `npm run test` +- `yarn build` + +## Test + +- `yarn test` diff --git a/solidity/package.json b/solidity/package.json index b36f56c8d..a0e39a1e7 100644 --- a/solidity/package.json +++ b/solidity/package.json @@ -32,7 +32,8 @@ "files": [ "/dist", "/contracts", - "/interfaces" + "/interfaces", + "/docs" ], "homepage": "https://www.hyperlane.xyz", "keywords": [ @@ -47,6 +48,7 @@ "lint": "solhint contracts/**/*.sol", "clean": "hardhat clean && rm -rf ./dist ./cache", "coverage": "hardhat coverage && forge coverage --report lcov", + "docs": "forge doc", "prettier": "prettier --write ./contracts ./test", "test": "hardhat test && yarn test:forge", "test:forge": "forge test -vvv", diff --git a/typescript/token/.gitignore b/typescript/token/.gitignore index 75c05ba8f..7935c8fca 100644 --- a/typescript/token/.gitignore +++ b/typescript/token/.gitignore @@ -6,4 +6,7 @@ dist/ coverage/ coverage.json *.swp -.yarn/install-state.gz \ No newline at end of file +.yarn/install-state.gz +# foundry +docs +out diff --git a/typescript/token/foundry.toml b/typescript/token/foundry.toml new file mode 100644 index 000000000..6bc742ac7 --- /dev/null +++ b/typescript/token/foundry.toml @@ -0,0 +1,7 @@ +[profile.default] +src = "contracts" +out = "out" +libs = ["lib"] +allow_paths = ["../../node_modules", "../../solidity"] + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/typescript/token/package.json b/typescript/token/package.json index bd951dc19..38cf6a8ed 100644 --- a/typescript/token/package.json +++ b/typescript/token/package.json @@ -35,7 +35,8 @@ }, "files": [ "/dist", - "/contracts" + "/contracts", + "/docs" ], "homepage": "https://www.hyperlane.xyz", "keywords": [ @@ -51,7 +52,8 @@ "url": "https://github.com/hyperlane-xyz/hyperlane-token" }, "scripts": { - "clean": "hardhat clean && rm -rf dist cache src/types", + "clean": "hardhat clean && rm -rf dist cache src/types && forge clean", + "docs": "forge doc", "build": "hardhat compile && tsc", "coverage": "hardhat coverage", "lint": "solhint contracts/**/*.sol && eslint . --ext .ts", diff --git a/typescript/token/remappings.txt b/typescript/token/remappings.txt new file mode 100644 index 000000000..13cb3ed9e --- /dev/null +++ b/typescript/token/remappings.txt @@ -0,0 +1,3 @@ +@openzeppelin=../../node_modules/@openzeppelin +@hyperlane-xyz=../../node_modules/@hyperlane-xyz +forge-std/=lib/forge-std/src/