Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple functions support ? #23

Closed
gaetschwartz opened this issue Apr 17, 2023 · 6 comments · Fixed by #27
Closed

Multiple functions support ? #23

gaetschwartz opened this issue Apr 17, 2023 · 6 comments · Fixed by #27

Comments

@gaetschwartz
Copy link
Contributor

I've browsed around but I'm not sure to understand how it is intended to be used to use multiple functions. Do we need one dart project for each function ?

@Salakar
Copy link
Member

Salakar commented Apr 17, 2023

You could use a monorepo with a tool like https://github.com/invertase/melos; each function could be a private package in ./packages for example. You can easily share local dependencies and build/deploy scripts with Melos too.

@gaetschwartz
Copy link
Contributor Author

gaetschwartz commented Apr 17, 2023

But AFAIK when using edge build supabase_functions --dev it always builds it as supabase/functions/dart-edge ? For now I build and rename the folder automatically. Also, edge build supabase_functions does not seem to work on my end. It just completes without doing anything (#24)

@Ehesp
Copy link
Member

Ehesp commented Apr 18, 2023

Yeah thus was part of my thinking for #12

You can define entrypoints -> name. I'll have a think.

@gaetschwartz
Copy link
Contributor Author

DM'd you on Twitter about that :) @Ehesp

@MichealReed
Copy link

My workflow looks like --

  1. Create new function with edge new supabase_functions example_dart
  2. cd example_dart && build supabase_functions --dev
  3. rename example_dart/supabase/functions/dart_edge to example_dartgen
  4. move example_dartgen to parent supabase/functions, next to original example_dart

So my folder looks like:

-supabase
 -functions
  -example_dart
  -example_dartgen
  -packages

Seems to be working well for organizes so far, maybe it will help others manage multiple functions.

@point-source
Copy link

point-source commented May 12, 2023

I also am having issues using this with multiple functions. Ideally, I think I'd like to have a mirrored folder structure. Basically /edge/functions/[my_function_name] of which there can be N functions and then once edge build supabase_functions is called, it builds each function in /edge/functions/ and outputs to /supabase/functions/*.

Alternatively, if the edge build supabase_functions accepted input/output args, I could make this behavior myself.

Currently, this tool seems to assume it will manage the entire dart package and be the only function in supabase. This is not necessarily the case since sometimes your package includes multiple aspect of your backend and sometimes even your frontend (as is often the case with supabase + frontend in one repo)

@Ehesp Ehesp closed this as completed in #27 Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants