You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add configurable add-on options system
- 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
* no optional path to drizzle db location
* feat: improve add-on options UI with settings dialog
- 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.
* cli in interactive mode asks for option values
* feat: add add-on discovery and configuration CLI options
- 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
* test: add comprehensive unit tests for add-on options system
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.
* docs: add comprehensive add-on options documentation
- 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
* add addon options to the mcp
* switch to prisma
* feat: add post-init script support for add-ons
- Add postInitScript field to add-on info schema
- Implement post-init script execution in special steps
- Update Prisma add-on with database initialization script
- Add comprehensive tests for post-init script functionality
- Handle script execution after package installation
- Fix bun package manager test expectation
* watch the cli's for changes with pnpm dev
* split out prisma into two add-ons
* feat: prisma updates and fixups
* fix: small ui fix
---------
Co-authored-by: timoconnellaus <[email protected]>
Copy file name to clipboardExpand all lines: frameworks/react-cra/ADD-ON-AUTHORING.md
+168Lines changed: 168 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,3 +193,171 @@ If you don't want a header link you can omit the `url` and `name` properties.
193
193
You **MUST** specify routes in the `info.json` file if your add-on supports the `code-router` mode. This is because the `code-routers` setup needs to import the routes in order to add them to the router.
194
194
195
195
By convension you should prefix demo routes with `demo` to make it clear that they are demo routes so they can be easily identified and removed.
196
+
197
+
# Add-on Options
198
+
199
+
The CTA framework supports configurable add-ons through an options system that allows users to customize add-on behavior during creation. This enables more flexible and reusable add-ons that can adapt to different use cases.
200
+
201
+
## Overview
202
+
203
+
Add-on options allow developers to create configurable add-ons where users can select from predefined choices that affect:
204
+
205
+
- Which files are included in the generated project
206
+
- Template variable values used during file generation
207
+
- Package dependencies that get installed
208
+
- Configuration file contents
209
+
210
+
## Configuration Format
211
+
212
+
Options are defined in the `info.json` file using the following schema:
213
+
214
+
```json
215
+
{
216
+
"name": "My Add-on",
217
+
"description": "A configurable add-on",
218
+
"options": {
219
+
"optionName": {
220
+
"type": "select",
221
+
"label": "Display Label",
222
+
"description": "Optional description shown to users",
223
+
"default": "defaultValue",
224
+
"options": [
225
+
{ "value": "option1", "label": "Option 1" },
226
+
{ "value": "option2", "label": "Option 2" }
227
+
]
228
+
}
229
+
}
230
+
}
231
+
```
232
+
233
+
### Option Types
234
+
235
+
#### Select Options
236
+
237
+
The `select` type allows users to choose from a predefined list of options:
238
+
239
+
```json
240
+
"database": {
241
+
"type": "select",
242
+
"label": "Database Provider",
243
+
"description": "Choose your database provider",
244
+
"default": "postgres",
245
+
"options": [
246
+
{ "value": "postgres", "label": "PostgreSQL" },
247
+
{ "value": "mysql", "label": "MySQL" },
248
+
{ "value": "sqlite", "label": "SQLite" }
249
+
]
250
+
}
251
+
```
252
+
253
+
**Properties:**
254
+
255
+
-`type`: Must be `"select"`
256
+
-`label`: Display text shown to users
257
+
-`description`: Optional help text
258
+
-`default`: Default value that must match one of the option values
259
+
-`options`: Array of value/label pairs
260
+
261
+
## Template Usage
262
+
263
+
Option values are available in EJS templates through the `addOnOption` variable:
264
+
265
+
```ejs
266
+
<!-- Access option value -->
267
+
<% if (addOnOption.myAddOnId.database === 'postgres') { %>
0 commit comments