Skip to content

Commit

Permalink
fix(crwa): Better handling of installing to . (#11645)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored and Josh-Walker-GM committed Oct 8, 2024
1 parent 8cd91ce commit b4113c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .changesets/11645.md
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 12 additions & 7 deletions packages/create-redwood-app/src/create-redwood-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -791,6 +793,8 @@ async function createRedwoodApp() {
await initializeGit(newAppDir, commitMessage)
}

const shouldPrintCdCommand = newAppDir !== process.cwd()

// Post install message
tui.drawText(
[
Expand All @@ -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`)}`,
Expand Down

0 comments on commit b4113c2

Please sign in to comment.