I'm writing GCP functions in a npm repository, here is the structure of my files:
$ root .
└── package.json
└── src
└── index.ts
└── functions
└── fct1.ts
└── fct2.ts
└── ...
I have multiple function declaration in this index.ts
, including http functions and event functions.
One of them is serving a NestJs application that needs to initialise NestJs on cold start but since they all are in the same file (index.ts
) NestJs is in scope for all the functions, including the event functions and other http functions which is delaying the cold start of all of them.
I am currently deploying all the functions in a github action doing firebase deploy --only functions
.
Is there a way to split the functions declarations in different files?
I found this resource: https://firebase.google.com/docs/functions/organize-functions?gen=2nd but I don't really want to create npm repositories for each function that has a different scope. Furthermore, all the functions share resources like models, apis, services, ...
Thanks for the help