pnpm prune
Removes extraneous packages from node_modules: packages that are no longer in the lockfile.
pnpm prune
With nodeLinker: hoisted, pnpm removes extraneous package links from the selected projects' node_modules directories. The link targets stay on disk.
配置项#
--prod, -P, --production#
删除在 devDependencies 中指定的包。
--dev, -D#
Keep only the packages specified in devDependencies.
--no-optional#
删除在 optionalDependencies 中指定的包。
--ignore-scripts#
不运行生命周期脚本。 --no-ignore-scripts runs them even when the ignoreScripts setting is true.
--trust-lockfile#
新增于:v12.15.0
跳过根据供应链策略验证锁文件。 pnpm prune also honors trustLockfile from the configuration. --no-trust-lockfile verifies the lockfile even when the configuration trusts it.
--recursive, -r#
Run pnpm prune in every package found in subdirectories, or in every workspace package when executed inside a workspace. Running pnpm prune at the workspace root runs recursively across the workspace by default.
--filter <package_selector>#
Restrict pnpm prune to the selected workspace projects. 阅读更多有关过滤的内容。