Custom JavaScript Library with SpringBot
SpringBot uses Angular as its client-side framework, which in turn makes use of NodeJS and yarn. Dependencies can be added to Angular project via package.json
, which is a configuration file that informs yarn what and how to install packages.
The following steps will walk through using the charting library chart.js within SpringBot.
- Open the
package.json
file located atclientside/package.json
-
Locate the following code block and turn on the protected region by replacing
off begin
withon begin
"//": [ " protected region % [Add custom dependencies here] off begin " ],
-
Add these lines below the code block
"chart.js": "~2.8.0",
Your protected region should now look like the following,
"//": [ " protected region % [Add custom dependencies here] on begin " ], "chart.js": "~2.8.0", "//": [ " protected region % [Add custom dependencies here] end " ]
The supplied version number for chart.js is the most recent version at time of writing.. Your versions may vary.
- Open a new terminal and navigate to
clientside
. -
Run
yarn install
.You are now able to use chart.js in your application code.
Was this article helpful?