npm package: @hortiview/generator-hortiview
Description: Generator for a HortiView module-template.
Author: Nico Pfeiffer
Latest version: 2.0.20158

# HortiView Template-Generator

This yeoman-generator creates the scaffolding for a HortiView-module. 
The module is based on [RSBuild][3] and React Version 18.3.1.
It uses the [@hortiview/modulebase][4] to implement everything, that is required to make the module work with Bayers HortiView.\
The generator creates template structure with examples for pages, access to module api data and custom apis.\
Via the [@hortiview/modulebase][4], the routing, localization and access to any of the backend-services is handles.\
The template currently doesn't use the [@hortiview/shared-components][1], but will do in the next update.


[1]:https://www.npmjs.com/package/@hortiview/shared-components
[2]:https://webpack.js.org/concepts/module-federation/
[3]:https://rsbuild.dev/
[4]:https://www.npmjs.com/package/@hortiview/modulebase

## Features
- `Routing` - the routing works fully integrated with HortiView
- `Breadcrumb` - the breadcrumb of HortiView will be updated automatically 
- `Localization` - language switch in HortiView will be detected by the module as well
- `Backend-Servicewrapper` - You can access module- and common-api data via the useEntity- and useCommon-Hooks, that are provided by the [@hortiview/modulebase][4]
- `automatic error handling and logging` - errors are handled by the ModuleBase-Component, that is the entry-point of a module

## Installation
You need to install yeoman-generator:
```bash
npm install -g yo
```
Then you need to install the generator itself. It should be installed globally:
```bash
npm i -g @hortiview/generator-hortiview
```

We recommend to install yarn as package-manager:
```bash
npm install -g yarn
```

## How to use the generator?
1. After installing the dependencies, you can call the generator with `yo`.\
    You should call this inside a newly created folder for project, e.g.:
    (create a folder)\
    e.g. `mkdir your-project`

    (call the generator)
    ```bash
    yo @hortiview/hortiview
    ```

2. Anwser the question for a project-name:\
    e.g. `Your Project`

3. After entering the project-name the generator creates all config files, scaffoldings and installs the depedencies `via yarn`.\
    When the installation is done, everything is set up and you can start the project.

## Getting started after generating a template
You can use `yarn start:dev` to start the project with the debug-configuration. \
When doint this, the project will run on port `3001` - it will also automatically open the test-environment and try to load the LocalDebug-Module.\
You need to be logged in and need to have the [localdebug-module](https://app.tes-bayer.hortiview.com/farm/marketplace/f3250df8-f3f9-414e-9c72-7ad8195dd8b1) installed.

For a full guide, please take a look on the [Documentation][5]


## How to provide the solution in HortiView after development?
To create a fully builded module, that can be uploaded to HortiView as a module; You need to run `yarn build` to create a builded module, that can be uploaded..\
This build uses the `hvconfig.json`-file, you can adjust the names in that file, if you like, but they will be "preset" by the generator.


[5]:https://docs.hortiview.com