chore: move all files into packages/create-payload-app
This commit is contained in:
23
packages/create-payload-app/src/lib/parse-project-name.ts
Normal file
23
packages/create-payload-app/src/lib/parse-project-name.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import prompts from 'prompts'
|
||||
import type { CliArgs } from '../types'
|
||||
|
||||
export async function parseProjectName(args: CliArgs): Promise<string> {
|
||||
if (args['--name']) return args['--name']
|
||||
if (args._[0]) return args._[0]
|
||||
|
||||
const response = await prompts(
|
||||
{
|
||||
type: 'text',
|
||||
name: 'value',
|
||||
message: 'Project name?',
|
||||
validate: (value: string) => !!value.length,
|
||||
},
|
||||
{
|
||||
onCancel: () => {
|
||||
process.exit(0)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
return response.value
|
||||
}
|
||||
Reference in New Issue
Block a user