Skip to content

Commit

Permalink
fix: assign projectName after target is defined (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathurAditya724 authored Jul 6, 2024
1 parent 925aa3c commit dd656f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ async function main() {
const { install, pm, template: templateArg } = args

let target = ''
let projectName = ''
if (args._[0]) {
target = args._[0].toString()
console.log(
`${chalk.bold(`${chalk.green('✔')} Using target directory`)}${target}`,
)
projectName = path.basename(target)
} else {
const answer = await input({
message: 'Target directory',
default: 'my-app',
})
target = answer
if (answer === '.') {
projectName = path.basename(process.cwd())
} else {
projectName = path.basename(answer)
}
}

let projectName = ''
if (target === '.') {
projectName = path.basename(process.cwd())
} else {
projectName = path.basename(target)
}

const templateName =
Expand Down

0 comments on commit dd656f7

Please sign in to comment.