diff --git a/.changesets/11645.md b/.changesets/11645.md new file mode 100644 index 000000000000..88fce6833d3a --- /dev/null +++ b/.changesets/11645.md @@ -0,0 +1,7 @@ +- fix(crwa): Better handling of installing to . (#11645) by @Tobbe + +When installing to `cwd`: + +- Print "the current directory" instead of "." +- Skip the output of `cd` (which would move you to your home directory, which + most likely is not what you want) diff --git a/packages/create-redwood-app/src/create-redwood-app.js b/packages/create-redwood-app/src/create-redwood-app.js index 742d6646b7c6..b10e94ee075c 100644 --- a/packages/create-redwood-app/src/create-redwood-app.js +++ b/packages/create-redwood-app/src/create-redwood-app.js @@ -382,10 +382,12 @@ async function initializeGit(newAppDir, commitMessage) { async function handleTargetDirPreference(targetDir) { if (targetDir) { + const targetDirText = + targetDir === '.' ? 'the current directory' : targetDir + tui.drawText( - `${RedwoodStyling.green( - '✔', - )} Creating your Redwood app in ${targetDir} based on command line argument`, + `${RedwoodStyling.green('✔')} Creating your Redwood app in ` + + `${targetDirText} based on command line argument`, ) return targetDir @@ -791,6 +793,8 @@ async function createRedwoodApp() { await initializeGit(newAppDir, commitMessage) } + const shouldPrintCdCommand = newAppDir !== process.cwd() + // Post install message tui.drawText( [ @@ -804,11 +808,12 @@ async function createRedwoodApp() { `${RedwoodStyling.header(`Fire it up!`)} 🚀`, '', ...[ - `${RedwoodStyling.redwood( - ` > ${RedwoodStyling.green( - `cd ${path.relative(process.cwd(), newAppDir)}`, + shouldPrintCdCommand && + `${RedwoodStyling.redwood( + ` > ${RedwoodStyling.green( + `cd ${path.relative(process.cwd(), newAppDir)}`, + )}`, )}`, - )}`, !yarnInstall && `${RedwoodStyling.redwood( ` > ${RedwoodStyling.green(`yarn install`)}`,