feat(core): pass prompter through scaffoldTemplate to avoid two instances #483
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
Adds an optional
prompterparameter toScaffoldTemplateOptionsthat gets passed through to create-gen-app'sTemplatizer.process(). This allows CLI tools to reuse their existing Inquirerer instance instead of create-gen-app creating a new one internally.This eliminates the "two instances on stdin" problem that caused double-echoed keystrokes when running
pgpm init workspace.Key changes:
inquirererdependency to@pgpmjs/corefor the typeprompterfield toScaffoldTemplateOptionsinterfacetemplatizer.process()in both local and remote template code pathsworkspace.tsto pass prompter instead of callingclose()before scaffoldOwnership semantics: When a prompter is provided, the caller retains ownership and is responsible for closing it.
Updates since last revision
boilerplate-scanner.tsandboilerplate-types.ts(177 lines of dead code that was exported but never used)index.tsreadBoilerplatesConfig,readBoilerplateConfig) directly intotemplate-scaffold.tsReview & Testing Checklist for Human
pgpm init workspaceend-to-end and verify no double-echoed keystrokes occurboilerplate-scanner.tsorboilerplate-types.tsfilesas anytype assertions intemplate-scaffold.ts- these are temporary until create-gen-app is published with the newprompterparameterTest plan: After merging dev-utils#33, run
pgpm init workspaceand verify:Notes
This is PR 2 of 2 in a two-PR solution. The companion PR (dev-utils#33) adds the
prompterparameter to create-gen-app's API.Link to Devin run: https://app.devin.ai/sessions/48555739db3d4f1b9e9edfa9ea1e559a
Requested by: Dan Lynch (@pyramation)