Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/cta-cli/src/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { intro } from '@clack/prompts'
import fs from 'node:fs'
import { cancel, intro } from '@clack/prompts'

import {
finalizeAddOns,
Expand Down Expand Up @@ -42,6 +43,15 @@ export async function promptForCreateOptions(
options.framework = getFrameworkById(cliOptions.framework || 'react-cra')!

options.projectName = cliOptions.projectName || (await getProjectName())
if (
fs.existsSync(options.projectName) &&
fs.readdirSync(options.projectName).length > 0
) {
cancel(
`The directory ${options.projectName} is not empty. Please choose a different project name.`,
)
process.exit(1)
}

// Router type selection
if (forcedMode) {
Expand Down
1 change: 0 additions & 1 deletion packages/cta-cli/src/ui-prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import type { AddOn, PackageManager } from '@tanstack/cta-engine'

import type { Framework } from '@tanstack/cta-engine/dist/types/types.js'
import { InitialData } from '../../cta-ui/src/types'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not part of the main change, but I removed an unused import.


export async function getProjectName(): Promise<string> {
const value = await text({
Expand Down