Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
Why creating reusable extensions?
Extensions allow you to group and package your customizations. Once an extension is built, you can plug it into Atoti UI without having to write additional JavaScript code or to rebuild JavaScript modules. For instance, suppose that you create two custom widgets and need to add them to multiple Atoti UI projects. You could package your two widgets as an NPM module and have your UI projects depend on it. But with this approach, it becomes cumbersome to release evolutions: you have to release the module containing your widgets, upgrade it in all projects, rebuild your projects and redeploy them. To avoid this, you can package your two widgets as an Atoti UI extension instead. Then releasing an evolution becomes simpler: you just have to build the new version of your extension and deploy it within your running project.How to split customizations into extensions?
You should limit the number of extensions plugged to your Atoti UI to a minimum. In particular, you should NOT create an atomic extension for each of your customizations. It is good practice to group customizations that you know will be used together into a single extension.Create an extension
To create an extension, first create a new NPM module:@activeviam/atoti-ui-cli and @activeviam/atoti-ui-sdk:
package.json:
tsconfig.json with this content:
src and a file index.ts inside it, with this content:
dist.
Plug an extension
Extensions can be plugged into the build folder of an Atoti UI project, whether it is a vanillaatoti-ui-starter downloaded from the ActiveViam Artifactory or the build folder of a project bootstrapped from the atoti-ui-starter-source, downloaded from the same place (see Setup).
Plug an extension manually
To plug your extension build into your project build manually, copy your extension’sdist folder (see Create an extension) into your project’s build/extensions folder.
Then rename this dist folder into your extension name, which is the name property in your extension’s package.json.
Finally, edit the file extensions.json in order to add your new extension to it:
@foo/bar), then the content of its dist folder will look like:
- dist
- extensionEntry.js
build/extensions:
- build
- extensions
- @foo
- bar
- extensionEntry.js
- bar
- @foo
- extensions
extensions.json must look like this:
Plug an extension using commands
If you maintain a project bootstrapped with theatoti-ui-starter-source, you might find that copying extensions manually into its build folder is cumbersome, because this folder is cleaned up each time you run your start or build scripts.
In this situation, you can install the extension as a dependency of your project:
"my-extension" to the scripts allowing you to start and build your application in its package.json:
build script:
build folder, so that you don’t have to do it manually.