This project takes the generated JSON language description and builds the documentation for it.
This project is a Create React App project.
To be able to build/run the project locally, get the latest.json
from toitdocs.infra.toit.io and put it in public/sdk/
.
This project doesn't compile anymore with recent node versions. Use,
for example, nvm
to install an older version of node. The repository
contains a .nvmrc
file that specifies the node version that works.
If you have nvm installed, but not automatically activated in your .bashrc, you will need to do
source /usr/share/nvm/init-nvm.sh
Then run nvm install
to install the correct version of node.
yarn
is used in web projects. To install yarn
, follow the guide here.
Note! You don't need to setup your PATH
env.var. as described in the guide.
If you haven't installed node
yet, install node
from nodejs.org. Add the node bin directory to your PATH
in $HOME/.profile
The version of node
must be >= v12.16.1, but see above for how to use
nvm to get the right version.
-
Add the ESLint extension to VS Code to get linting directly in the code. https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint.
-
To get the right indentation, etc. directly in the code, and on save add the Prettier extension to VS Code. https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode.
-
To get VS Code to automatically fix linting errors (if possible) and organize imports on save, add the following to your settings.json file:
"editor.codeActionsOnSave": [ "source.organizeImports", "source.fixAll.eslint" ],
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page loads the toitdoc information from public/toitdoc.json
.
You can create new json files by running the following command:
toit doc build --sdk --out "$OUTFILE"
toit doc build --package --out "$OUTFILE" $PATH_TO_PACKAGE
You might want to exclude the sdk and/or packages from the generated documentation:
toit doc build --package --exclude-sdk --out "$OUTFILE" $PATH_TO_PACKAGE
toit doc build --package --exclude-pkgs --out "$OUTFILE" $PATH_TO_PACKAGE
You can also just build the toitdoc of a folder:
toit doc build --out "$OUTFILE" $PATH_TO_FOLDER