Digital Assistant uses global and local npm modules, which allows to efficiently manage dependencies.
To use npm, you need to have Node.js installed locally on your server.
There's a small number of dependencies that are used throughout Digital Assistant, therefore we made them globally accessible. These modules are:
require statement e.g.
let got = require('got');
In addition to global modules your Digital Assistant Components may require additional functionality provided by specific npm libraries. You can install and use these libraries locally within each component. Every Digital Assistant Card comes with a
package.json file, which is located in the scripts folder and is used to manage the dependencies:
To add a new dependency we can simply open the PowerShell and navigate to the script folder in the Card's directory:
Then, install an additional library with
npm install <module name> with
--save parameters e.g:
--save-dev parameters specify whether to save the dependency as a production or development level dependency and creates an entry in the
This allows to keep a track of used dependencies and ensures that correct packages and versions are used by everyone in the team in case the node_modules folder is modified.
Then, the updated component can be zipped and uploaded to the Workplace Manager.
If you would like to know more about how to download/upload components in Digital Assistant, please have a look at this guide.