DO NOT MERGE: POC for new create flow #1041
Draft
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 exercise was highly valuable as it uncovered the significant complexity surrounding the create flow. Several overarching areas of complexity emerged:
Running the POC
You can proceed through the prompts quickly, as defaults have been pre-configured. The final application will use the App Router with TypeScript and an HTTPS proxy.
Goals
Before starting the POC, I brainstormed a few objectives to define what a meaningful change to the create flow would entail and what factors would justify such a significant change:
After exploring a redesigned create flow, several key insights emerged:
Generator Files
I iterated through multiple potential file structures for the generator directory:
The final choice was Preset by category, with TypeScript variations included in the generator directory:
POC Details
The POC introduced an inversion of responsibilities between the presets and the CLI. The preset now handles most responsibilities, while the CLI simply loads the preset and defines the initial
CreateContext
.Key changes and concepts introduced:
CreateContext
proved to be a valuable model and was consistently used.ConfigBuilder
remains relevant and widely used.CreateContext
's broad applicability and an example of multiple context scopes in one logical handler - example.appType
logic in action handlers determines the files added to theFileSet
- example._variation
directory within the generator files - example.gasket
configuration file is now generated based on the final package file rather than being derived from the CLI - example.gasket
file are derived from the final package file - example.Issues Identified
Package File Generation
Programmatically generating the package file remains the most reliable approach. However, maintaining accuracy while deviating from current patterns is challenging. The merging of multiple
ConfigBuilder
package instances works but introduces complexity and potential errors.Dependency Awareness
Maintaining a dependency ledger for plugin dependencies is not ideal. While the ledger built during prepublish is functional, it adds an additional layer of domain knowledge that must be accounted for.
Templating
Originally, I considered replacing Handlebars templating with a search-and-replace approach in action handlers. However, this proved impractical due to excessive variation. Certain templates rely on
CreateContext
values that do not directly correlate, making abstraction infeasible.Organization
While the current separation of concerns presents challenges (e.g., required domain knowledge, multiple mutation sources, mutation timing issues), a monolithic approach is unlikely to resolve them outright. Instead, it would introduce different organizational complexities. The POC model offers greater control over grouping, timing, and context, but it may not offset the risks associated with encapsulating all logic within presets.
Post-POC Path
Given the scope and scale of these changes, a gradual, incremental approach is the best path forward. As a team, we need to align on our core objectives. Based on the goals outlined earlier, we can make meaningful improvements with minimal risk.
Recommended next steps:
postCreate
process and consider removing it.postCreate
, we can avoid installing modules automatically, thereby speeding up the application creation process.Conclusion
This POC was a valuable exercise in assessing the feasibility of modifying the create process. It helped gauge the scope and complexity of such changes, revealing both opportunities and challenges. The insights gained from this work suggest that instead of making sweeping changes, a strategy of small, incremental improvements will be the most effective approach moving forward. By focusing on targeted enhancements, we can optimize the creation process while minimizing risk and disruption.