Skip to content

Commit 672edc3

Browse files
feat: updated API docs of bee-js to v0.5.1 (#35)
* feat: updated API docs for bee-js v0.5.1 * docs: how to generate API documentation
1 parent f2ca624 commit 672edc3

File tree

113 files changed

+20168
-1965
lines changed

Some content is hidden

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

113 files changed

+20168
-1965
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "bee-js"]
2+
path = bee-js
3+
url = [email protected]:ethersphere/bee-js.git

README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,62 @@ Don't forget to find and replace the version number for the whole of the docs fo
3434

3535
## How to generate / include the API reference html
3636

37-
**NOTE: when this is done, the docs will have to be rebuilt.**
37+
1. Preparation phase - pull bee-js submodule and update it to the necessary commit
38+
```sh
39+
# Initialise the bee-js submodule
40+
git submodule update --init --recursive
41+
42+
# Update to the latest master, you could also change directory in and retrieve specific tag or branch
43+
git submodule update --remote --merge
44+
45+
# For the generation we need to have all the dependencies
46+
cd bee-js
47+
npm ci
48+
cd ..
49+
```
50+
51+
2. Generating the docs - in the `docusaurus.config.js` and uncomment the line 9 with `'docusaurus-plugin-typedoc'` in the plugins array.
52+
53+
Build the api docs now with `npm run build`. This will probably throw some syntax errors like:
54+
55+
```
56+
./docs/api/functions/utils.bytes.isbytes.md
57+
SyntaxError: ./bee-js-docs/docs/api/functions/utils.bytes.isbytes.md: Expected corresponding JSX closing tag for <T> (11:39)
58+
59+
9 | <p><a parentName="p" {...{"href":"/docs/api/modules/utils"}}>{`Utils`}</a>{`.`}<a parentName="p" {...{"href":"/docs/api/modules/utils.bytes"}}>{`Bytes`}</a>{`.isBytes`}</p>
60+
10 | <p>{`▸ `}<strong parentName="p">{`isBytes`}</strong>{`<Length`}{`>`}{`(`}<inlineCode parentName="p">{`length`}</inlineCode>{`: Length, `}<inlineCode parentName="p">{`b`}</inlineCode>{`: Uint8Array): b is Bytes<Length`}{`>`}</p>
61+
> 11 | <p>{`Type guard for Bytes`}<T>{` type`}</p>
62+
| ^
63+
12 | <h4 {...{"id":"type-parameters"}}>{`Type parameters:`}</h4>
64+
13 | <table>
65+
14 | <thead parentName="table">
66+
@ ./.docusaurus/registry.js 1:11691-11761 1:11547-11638
67+
@ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
68+
@ ./.docusaurus/routes.js
69+
@ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
70+
@ multi ./node_modules/@docusaurus/core/lib/client/clientEntry.js
71+
Client bundle compiled with errors therefore further build is impossible.
72+
```
73+
74+
3. Fix the issues - use the following bash script
75+
```sh
76+
# Escape all unescaped '>' characters except for the lines starting with "title:"
77+
for file in `find ./docs/api`; do
78+
if [ -f "$file" ]; then
79+
mv "$file" "$file.back"
80+
sed -e '/^title:/n;s/\([^\\]\)\>/\1\\\>/g' "$file.back" &> "$file"
81+
if [ $? -eq 0 ]; then
82+
rm "$file.back"
83+
echo "fixed: $file"
84+
else
85+
mv "$file.back" "$file"
86+
echo "error: $file"
87+
fi
88+
fi
89+
done
90+
```
3891

39-
...
92+
4. In the `docusaurus.config.js` and comment the line 9 with `'docusaurus-plugin-typedoc'` in the plugins array so that the building no longer runs typedoc on `bee-js`. Test the page with `npm run start` or `npm run build` and create PR with this updated API reference.
4093

4194
## Maintainers
4295

bee-js

Submodule bee-js added at 7dfd556

docs/api-reference/api-reference.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)