Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(crwa): Better handling of installing to . #11645

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading