Unverified Commit a680571d authored by Vũ Văn Dũng's avatar Vũ Văn Dũng Committed by GitHub

Remove the left padding in `next info` output (#55704)



## Why?

Although the left padding makes the output looks good in the terminal, it causes this weird alignment in almost all bug reports:

```yaml
Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.12.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.5.2-canary.2
      eslint-config-next: 13.5.2
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A
```

If I want it to look nice in the bug report

```yaml
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Thu Aug 17 21:23:02 PDT 2023; root:xnu-10002.1.11~3/RELEASE_ARM64_T8112
Binaries:
  Node: 20.3.1
  npm: 9.6.7
  Yarn: 1.22.19
  pnpm: 8.6.12
Relevant Packages:
  next: 13.5.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```

I have to paste this to a text editor and manually remove the first four spaces on every lines.

### How?

This PR removes that four-space padding to make future bug reports look a bit nicer.
parent a17c235d
...@@ -158,16 +158,16 @@ will give you information like this example: ...@@ -158,16 +158,16 @@ will give you information like this example:
```bash filename="Terminal" ```bash filename="Terminal"
Operating System: Operating System:
Platform: linux Platform: linux
Arch: x64 Arch: x64
Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021 Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021
Binaries: Binaries:
Node: 16.13.0 Node: 16.13.0
npm: 8.1.0 npm: 8.1.0
Yarn: 1.22.17 Yarn: 1.22.17
pnpm: 6.24.2 pnpm: 6.24.2
Relevant packages: Relevant packages:
next: 12.0.8 next: 12.0.8
react: 17.0.2 react: 17.0.2
react-dom: 17.0.2 react-dom: 17.0.2
......
...@@ -83,17 +83,17 @@ function getBinaryVersion(binaryName: string) { ...@@ -83,17 +83,17 @@ function getBinaryVersion(binaryName: string) {
function printHelp() { function printHelp() {
console.log( console.log(
` `
Description Description
Prints relevant details about the current system which can be used to report Next.js bugs Prints relevant details about the current system which can be used to report Next.js bugs
Usage Usage
$ next info $ next info
Options Options
--help, -h Displays this message --help, -h Displays this message
--verbose Collect additional information for debugging --verbose Collect additional information for debugging
Learn more: ${chalk.cyan('https://nextjs.org/docs/api-reference/cli#info')}` Learn more: ${chalk.cyan('https://nextjs.org/docs/api-reference/cli#info')}`
) )
} }
...@@ -105,22 +105,22 @@ async function printDefaultInfo() { ...@@ -105,22 +105,22 @@ async function printDefaultInfo() {
const nextConfig = await getNextConfig() const nextConfig = await getNextConfig()
console.log(` console.log(`
Operating System: Operating System:
Platform: ${os.platform()} Platform: ${os.platform()}
Arch: ${os.arch()} Arch: ${os.arch()}
Version: ${os.version()} Version: ${os.version()}
Binaries: Binaries:
Node: ${process.versions.node} Node: ${process.versions.node}
npm: ${getBinaryVersion('npm')} npm: ${getBinaryVersion('npm')}
Yarn: ${getBinaryVersion('yarn')} Yarn: ${getBinaryVersion('yarn')}
pnpm: ${getBinaryVersion('pnpm')} pnpm: ${getBinaryVersion('pnpm')}
Relevant Packages: Relevant Packages:
next: ${installedRelease} next: ${installedRelease}
eslint-config-next: ${getPackageVersion('eslint-config-next')} eslint-config-next: ${getPackageVersion('eslint-config-next')}
react: ${getPackageVersion('react')} react: ${getPackageVersion('react')}
react-dom: ${getPackageVersion('react-dom')} react-dom: ${getPackageVersion('react-dom')}
typescript: ${getPackageVersion('typescript')} typescript: ${getPackageVersion('typescript')}
Next.js Config: Next.js Config:
output: ${nextConfig.output} output: ${nextConfig.output}
`) `)
......
...@@ -792,22 +792,22 @@ describe('CLI Usage', () => { ...@@ -792,22 +792,22 @@ describe('CLI Usage', () => {
function matchInfoOutput(stdout, { nextConfigOutput = '.*' } = {}) { function matchInfoOutput(stdout, { nextConfigOutput = '.*' } = {}) {
expect(stdout).toMatch( expect(stdout).toMatch(
new RegExp(` new RegExp(`
Operating System: Operating System:
Platform: .* Platform: .*
Arch: .* Arch: .*
Version: .* Version: .*
Binaries: Binaries:
Node: .* Node: .*
npm: .* npm: .*
Yarn: .* Yarn: .*
pnpm: .* pnpm: .*
Relevant Packages: Relevant Packages:
next: .* next: .*
eslint-config-next: .* eslint-config-next: .*
react: .* react: .*
react-dom: .* react-dom: .*
typescript: .* typescript: .*
Next.js Config: Next.js Config:
output: ${nextConfigOutput} output: ${nextConfigOutput}
`) `)
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment