refactor(core): use TemplateScaffolder and simplify scaffoldTemplate API #484
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
Refactors
@pgpmjs/coreto use the newTemplateScaffolderclass from[email protected], eliminating code duplication between the two packages. This also fixes the "two-instance Inquirerer problem" that caused double-echoed keystrokes when runningpgpm init workspace.Key changes:
create-gen-appto^0.7.0boilerplate-scanner.tsandboilerplate-types.ts(now provided by create-gen-app)template-scaffold.tsto delegate toTemplateScaffolderinstead of manually composing CacheManager/GitCloner/Templatizerprompterthrough toscaffoldTemplate()to fix double-echo keystrokesscaffoldTemplate()remains the public API from@pgpmjs/coreThe
template-scaffold.tsfile went from ~236 lines to ~100 lines.Updates since last revision
API Simplification: Replaced
type,dir, andtemplatePathparameters with a singlefromPathparameter:type: TemplateKindparameter andTemplateKindtypedirparameter (was unused in CLI)templatePathparameter (merged intofromPath)fromPath: stringas the single path selectorThe
.boilerplates.jsonresolution is now handled entirely byTemplateScaffolder, so callers just specify'workspace'or'module'and it resolves to'default/workspace'or'default/module'automatically.Before:
After:
Review & Testing Checklist for Human
scaffoldTemplate()now requiresfromPathinstead oftype- verify no external consumers are affectedfromPath: 'workspace'correctly resolves todefault/workspacevia.boilerplates.jsonpgpm init workspaceinteractively and verify:pgpm init moduleinside a workspace and verify it still workspgpm init workspace --templatePath supabase/workspaceto verify custom paths still workNotes
This PR depends on
[email protected]which was published from dev-utils#33.Link to Devin run: https://app.devin.ai/sessions/48555739db3d4f1b9e9edfa9ea1e559a
Requested by: Dan Lynch (@pyramation)