(projectName: string, options: CliOptions)
| 619 | |
| 620 | // Helper to create the create command action handler |
| 621 | async function handleCreate(projectName: string, options: CliOptions) { |
| 622 | try { |
| 623 | await runWithTelemetry( |
| 624 | 'create', |
| 625 | { |
| 626 | json: options.json, |
| 627 | properties: getCreateTelemetryProperties(projectName, options), |
| 628 | }, |
| 629 | async (telemetry) => { |
| 630 | const legacyCreateFlags = validateLegacyCreateFlags(options) |
| 631 | if (legacyCreateFlags.error) { |
| 632 | throw new Error(legacyCreateFlags.error) |
| 633 | } |
| 634 | |
| 635 | for (const warning of legacyCreateFlags.warnings) { |
| 636 | log.warn(warning) |
| 637 | } |
| 638 | |
| 639 | if (options.listAddOns) { |
| 640 | const addOns = await getAllAddOns( |
| 641 | getFrameworkByName(options.framework || defaultFramework || 'React')!, |
| 642 | defaultMode, |
| 643 | ) |
| 644 | const visibleAddOns = addOns.filter((a) => !forcedAddOns.includes(a.id)) |
| 645 | telemetry.mergeProperties({ |
| 646 | result_count: visibleAddOns.length, |
| 647 | }) |
| 648 | if (options.json) { |
| 649 | printJson( |
| 650 | visibleAddOns.map((addOn) => ({ |
| 651 | id: addOn.id, |
| 652 | name: addOn.name, |
| 653 | description: addOn.description, |
| 654 | type: addOn.type, |
| 655 | category: addOn.category, |
| 656 | phase: addOn.phase, |
| 657 | modes: addOn.modes, |
| 658 | link: addOn.link, |
| 659 | warning: addOn.warning, |
| 660 | exclusive: addOn.exclusive, |
| 661 | dependsOn: addOn.dependsOn, |
| 662 | options: addOn.options, |
| 663 | })), |
| 664 | ) |
| 665 | return |
| 666 | } |
| 667 | |
| 668 | let hasConfigurableAddOns = false |
| 669 | for (const addOn of visibleAddOns) { |
| 670 | const hasOptions = |
| 671 | addOn.options && Object.keys(addOn.options).length > 0 |
| 672 | const optionMarker = hasOptions ? '*' : ' ' |
| 673 | if (hasOptions) hasConfigurableAddOns = true |
| 674 | console.log( |
| 675 | `${optionMarker} ${chalk.bold(addOn.id)}: ${addOn.description}`, |
| 676 | ) |
| 677 | } |
| 678 | if (hasConfigurableAddOns) { |
nothing calls this directly
no test coverage detected