From c5b718c6b49479ecf090fc48962d26a44a91ba9d Mon Sep 17 00:00:00 2001 From: Agent Date: Thu, 20 Aug 2026 17:11:35 +0000 Subject: [PATCH] fix: drop commented import from flows index template --- .changeset/fix-flows-index-comment.md | 5 +++++ .../commands/install/create-flows-directory.test.ts | 3 +++ pkgs/cli/src/commands/install/create-flows-directory.ts | 5 ++++- .../src/content/docs/reference/manual-installation.mdx | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/fix-flows-index-comment.md diff --git a/.changeset/fix-flows-index-comment.md b/.changeset/fix-flows-index-comment.md new file mode 100644 index 000000000..817eb7e4c --- /dev/null +++ b/.changeset/fix-flows-index-comment.md @@ -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`. diff --git a/pkgs/cli/__tests__/commands/install/create-flows-directory.test.ts b/pkgs/cli/__tests__/commands/install/create-flows-directory.test.ts index f6ab23ab9..aaea20a97 100644 --- a/pkgs/cli/__tests__/commands/install/create-flows-directory.test.ts +++ b/pkgs/cli/__tests__/commands/install/create-flows-directory.test.ts @@ -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 () => { diff --git a/pkgs/cli/src/commands/install/create-flows-directory.ts b/pkgs/cli/src/commands/install/create-flows-directory.ts index def6baa61..31253f812 100644 --- a/pkgs/cli/src/commands/install/create-flows-directory.ts +++ b/pkgs/cli/src/commands/install/create-flows-directory.ts @@ -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'; `; diff --git a/pkgs/website/src/content/docs/reference/manual-installation.mdx b/pkgs/website/src/content/docs/reference/manual-installation.mdx index e6f222fb2..a4be2a1e8 100644 --- a/pkgs/website/src/content/docs/reference/manual-installation.mdx +++ b/pkgs/website/src/content/docs/reference/manual-installation.mdx @@ -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'; ```