-
-
Notifications
You must be signed in to change notification settings - Fork 57
Add configurable add-on options system with Prisma ORM #127
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
Open
timoconnellaus
wants to merge
9
commits into
TanStack:main
Choose a base branch
from
timoconnellaus:feature/add-on-options
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add configurable add-on options system with Prisma ORM #127
timoconnellaus
wants to merge
9
commits into
TanStack:main
from
timoconnellaus:feature/add-on-options
+2,709
−68
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add Zod schemas for add-on option definitions - Support conditional file generation with EJS templates - Enable package.json.ejs for conditional dependencies - Implement filename prefix stripping for database-specific files - Create Drizzle add-on with database provider option
- Move add-on configuration from inline display to dedicated dialog - Add settings button (gear icon) next to info icon for configurable add-ons - Create new AddOnConfigDialog component with proper modal interface - Fix reactive state subscription for add-on options in sidebar - Clean up sidebar layout by removing inline configuration clutter - Add proper default option initialization when add-ons are toggled - Export add-on option types from engine for better type safety Improves UX by providing dedicated space for configuration with clear context while keeping the sidebar clean and compact.
- Enhanced --list-add-ons to show * for configurable add-ons - Added --addon-details command to show comprehensive add-on information - Added --add-on-config option for non-interactive configuration - Supports discovering options, dependencies, routes, and all add-on metadata
Implements Phase 4 testing for the add-on options system with comprehensive unit test coverage: - add-on-options.test.ts: Zod schema validation, default population, and error handling (15 tests) - template-context.test.ts: EJS template context with addOnOption variable integration (12 tests) - filename-processing.test.ts: Prefix stripping logic for __prefix__filename patterns (11 tests) - conditional-packages.test.ts: EJS conditional package.json processing (11 tests) Key test coverage areas: - Option schema validation with comprehensive positive/negative cases - Template variable integration and conditional file processing - Filename prefix stripping (__option__filename.ext.ejs → filename.ext) - Conditional package dependency generation via EJS templates - Error handling for malformed options and templates All 49 new tests pass, ensuring robust validation of the add-on options functionality.
- Document configuration format and option types in info.json - Explain template usage with addOnOption variables - Cover conditional file naming conventions with prefixes - Provide complete examples for both React CRA and Solid frameworks - Include CLI usage patterns for interactive and non-interactive modes - Add best practices for add-on developers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a comprehensive add-on options system that allows add-ons to define configurable options for users during app creation.
What This Enables
Template Configuration Examples
Add-on definition with options:
Conditional file generation based on options:
<\!-- __postgres__schema.prisma.ejs --> <% if (addOnOption.prisma.database \!== 'postgres') { ignoreFile() } %> generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) email String @unique name String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
Dynamic package dependencies:
Key Features Implemented
addOnOption
context variable__prefix__
filename patternspackage.json.ejs
templatesCLI Usage Examples
Test plan