* Calls each binding's `isRecommended` callback (if provided) * and collects the slugs of bindings that returned `true`.
( bindings: PluginSetupBinding[], targetDir: string, )
| 48 | * and collects the slugs of bindings that returned `true`. |
| 49 | */ |
| 50 | async function detectRecommended( |
| 51 | bindings: PluginSetupBinding[], |
| 52 | targetDir: string, |
| 53 | ): Promise<Set<string>> { |
| 54 | const recommended = new Set<string>(); |
| 55 | await Promise.all( |
| 56 | bindings.map(async ({ slug, isRecommended }) => { |
| 57 | if (isRecommended && (await isRecommended(targetDir))) { |
| 58 | recommended.add(slug); |
| 59 | } |
| 60 | }), |
| 61 | ); |
| 62 | return recommended; |
| 63 | } |
| 64 | |
| 65 | export async function promptPluginOptions( |
| 66 | descriptors: PluginPromptDescriptor[], |
no test coverage detected