@hortiview/generator-hortiview
v1.2.2
Published
Generator for a HortiView module-template.
Downloads
29
Keywords
Readme
HortiView Template-Generator
This yeoman-generator creates the scaffolding for a HortiView-module. The module will be based on a create-react-app and uses craco to configure webpack to make use of the module federation.
The generator creates the whole structure for a complete module, including the integration of routing, localization and integration of the module-token to access the backend-services, when embedded in HortiView.
The template uses the @hortiview/shared-components and requires access to the element-library of bayer (via the artifactory)
IF YOU DON'T HAVE ACCESS YET, ANWSER THE SECOND PROMPT WITH NO (n)
Features
The base module and the template are still in an early stage of development and will be enhanced further with ongoing development time.
Routing
- the routing works fully integrated with HortiViewBreadcrumb
- the breadcrumb of HortiView will be updated automaticallyLocalization
- language switch in HortiView will be detected by the module as wellBackend-Servicewrapper
- the HortiView Backend is wrapped in the "HortiViewService" in the template. Its automatically instantiated and can be used via the useHortiView-Hooks- Farm-Endpoints - the endpoints can be used, but are currently not "predefined" by the template
- User-Endpoints - the endpoints can be used, but are currently not "predefined" by the template
- CommonData-Endpoints - the endpoints can be used, but are currently not "predefined" by the template
- Service-Mocks - all requests to the backend can be mocked via the GetMockReponse-Function. Calls are automatically mocked, when running in standalone-mode
Standalone
-Mode - when running the module locally, it will run in an standalone-mode, where dependencies to HortiView-Properties are either predefined or mocked, so you can still run/debug the module without using the local-debug-module of the HortiView-Dev-EnvironmentDepedencies-Check
- you can set in the ModuleBase-Component, which Properties from HortiView are required for your module to make it work correctly. Otherwise an handled error message in HortiView will be generated
Installation
You need to install yeoman-generator:
npm install -g yo
Then you need to install the generator itself. It should be installed globally:
npm i -g @hortiview/generator-hortiview
We recommend to install yarn as package-manager:
npm install -g yarn
How to use the generator?
After installing the depencies, you can call the generator.
You should call this inside a newly created folder for project, e.g.:
(create a folder)
e.g. mkdir sensor-management
(call the generator)
yo @hortiview/hortiview
Anwser the question for a project-name (in kebap case):
e.g. sensor-management
Choose if you have enough permission to use element-components or anwser with no :n
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.
That means, that the project will run on port 3001
- if you use our dev-environment, the project can be included in HortiView in runtime.
Just log into HortiView and open the debug module (the debug module is only availible in the development-enviroment).
If you start the project via yarn:start
(without :dev) it will use the normal configuration.
Integration in HortiView
To create a fully builded module, that can be uploaded to HortiView as a module, you need to run yarn build
.
After some seconds a build is created with the correct configuration (config is consumed via the hvconfig.json
-file), that already should be correct.
The whole build-folder can be uploaded as a vendor via the vendor-portal with the configuration-values from hvconfig.json
.