Add NPM libraries

You can write the task using just plain javascript but more often than not, you may want to use a third party library to make your life easier. For example, if you are dealing with time conversion and timzones, you may want to use dayjs. This way you don't need to re-invent the wheel and you can use widely used & properly tested libraries to do the job for you.

How to add a new NPM library

In the task editor, you can see the "dependencies" section on the left.

Click on "Add dependency", then you can search for the NPM package you want to install. Currently, only the latest version are available for install.

Note that the dependencies are added on the app level, so if you add package A to one task, it is immediately available to all the other tasks in the same app.

Adding node libraries will increase the memory consumption of the task run. So make sure to only add libraries that you are using.

Required NPM libraries for app integrations

Certain app integrations may require a library in order to properly make API calls/interact. For example, with mongo integration requires mongodb library. See Shypyard SDK for more details.

Common NPM libraries

Note that Shypyard by default already comes with axios. You can access it this way:

const { libs } = require('platform');

const http = libs.http.get();
// http.get(...)

Last updated