MCPcopy Create free account
hub / github.com/TanStack/cli / handleCreate

Function handleCreate

packages/cli/src/cli.ts:621–906  ·  view source on GitHub ↗
(projectName: string, options: CliOptions)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 15

getAllAddOnsFunction · 0.90
getFrameworkByNameFunction · 0.90
createAppFunction · 0.90
runWithTelemetryFunction · 0.85
printJsonFunction · 0.85
startDevWatchModeFunction · 0.85
normalizeOptionsFunction · 0.85
promptForCreateOptionsFunction · 0.85
confirmCreateOptionsFunction · 0.85

Tested by

no test coverage detected