Files
pnpm/engine
Zoltan Kochan 36b3826f7b feat: make clean/setup/deploy prefer user scripts over built-in commands (#11118)
* feat: make clean/setup/deploy prefer user scripts over built-in commands

When a project's package.json has a script named "clean", "setup", or
"deploy", running `pnpm clean/setup/deploy` now executes the script
instead of the built-in command. This prevents surprising behavior for
users with existing scripts.

When running from a workspace subdirectory where the root package.json
has one of these scripts, an error is thrown with guidance on how to
proceed.

Added "purge" as an alias for the built-in clean command, which always
runs the built-in regardless of scripts.

Closes #6816

* feat: also make rebuild prefer user scripts over the built-in

* refactor: move scriptOverride to command definitions

Each command now declares `scriptOverride = true` instead of a
centralized list in main.ts. All command names including aliases
are overridable by same-named scripts.

* refactor: rename scriptOverride to overridableByScript

* test: add e2e tests for script override behavior in clean/purge

* fix: address review feedback

- Fix JSDoc to reflect that aliases are also overridable by scripts
- Update npm_command env var to 'run-script' when redirecting to run
- Add 'purge' alias to clean command help text
2026-03-27 20:04:52 +01:00
..