Hi guys,
Go question on installing npm dependencies for my plugins. How do you do it? I know HollaEx plugins include some pre-installed dependencies, but what is best way to use them?
Also, how to add other libraries beyond the above?
Hi guys,
Go question on installing npm dependencies for my plugins. How do you do it? I know HollaEx plugins include some pre-installed dependencies, but what is best way to use them?
Also, how to add other libraries beyond the above?
You don’t install npm packages manually inside a HollaEx plugin.
Instead, plugins support a prescript field in the plugin’s .json file. This is the recommended and supported way to install dependencies.
You can define multiple npm packages there, and they’ll be installed automatically when the plugin is built/loaded.
Example:
"prescript": {
"run": null,
"install": [
"aws-sdk",
"awesome-phonenumber"
]
}
If you need a specific version, you can specify it directly:
"install": [
"[email protected]",
"[email protected]"
]
prescript.Below is a list of libraries that are already available in the plugins:
[
"express",
"morgan",
"cors",
"latest-version",
"npm-programmatic",
"sequelize",
"eval",
"hollaex-tools-lib",
"lodash",
"express-validator",
"multer",
"moment",
"mathjs",
"bluebird",
"umzug",
"request-promise",
"uuid",
"jsonwebtoken",
"moment-timezone",
"json2csv",
"flat",
"ws",
"node-cron",
"random-string",
"bcryptjs",
"expect-ct",
"validator",
"otp",
"geoip-lite",
"nodemailer",
"ws-heartbeat",
"winston",
"elastic-apm-node",
"winston-elasticsearch-apm",
"triple-beam",
"uglify-js",
"body-parser",
"express-limiter"
]