Skip to content

AT&T Flow Designer - NPM Module adding

NPM Module adding
03.31.2017 07:11 AM
I want to add an NPM module to the package, how do I modify the package.json?
Re: NPM Module adding
04.19.2017 04:33 PM

If you mean adding an npm package as a dependency, you can do that within the configuration of the function node.
Double click on the Function node on the canvas and the editor window will open.
Under the Name field there is a "+ Dependencies" field. Click on the + and the "+Add New" will be displayed.
Clicking on that will display the Name and Version fields for the npm package that you want to reference.
Once you have coded the function you want, click Ok and then click Deploy.
Flow will include the specified npm package when it is buidling the container image.

There is a simple example flow available online to reference.
From the main Flow window, with the left nav visible, select Resources and then Community Projects.
Search for FunctionNodeUsingNPMPackage and fork the project.
It is a basic three node (inject/function/debug) flow that uses an npm package dependency.

Alternatively, you can update the package.json through the Code section of Flow. There is an option to upload and bind static libs there although please note that a full deployment is needed if you make the changes there rather than at the node level.