toitware / web-toitdocs

MIT License
0 stars 0 forks source link

Setup for development

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/.

Node version

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

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.

Linting and imports in VS Code

Useful developer tools

Development

Available yarn scripts

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

JSON files

The page loads the toitdoc information from public/toitdoc.json.

You can create new json files by running the following command:

Core libraries

toit doc build --sdk --out "$OUTFILE"

Package

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

Folder

You can also just build the toitdoc of a folder:

toit doc build --out "$OUTFILE" $PATH_TO_FOLDER