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

Function cli

packages/cli/src/cli.ts:238–1892  ·  view source on GitHub ↗
({
  name,
  appName,
  forcedAddOns = [],
  forcedDeployment,
  defaultFramework,
  frameworkDefinitionInitializers,
  showDeploymentOptions = true,
  legacyAutoCreate = false,
  defaultRouterOnly = false,
}: {
  name: string
  appName: string
  forcedAddOns?: Array<string>
  forcedDeployment?: string
  defaultFramework?: string
  frameworkDefinitionInitializers?: Array<() => FrameworkDefinition>
  showDeploymentOptions?: boolean
  legacyAutoCreate?: boolean
  defaultRouterOnly?: boolean
})

Source from the content-addressed store, hash-verified

236}
237
238export function cli({
239 name,
240 appName,
241 forcedAddOns = [],
242 forcedDeployment,
243 defaultFramework,
244 frameworkDefinitionInitializers,
245 showDeploymentOptions = true,
246 legacyAutoCreate = false,
247 defaultRouterOnly = false,
248}: {
249 name: string
250 appName: string
251 forcedAddOns?: Array<string>
252 forcedDeployment?: string
253 defaultFramework?: string
254 frameworkDefinitionInitializers?: Array<() => FrameworkDefinition>
255 showDeploymentOptions?: boolean
256 legacyAutoCreate?: boolean
257 defaultRouterOnly?: boolean
258}) {
259 let currentTelemetry: TelemetryClient | undefined
260 const environment = createUIEnvironment(appName, false, () => currentTelemetry)
261
262 const program = new Command()
263
264 async function confirmTargetDirectorySafety(
265 targetDir: string,
266 forced?: boolean,
267 ) {
268 if (forced) {
269 return
270 }
271
272 if (!fs.existsSync(targetDir)) {
273 return
274 }
275
276 if (!fs.statSync(targetDir).isDirectory()) {
277 throw new Error(`Target path exists and is not a directory: ${targetDir}`)
278 }
279
280 if (fs.readdirSync(targetDir).length === 0) {
281 return
282 }
283
284 const shouldContinue = await confirm({
285 message: `Target directory "${targetDir}" already exists and is not empty. Continue anyway?`,
286 initialValue: false,
287 })
288
289 if (isCancel(shouldContinue) || !shouldContinue) {
290 cancel('Operation cancelled.')
291 process.exit(0)
292 }
293 }
294
295 async function confirmCreateOptions(finalOptions: Options) {

Callers 10

index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
bin.tsFile · 0.85
index.tsFile · 0.85

Calls 15

getFrameworksFunction · 0.90
getFrameworkByNameFunction · 0.90
addToAppFunction · 0.90
initAddOnFunction · 0.90
compileAddOnFunction · 0.90
devAddOnFunction · 0.90
initStarterFunction · 0.90
compileStarterFunction · 0.90
createUIEnvironmentFunction · 0.85
addHiddenAgentFlagFunction · 0.85
configureCreateCommandFunction · 0.85
runWithTelemetryFunction · 0.85

Tested by

no test coverage detected