Skip to content

Commit

Permalink
Add a script for generating API reference
Browse files Browse the repository at this point in the history
  • Loading branch information
danielattilasimon committed Jan 31, 2021
1 parent 1b86c38 commit 5c979a8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ node_modules
# api-extractor temp files
/packages/*/temp

/temp
.env
.eslintcache
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"build:dev-frontend": "yarn workspace @liquity/dev-frontend build",
"build:subgraph": "yarn workspace @liquity/subgraph build",
"deploy": "yarn workspace @liquity/lib-ethers hardhat deploy",
"docs": "run-s docs:*",
"docs:collect-sdk-apis": "node scripts/collect-sdk-apis.js",
"docs:api-documenter": "api-documenter markdown -i temp/sdk-apis -o docs/sdk",
"fuzzer": "yarn workspace @liquity/fuzzer fuzzer",
"prepare": "run-s prepare:*",
"prepare:contracts": "yarn workspace @liquity/contracts prepare",
Expand Down Expand Up @@ -58,6 +61,8 @@
"coverage:contracts": "yarn workspace @liquity/contracts coverage"
},
"devDependencies": {
"@microsoft/api-documenter": "^7.12.6",
"fs-extra": "^9.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2"
}
Expand Down
14 changes: 14 additions & 0 deletions scripts/collect-sdk-apis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const fs = require("fs-extra");
const path = require("path");

const filesToCollect = [
"packages/lib-base/temp/lib-base.api.json",
"packages/lib-ethers/temp/lib-ethers.api.json"
];

const outputDir = "temp/sdk-apis";

fs.removeSync(outputDir);
fs.mkdirSync(outputDir, { recursive: true });

filesToCollect.forEach(file => fs.copyFileSync(file, path.join(outputDir, path.basename(file))));
25 changes: 24 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,19 @@
resolved "https://registry.yarnpkg.com/@mdx-js/react/-/react-1.6.22.tgz#ae09b4744fddc74714ee9f9d6f17a66e77c43573"
integrity sha512-TDoPum4SHdfPiGSAaRBw7ECyI8VaHpK8GJugbJIJuqyh6kzw9ZLJZW3HGL3NNrJGxcAixUvqROm+YuQOo5eXtg==

"@microsoft/api-documenter@^7.12.6":
version "7.12.6"
resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.12.6.tgz#a7aec65d16cac9009dea38230aea77fb85089fd7"
integrity sha512-67VolY0ObxFyLqK5eVT73x1TLldZHWOyeW4R1FazGA+3LPheCU+TLW6ys7yrdtwuprw2jqtOXcvhVYVuvjkepw==
dependencies:
"@microsoft/api-extractor-model" "7.12.1"
"@microsoft/tsdoc" "0.12.24"
"@rushstack/node-core-library" "3.35.2"
"@rushstack/ts-command-line" "4.7.8"
colors "~1.2.1"
js-yaml "~3.13.1"
resolve "~1.17.0"

"@microsoft/[email protected]":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.12.1.tgz#1f10915c434048da34e1c07845ba2623d5f23f66"
Expand Down Expand Up @@ -8777,6 +8790,16 @@ fs-extra@^9.0, fs-extra@^9.0.1:
jsonfile "^6.0.1"
universalify "^1.0.0"

fs-extra@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"

fs-jetpack@^2.2.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/fs-jetpack/-/fs-jetpack-2.4.0.tgz#6080c4ab464a019d37a404baeb47f32af8835026"
Expand Down Expand Up @@ -11235,7 +11258,7 @@ [email protected], js-sha3@^0.8.0, js-sha3@~0.8.0:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==

[email protected]:
[email protected], js-yaml@~3.13.1:
version "3.13.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
Expand Down

0 comments on commit 5c979a8

Please sign in to comment.