pnpm exec

Esegue un comando di shell nell'ambito di un progetto.

node_modules/.bin is added to the PATH, so pnpm exec allows executing commands of dependencies.

Esempi#

If you have Jest as a dependency of your project, there is no need to install Jest globally. Run it with pnpm exec:

pnpm exec jest

The exec part is actually optional when the command is not in conflict with a builtin pnpm command, so you may also run:

pnpm jest

Opzioni#

Any options for the exec command should be listed before the exec keyword. Options listed after the exec keyword are passed to the executed command.

Bene. pnpm verrà eseguito in modo ricorsivo:

pnpm -r exec jest

Bad, pnpm will not run recursively but jest will be executed with the -r option:

pnpm exec jest -r

--recursive, -r#

Esegue il comando shell in ogni progetto dello spazio di lavoro.

The name of the current package is available through the environment variable PNPM_PACKAGE_NAME.

Esempi#

Prune node_modules installations for all packages:

pnpm -r exec rm -rf node_modules

Visualizza le informazioni sui pacchetti per tutti i pacchetti. This should be used with the --shell-mode (or -c) option for the environment variable to work.

pnpm -rc exec pnpm view \$PNPM_PACKAGE_NAME

--no-reporter-hide-prefix#

Do not hide prefix when running commands in parallel.

--resume-from <package_name>#

Resume execution at a particular project. pnpm skips the projects a matching record of the previous recursive exec says already passed. Without such a record, it omits the named project's transitive dependencies, but still runs the named project, its dependents, and unrelated projects in the selected graph. See Workspace task orchestration.

--parallel#

Completely disregard concurrency and topological sorting, running a given script immediately in all matching packages. Questo è il flag preferito per i processi a lungo termine su molti pacchetti, per esempio, un lungo processo di compilazione.

--shell-mode, -c#

Esegue il comando all'interno di una shell. Uses /bin/sh on UNIX and \cmd.exe on Windows.

--report-summary#

Read about this option in the run command docs

--filter <package_selector>#

Read more about filtering.