feat!: use cleaner output for script execution (#11132)

* feat: use yarn-like output for script execution

Print `$ command` instead of `> pkg@version stage path\n> command`.
Show project name and path only when running in a different directory.

* fix: sort chalk dependency after @pnpm packages

* refactor: remove project info line from run output

* chore: add changeset

* refactor: print script command line to stderr

The `$ command` line is metadata, not program output. Printing it to
stderr keeps stdout clean for piping, matching bun's behavior.

* chore: update changeset to major
This commit is contained in:
Zoltan Kochan
2026-03-28 15:58:03 +01:00
committed by GitHub
parent 84f27feaeb
commit f871365adb
5 changed files with 20 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/exec.lifecycle": major
"pnpm": major
---
Changed the output of script execution. Print `$ command` (dimmed, to stderr) instead of `> pkg@version stage path` and `> command` (to stdout).

View File

@@ -43,6 +43,7 @@
"@pnpm/store.cafs-types": "workspace:*",
"@pnpm/store.controller-types": "workspace:*",
"@pnpm/types": "workspace:*",
"chalk": "catalog:",
"is-windows": "catalog:",
"path-exists": "catalog:",
"run-groups": "catalog:",

View File

@@ -6,6 +6,7 @@ import { PnpmError } from '@pnpm/error'
import { globalWarn } from '@pnpm/logger'
import { lifecycle } from '@pnpm/npm-lifecycle'
import type { DependencyManifest, PackageScripts, ProjectManifest } from '@pnpm/types'
import chalk from 'chalk'
import isWindows from 'is-windows'
import { join as shellQuote } from 'shlex'
@@ -105,6 +106,8 @@ Please unset the scriptShell option, or configure it to a .exe instead.
stage,
wd: opts.pkgRoot,
})
} else if (!opts.silent) {
console.error(chalk.dim(`$ ${m.scripts[stage]}`))
}
const logLevel = (opts.stdio !== 'inherit' || opts.silent)
? 'silent'

15
pnpm-lock.yaml generated
View File

@@ -251,8 +251,8 @@ catalogs:
specifier: 3.0.2
version: 3.0.2
'@pnpm/npm-lifecycle':
specifier: 1100.0.0-0
version: 1100.0.0-0
specifier: 1100.0.0-1
version: 1100.0.0-1
'@pnpm/npm-package-arg':
specifier: ^2.0.0
version: 2.0.0
@@ -4020,7 +4020,7 @@ importers:
version: link:../../fetching/directory-fetcher
'@pnpm/npm-lifecycle':
specifier: 'catalog:'
version: 1100.0.0-0(typanion@3.14.0)
version: 1100.0.0-1(typanion@3.14.0)
'@pnpm/pkg-manifest.reader':
specifier: workspace:*
version: link:../../pkg-manifest/reader
@@ -4033,6 +4033,9 @@ importers:
'@pnpm/types':
specifier: workspace:*
version: link:../../core/types
chalk:
specifier: 'catalog:'
version: 5.6.2
is-windows:
specifier: 'catalog:'
version: 1.0.2
@@ -10626,8 +10629,8 @@ packages:
resolution: {integrity: sha512-5jW/GNLdZMiw+PJ8FYSvOghoApSjsORNIro2fj8j6NHAqJxJjcHekC5/NsKaawoI5LAkU/XDDVjNC71Yz+uS1w==}
engines: {node: '>=18.12'}
'@pnpm/npm-lifecycle@1100.0.0-0':
resolution: {integrity: sha512-FymJ23SU6f3AlgUsK0Bt+0ztIWe3MFkqGbPL86couBb37fH+UNyG6P6IUmOv/lXA4Y2mhqGDTSV0/8mYI08xng==}
'@pnpm/npm-lifecycle@1100.0.0-1':
resolution: {integrity: sha512-sqXZFikFaJfwY8K+Gg9oPMxxYnJ9O7OkMxXAWNPBUEiZh8XK/DaNFlbNOJ3X8P0WKS5nDE9A6TiOBWrhTrpS+A==}
engines: {node: '>=22.13'}
'@pnpm/npm-package-arg@2.0.0':
@@ -18534,7 +18537,7 @@ snapshots:
- supports-color
- typanion
'@pnpm/npm-lifecycle@1100.0.0-0(typanion@3.14.0)':
'@pnpm/npm-lifecycle@1100.0.0-1(typanion@3.14.0)':
dependencies:
'@pnpm/byline': 1.0.0
'@pnpm/error': 1000.1.0

View File

@@ -89,7 +89,7 @@ catalog:
'@pnpm/network.agent': ^2.0.3
'@pnpm/nopt': ^0.3.1
'@pnpm/npm-conf': 3.0.2
'@pnpm/npm-lifecycle': 1100.0.0-0
'@pnpm/npm-lifecycle': 1100.0.0-1
'@pnpm/npm-package-arg': ^2.0.0
'@pnpm/os.env.path-extender': ^3.0.0
'@pnpm/patch-package': 0.0.1