Wen Zhang
ff6c207e9e
|
5 years ago | |
---|---|---|
.. | ||
README.md | 5 years ago |
README.md
Harmony JS-SDK Documentation
CLICK ME!! to see the documentation
metaDocumentation
Summary
The following content demonstrate how to generate our documentation!
Step 1: Generate Documentation
Introduction of TypeDoc
TypeDoc is used to generate HTML
See TypeDoc command line arguments, to understand how to use them.
Usingtypedoc --help
to see themFor example:
typedoc --name <Name>
to set the name of header
typedoc --theme <default | minimal | path/to/theme>
to set the theme of documation
typedoc --readme <path/to/readme | none>
path to readme file that should be displayed on the index page.
typedoc --ignoreCompilerErrors
Should TypeDoc generate documentation pages even after the compiler has returned errors?
Install TypeDoc
Local installation (prefered)
$ npm install typedoc --save-dev
Golbal CLI installation
$ npm install --global typedoc
Generate HTML
cd docs
typedoc --out ./account ../packages/harmony-account/ --ignoreCompilerErrors
typedoc --out ./contract ../packages/harmony-contract/ --ignoreCompilerErrors
typedoc --out ./core ../packages/harmony-core/ --ignoreCompilerErrors
typedoc --out ./crypto ../packages/harmony-crypto/ --ignoreCompilerErrors
typedoc --out ./network ../packages/harmony-network/ --ignoreCompilerErrors
typedoc --out ./staking ../packages/harmony-staking/ --ignoreCompilerErrors
typedoc --out ./transaction ../packages/harmony-transaction/ --ignoreCompilerErrors
typedoc --out ./utils ../packages/harmony-utils/ --ignoreCompilerErrors
Run a simpleHTTPServer to test it
$ python3 -m http.server 8000
Then View the documentation generated at http://localhost:8000
http://localhost:8000/core/index.html
http://localhost:8000/account/index.html
http://localhost:8000/contract/index.html
http://localhost:8000/crypto/index.html
http://localhost:8000/network/index.html
http://localhost:8000/staking/index.html
http://localhost:8000/transaction/index.html
http://localhost:8000/utils/index.html
Step 2: Deploy on AWS (harmony core only!)
Create an AWS s3 bucket
Actually, there are just two points needed!
- Create an AWS S3 bucket, UNCHECK
Block all public access
- Put the files into the bucket, and set the public permission to
Grant public read access to this object(s)
Method 1: Use Console
Here is the documentation of AWS, just follow it!
Don't forget the two points mentioned above
Method 2: Use AWS CLI
Reference: AWS CLI documentation
If you have never used AWS CLI, you need follow these to set up your environment first!
After that, use AWS CLI to do following
- Create a Bucket
aws s3 mb s3://harmony-js-sdk-doc
- List all buckets you have created
aws s3 ls
- Uploade the files into bucket
aws s3 cp ./account s3://harmony-js-sdk-doc --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --recursive
Here is some explanations
./account
the path of folder which we want to uploads3://harmony-js-sdk-doc
the bucket name on AWS S3--grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Grant read access to all user--recursive
Command is performed on all files or objects under the specified directory or prefix.
- Open the folder in S3 bucket and find
index.html
, get theObject URL
, then make it public!