Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-flows-index-comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"pgflow": patch
---

Fix freshly installed projects failing to start: the generated `supabase/flows/index.ts` contained a commented-out example import that the Supabase CLI's text-based import scanner treats as a real import, aborting `supabase start` with `failed to read file: supabase/flows/my-flow.ts`.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ describe('createFlowsDirectory', () => {
expect(indexContent).toContain("export { GreetUser } from './greet-user.ts';");
// Should have documenting comment
expect(indexContent).toContain('Re-export all flows');
// No commented-out imports: the Supabase CLI regex-scans file text and
// fails `supabase start` on any import of a non-existent file
expect(indexContent).not.toContain('my-flow');
});

it('should create greet-user.ts with named export', async () => {
Expand Down
5 changes: 4 additions & 1 deletion pkgs/cli/src/commands/install/create-flows-directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { log, confirm } from '@clack/prompts';
import chalk from 'chalk';

const INDEX_TS_TEMPLATE = `// Re-export all flows from this directory
// Example: export { MyFlow } from './my-flow.ts';
//
// Do not add commented-out import examples: the Supabase CLI scans file
// text for import statements without parsing comments, so an example that
// names a missing file breaks "supabase start" with "failed to read file".

export { GreetUser } from './greet-user.ts';
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ Create `supabase/flows/index.ts` to export your flows:

```typescript title="supabase/flows/index.ts"
// Re-export all flows from this directory
// Example: export { MyFlow } from './my-flow.ts';
// (Do not keep commented-out import examples here — the Supabase CLI's
// import scanner treats them as real imports and `supabase start` fails)

export { GreetUser } from './greet-user.ts';
```
Expand Down
Loading