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

Merge multiple log statements #35310

Merged
merged 5 commits into from
May 22, 2022
Merged
Changes from 1 commit
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
41 changes: 19 additions & 22 deletions packages/create-next-app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ async function run(): Promise<void> {
}

if (!projectPath) {
console.log()
console.log('Please specify the project directory:')
console.log(
` ${chalk.cyan(program.name())} ${chalk.green('<project-directory>')}`
)
console.log()
console.log('For example:')
console.log(` ${chalk.cyan(program.name())} ${chalk.green('my-next-app')}`)
console.log()
console.log(
`Run ${chalk.cyan(`${program.name()} --help`)} to see all options.`
`

Please specify the project directory:
${chalk.cyan(program.name())} ${chalk.green('<project-directory>')}
Copy link
Contributor

@kachkaev kachkaev Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines will print with a pretty long offset. Using @` instead of ` might help in the future:
https://github.com/tc39/proposal-string-dedent

Might be worth leaving as is for now.


For example:
${chalk.cyan(program.name())} ${chalk.green('my-next-app')}

Run ${chalk.cyan(`${program.name()} --help`)} to see all options.
`
)
process.exit(1)
}
Expand Down Expand Up @@ -173,19 +173,13 @@ async function notifyUpdate(): Promise<void> {
if (res?.latest) {
const pkgManager = getPkgManager()

console.log()
console.log(
`
chalk.yellow.bold('A new version of `create-next-app` is available!')
You can update by running: ${chalk.cyan(pkgManager === 'yarn' ? 'yarn global add create-next-app' : `${pkgManager} install --global create-next-app` )}

`
)
console.log(
'You can update by running: ' +
chalk.cyan(
pkgManager === 'yarn'
? 'yarn global add create-next-app'
: `${pkgManager} install --global create-next-app`
)
)
console.log()
}
process.exit()
} catch {
Expand All @@ -201,8 +195,11 @@ run()
if (reason.command) {
console.log(` ${chalk.cyan(reason.command)} has failed.`)
} else {
console.log(chalk.red('Unexpected error. Please report it as a bug:'))
console.log(reason)
console.log(
`
${chalk.red('Unexpected error. Please report it as a bug:')}
${reason}
`
}
console.log()

Expand Down