apache / openwhisk-runtime-nodejs

Apache OpenWhisk Runtime NodeJS supports Apache OpenWhisk functions written in JavaScript for NodeJS
https://openwhisk.apache.org/
Apache License 2.0
59 stars 74 forks source link

Add functionality to install modules during init #233

Closed Luke-Roy-IBM closed 1 year ago

Luke-Roy-IBM commented 1 year ago

Install modules specified in package.json during initialisation as a alternative to packageing them. Detect if the node_modules directory is missing and installes the node modules.

Luke-Roy-IBM commented 1 year ago

Simple example that shows how the new functionality works

index.js

function main(args) {
    const oneLinerJoke = require('./one-liner-joke');
    let getRandomJoke = oneLinerJoke.getRandomJoke();

    return {
            body: getRandomJoke.body
        }
}

module.exports.main = main;

package.json

{
    "name": "my-action",
    "main": "index.js",
    "dependencies" : {
        "one-liner-joke" : "1.2.2"
    }
}