openwhisk-runtime-nodejs icon indicating copy to clipboard operation
openwhisk-runtime-nodejs copied to clipboard

Publish npm for the nodejs images

Open ieb opened this issue 6 years ago • 4 comments

If the npm package that is defined by https://github.com/apache/incubator-openwhisk-runtime-nodejs/blob/master/core/nodejs8Action/package.json was published to npm then projects would be able to depend on it and get the current set of js dependencies present in OW. Those projects building with webpack would also be able to exclude those packages from their builds, making their images smaller.

ieb avatar Mar 01 '18 13:03 ieb

I don’t follow your comment

Your saying to publish the proxy code as an external library on npm?

Actions don’t need this as it’s a proxy that it’s already present and runs your code.

You don’t need to include it

I have being thinking on including the code in the “openwhisk” npm package and have it expose via something openwhsik.proxy()

csantanapr avatar Mar 03 '18 11:03 csantanapr

I am suggesting that there is a npm that defines all the dependencies already deployed into the nodejs8Action docker container so that, those who are developing functions can include that in their own project.json files and get the current list of provided dependencies, without having to try and work out what they are by trial and error or reading GitHub.

For those that are using webpack or some other npm packager in their own package, they can also mark the container npm as external and reduce the size of their deployment bundle.

All you need to do to achieve this is publish https://github.com/apache/incubator-openwhisk-runtime-nodejs/blob/master/core/nodejs8Action as a npm using its package.json file as the descriptor.

ieb avatar Mar 05 '18 15:03 ieb

@csantanapr it's not about inclusion but about exclusion of modules that are provided on the target environment, i.e. the nodejs container.

This is critical if action.zip files are size limited on the openwhisk installation (say 1 or 5 MB), and your average npm module tree quickly exceeds those limits.

Using an npm module for this allows for a detailed sharing of the list of "provided' dependencies between the provider (this repository) and action authors, including the exact versions of these dependencies. The npm module can be versioned itself to correspond with new versions of the nodejs action docker images.

That npm module would not include any own javascript - just a package.json with the depdendencies.

This is especially interesting for the nodejs6 container which has a lot of useful dependencies.

alexkli avatar Mar 05 '18 19:03 alexkli

Ok thanks both @ieb and @alexkli for the explanation.

I have some more questions. Could share a hello work example on how a developer would configure its package.json and configure webpack?

npm supports npm dependencies hosted on github would that be enough to configure users package.json and webpack?

Are any of you using IBM Functions hosted solution? I offer nodejs:8 and includes a large set of dependencies and the runtime is on github maybe something similar there would help?

csantanapr avatar Mar 05 '18 20:03 csantanapr