Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Jan 26, 2026

Summary

Previously, the barrel file (index.ts) at the output root was only generated when both reactQuery and orm were enabled. This caused import errors when using ORM-only mode, as the output directory would have an orm/ subdirectory but no index.ts to re-export from it.

Now the barrel file is always generated (when not in dry-run mode), with exports based on which generators are enabled:

  • ORM only: export * from './orm'
  • React Query only: export * from './hooks'
  • Both: export * from './types', export * from './hooks', export * from './orm'

This fixes the CI failure in constructive-db PR #444 where tests couldn't import createClient from the SDK.

Implementation

Added a new generateRootBarrel() function in barrel.ts using Babel AST for consistency with the rest of the codebase. The function conditionally adds export * from statements based on which generators are enabled.

Review & Testing Checklist for Human

  • Verify the generated barrel file output format is correct (uses Babel AST, not string template)
  • Verify the barrel file is generated correctly for ORM-only mode (the primary fix)
  • Verify the barrel file is generated correctly for React Query-only mode
  • Verify the barrel file still works correctly when both generators are enabled (regression check)
  • After merging, regenerate the SDK in constructive-db to confirm the fix resolves the CI failure

Test Plan

  1. Run codegen with orm: true only and verify output/index.ts contains export * from './orm'
  2. Run codegen with reactQuery: true only and verify output/index.ts contains export * from './hooks'
  3. Run codegen with both enabled and verify all three exports are present
  4. Verify the generated file has the expected JSDoc header comment

Notes

Previously, the barrel file at the output root (index.ts) was only
generated when both reactQuery and orm were enabled. This caused
issues when only orm was enabled, as the output directory would
have an orm/ subdirectory but no index.ts to re-export from it.

Now the barrel file is always generated, with exports based on
which generators are enabled:
- ORM only: exports from './orm'
- React Query only: exports from './hooks'
- Both: exports from './types', './hooks', and './orm'
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Refactored the barrel file generation to use Babel AST via the new
generateRootBarrel() function in barrel.ts, for consistency with
the rest of the codebase.
@pyramation pyramation merged commit 919ffb4 into main Jan 26, 2026
50 checks passed
@pyramation pyramation deleted the devin/1769394370-fix-orm-barrel-export branch January 26, 2026 02:47
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 this pull request may close these issues.

2 participants