TLDR; I want to be able to run
serverless deploy from outside the app’s directory.
├───DirectoryX (program that deploys other apps) │ deployer-script.js ├───ServerlessApp (app to be deployed) │ serverless.yml │ package.json │ functionOne.js │ functionTwo.js │ ... │ ...
I’m trying to programmatically assemble node applications and deploy them with serverless.
To achieve that, I have a program running on directory X, which assembles code in directory Y.
The outcome is a directory Y with a valid node application structure, containing source code, package.json and a serverless.yml.
The next step would be to remotely trigger
serverless deploy so the source code gets packaged and deployed.
I cannot do that from the process running at directory X.
Locally, I have serverless installed as a global npm package, so I can run the command at the Y directory.
But in production, best case I can install serverless as a local npm package, so I can’t package and deploy an application outside the root of my current app’s directory.
Can you think of any way to make this happen?
I tried pointing from directory X at the absolute path location to the serverless script in the node_modules folder installed in app/directory Y.
The command crashes.
Any help would be appreciated.