Skip to content

Commit

Permalink
update README with new instructions for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
MicBoucinha committed Jun 28, 2024
1 parent 949a660 commit a93d86f
Showing 1 changed file with 72 additions and 28 deletions.
100 changes: 72 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,7 @@ The repository is open for contributions. If you want to contribute to the docum
4. Push the changes to your fork.
5. Create a pull request.

## Prerequisites

- [DocFx](https://dotnet.github.io/docfx/)
- [Node.js](https://nodejs.org/) (optional for automatic documentation generation)

> [!IMPORTANT]
> If you use Node.js, you can install the dependencies by running the following command at the `docs` folder:
> ```bash
> npm install
> ```
## Documentation
# Documentation

The documentation is written in Markdown and is available under the `docs` folder. The documentation is built using [DocFx](https://dotnet.github.io/docfx/).

Expand All @@ -59,46 +48,101 @@ Under the `docs` folder, you will find the following structure:

## Local Development

If you want to build the documentation locally, you need to understand the three steps involved in the documentation generation.
### Prerequisites

- [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget/) (only for Windows users)
- [Powershell](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell) (recommended for Windows users)
- [.NET SDK](https://dotnet.microsoft.com/download) (required for DocFx, LTS version recommended)
- [DocFx](https://dotnet.github.io/docfx/)
- [Node.js](https://nodejs.org/) (optional for automatic documentation generation)


1. Setup local Bonsai installation (only required to do once).
2. Convert the Bonsai workflows to SVG images.
3. Build the documentation using DocFx.
### Installing Prerequisites

The first step is automated using a Powershell script. The script is available under the `.bonsai` folder with the name `Setup.ps1`.
>[!WARNING]
> The instructions are for **Windows** users only.
> [!NOTE]
> This is only required to be done once.
WinGet should already be installed directly on Windows 10 1709 or higher. If not, you can get it through the Microsoft Store or by following the instructions on the [official documentation](https://learn.microsoft.com/en-us/windows/package-manager/winget/).

You can run the script using the following command, while at the `.bonsai` folder:
With WinGet installed, you can install the remaining prerequisites by running the following commands on Powershell for Windows:

```powershell
.\Setup.ps1
# install Powershell 7.x
winget install --id Microsoft.Powershell --source winget
# install .NET SDK 8 LTS version
winget install -e --id Microsoft.DotNet.SDK.8
# install Node.js (optional, only required for automatic documentation generation)
winget install -e --id OpenJS.Nodejs.LTS
```

### Installing DocFx
Now open a new `Powershell 7` window and run the following commands:

```powershell
# verify .NET SDK installation
dotnet --version
# install DocFx
dotnet tool install -g docfx
```

### Cloning the Repository

You can clone the repository using the following command:

```bash
git clone --recurse-submodules [email protected]:fchampalimaud/cf.bonsai.git
cd cf.bonsai
```

If for some reason you forgot to clone the submodules, you can run the following command to get them:

```bash
git submodule update --init --recursive
```

The last two steps are automated using a Powershell script. The script is available under the `docs` folder with the name `build.ps1`.
### First setup

> [!IMPORTANT]
> This is required to be done every time you add new Bonsai workflows to the repository.
To build the documentation, you need to install the dependencies. You can do this by running the following commands at the `docs` folder:

You can run the script using the following command, while at the `docs` folder:
```bash
dotnet tool restore

# if you have NodeJS installed, you need to install the NodeJS dependencies
npm install
```

Now we need to setup Bonsai locally. You can do this by running the following command at the `.bonsai` folder in a Powershell window:

```powershell
.\Setup.ps1
```

### Generating SVG images from Bonsai workflows

To generate the SVG images from the Bonsai workflows and generate the documentation, you need to run the following command at the `docs` folder:

```powershell
.\build.ps1
```

If you don't have new workflows to be converted, you can save time by generating the documentation manually by following running the following command while at the `docs` folder.
> [!CAUTION]
> This is required to be done every time you add a new workflow to the `workflows` folder.
### Building the Documentation

To generate the documentation you need to run the following command while at the `docs` folder.

```powershell
docfx --serve
# or if you have Node installed
# or if you have Node installed (it will automatically update the documentation on each .md and .yml file change)
npm run docfx
```

The documentation will be available at [http://localhost:8080](http://localhost:8080).

> [!CAUTION]
> [!WARNING]
> The documentation will only be updated automatically if you have NodeJS installed.
If you want to update the documentation, you will need to stop the server and run `docfx --serve` again.

0 comments on commit a93d86f

Please sign in to comment.