Skip to content

Commit

Permalink
fix(supabase_functions): compile code when no dev flag is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehesp committed May 2, 2023
1 parent 199b466 commit c9c0fe3
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,27 @@ class SupabaseBuildCommand extends BaseCommand {
});
}

Future<void> runBuild() async {}
Future<void> runBuild() async {
final functionDirectory = Directory(
p.join(Directory.current.path, 'supabase', 'functions', 'dart_edge'),
);

final entryFile = File(p.join(functionDirectory.path, 'index.ts'));

final compiler = Compiler(
logger: logger,
entryPoint: p.join(Directory.current.path, 'lib', 'main.dart'),
outputDirectory: functionDirectory.path,
outputFileName: 'main.dart.js',
level: CompilerLevel.O4,
);

await compiler.compile();

await entryFile.writeAsString(
edgeFunctionEntryFileDefaultValue('main.dart.js'),
);
}

@override
void run() async {
Expand Down

0 comments on commit c9c0fe3

Please sign in to comment.