File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { intro } from '@clack/prompts'
1+ import fs from 'node:fs'
2+ import { cancel , intro } from '@clack/prompts'
23
34import {
45 finalizeAddOns ,
@@ -42,6 +43,15 @@ export async function promptForCreateOptions(
4243 options . framework = getFrameworkById ( cliOptions . framework || 'react-cra' ) !
4344
4445 options . projectName = cliOptions . projectName || ( await getProjectName ( ) )
46+ if (
47+ fs . existsSync ( options . projectName ) &&
48+ fs . readdirSync ( options . projectName ) . length > 0
49+ ) {
50+ cancel (
51+ `The directory ${ options . projectName } is not empty. Please choose a different project name.` ,
52+ )
53+ process . exit ( 1 )
54+ }
4555
4656 // Router type selection
4757 if ( forcedMode ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import {
1616import type { AddOn , PackageManager } from '@tanstack/cta-engine'
1717
1818import type { Framework } from '@tanstack/cta-engine/dist/types/types.js'
19- import { InitialData } from '../../cta-ui/src/types'
2019
2120export async function getProjectName ( ) : Promise < string > {
2221 const value = await text ( {
You can’t perform that action at this time.
0 commit comments