amplify-cli
amplify-cli copied to clipboard
Is it possible to use sub folders to manage functions?
Which Category is your question related to?
Lambda
Amplify CLI Version
Any
What AWS Services are you utilizing?
Lambda
The number of funcitons I have now in my solution is getting big and I'd like to organise them a little better. So far I've been using a naming convention which has worked but I think I'd like to put my functions into sub folders for ease. This raises a few questions though:
a) Can I even use sub folders? Will all the Amplify magic still work, is it sub folder aware? b) How can I move existing functions around without breaking anything? I'd like to move my webhooks and dynamoDB stream stuff into separate folders for instance, how best to do that without breaking anything? c) When creating new functions can I declare a folder in the name when I name it via the prompt I wonder?
Cheers
Pete
Hello @PeteDuncanson, This is currently no supported natively by Amplify CLI. You could try writing the functions outside the amplify folder and use the Amplify CLI hooks to build each of the functions on a prepush into the Amplify folder.
Additionally you could use the following example:
esbuild function-a/handler.ts --bundle --outfile amplify/backend/function/functiona/src/handler.js
that build the function and outputs to the Amplify folder.
With that being said I will be marking this as a feature request.
+1
I think this is a must for large monorepo projects. Imagine having 1000+ lambda functions, it would be very hard to find code.
+1
any eta for this? This was created in 2022