Deploying OpenWhisk Actions With Dependencies
package.json
since this can specify the entry point if it’s not index.js
which is the default.
To include the dependencies, you should set up your project as usual and run npm install
on your local machine. Then, zip up your JavaScript file(s), and the node_modules
folder, plus package.json
if you need it – and deploy those as your action. Here’s a script I use to do this in one of my own projects (the Project Codename generator I built as an Alexa skill):
zip -r project-codename.zip index.js node_modules wsk action update --kind nodejs:6 alexa/project-codename project-codename.zip
The first line creates the zip file and the second one uses it to update (or create if it doesn’t exist) my action. It’s a simple workflow but like so many things – easy when you know how. I had to ask for someone else’s example and hopefully by sharing this, I’ve enabled someone else and so we keep on building more awesome :)