For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
Hi All,
I developer a custom API for AMCe and that one is using a local node package that contains some utilities. How do I include it in my custom API so it is deployed properly using omce-deploy ?
This is the situation: Custom API depends on my utilities package.
Utilities package's package.json contains : "name": "eproseed-js-utils",
When using it locally, it can refer to it in my API's package.json as follows:
"dependencies": {
"eproseed-js-utils": "file:eproseed-js-utils"}
However, when using omce-deploy, this (obviously) does not work. Runtime cannot find my utils package. I am not "willing" to install my package in a 'global' or 'private' npm repo. Is there any way to make this work?
Thanks
NOTE: As it is a rather simple utils package, for now I copied the js file to my API and refer to that one as a workaround. The question remains how I would make this a reusable package that I can reference.
Comment
Luc,
can you confirm that issuing npm install would add your local file to the NODE folder of the package? And that if you run, npm pack that this will then contain it? The way I see it is that you copied the module into the project relative to the package.json file. Not sure the file: reference is intended for this as the feature is referred to as for development and local testing. So my assumption is that it is not properly deployed.
Anyway, if you can try npm install and npm pack then I then we are wiser. If the two work and copy your module to the module folder, then the tooling should as well in which case it would be a ER
Frank
Be the first to rate this
|
Sign in to rate this
When you use `npm pack`, you need to include the dependency in the `bundledDependencies` array in the package.json for it to be included in the packaged file.
You can add this automatically when you install the package with `npm install --save --save-bundle <dependency>`. See https://docs.npmjs.com/files/package.json#bundleddependencies
Be the first to rate this
|
Sign in to rate this
Emily,
thanks for the hint. However this is not needed. The local container actually looks at the package.json file and then installs all the dependencies. This may take a bit upon deployment but keeps the tgz file small.
Of course, you can improve the deployment by providing all dependencies to the tgz file. But then the file would be massive.
Frank
Be the first to rate this
|
Sign in to rate this
Ah. In MCS, with the zip file, all dependencies needed to be included, so I had assumed it was the same, as we are just switching to the new platform. Thanks!
Be the first to rate this
|
Sign in to rate this
However, in Oracle Mobile Hub (OMH), packaging all of the dependencies is still required https://docs.oracle.com/en/cloud/paas/mobile-hub/develop/implementing-custom-apis.html#GUID-8DC7957A-D293-4645-8F1C-AD2832816471
Be the first to rate this
|
Sign in to rate this