Usage as an npm Dependency
Import ActiveUI SDK as a dependency
These are the different ways to declare a dependency on ActiveUI SDK in your package.json
.
1) Local tgz File
This is the easiest and quickest way and it is how the ActiveUI Application is set up by default.
In your package.json
, providing activeui-sdk-4.3.22.tgz
is located in the same folder, add the following line to your dependencies
:
{
"dependencies": {
"...": "...",
"@activeviam/activeui-sdk": "file:./activeui-sdk-4.3.22.tgz",
"...": "..."
}
}
You can of course adapt the relative path if your tgz
file is located in a different folder.
The ActiveUI SDK
tgz
is a large binary file. We recommend to always "gitignore" it. Continue reading for better ways to depend on ActiveUI SDK.
2) Maven Integration
If you version your ActiveUI application in the same repository as your ActivePivot server, you can piggyback on your existing Maven build and pom.xml
file to depend on ActiveUI SDK.
This is what the activeui-sdk-4.3.22.jar
file is made for.
Compared to the local tgz
file approach, your package.json
would contain:
{
"dependencies": {
"...": "...",
- "@activeviam/activeui-sdk": "file:./activeui-sdk-4.3.22.tgz",
+ "@activeviam/activeui-sdk": "file:./target/dependency/META-INF/resources/activeviam/activeui-sdk",
"...": "..."
}
}
Refer to the Maven Integration page for more information on this.
3) Private npm Registry
ActiveUI SDK is a commercial library and so is not available on the public npm registry. However, you can use a private npm registry to depend on ActiveUI SDK as you would do with any other open source npm package.
This is the cleanest way to depend on ActiveUI SDK.
Private npm Registry Solutions
Here is a list of existing solutions offering a private npm registry that can be used:
Using a Private npm Registry
Once you have access to a private npm registry with ActiveUI SDK published on it, apply the following change to your package.json
:
{
"dependencies": {
"...": "...",
- "@activeviam/activeui-sdk": "file:./activeui-sdk-4.3.22.tgz",
+ "@activeviam/activeui-sdk": "4.3.22",
"...": "..."
}
}
Build your project with ActiveUI SDK as a dependency
ActiveUI SDK peer dependencies
Make sure you declare the following packages as a dependencies of your project: react, react-dom
Bundler configuration
Moment.js is a dependencies of ActiveUI SDK and bundles large locale files by default due to how bundlers like Webpack interprets its code. To prevent useless locales to be bundled in the code base, it is recommended to configure the bundler to ignore all locales from Moment.js and to opt into importing specific locales in your project directly.
Example with Webpack, add the following plugin:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/);
If you are using Create React App, this is done out of the box for you.
You will then have to opt in for specific locales you need.