Files
pnpm/installing/commands/tsconfig.json
Zoltan Kochan c112b6106b feat(install): add --dry-run option (npm-style preview) (#12449)
## Description

Adds a `--dry-run` option to `pnpm install` with **npm-style preview semantics**: it runs a full dependency resolution and reports what a real install **would** add/remove/update, but writes **nothing** to disk (no lockfile, no `node_modules`, no `.modules.yaml`, no workspace-state file) and **always exits 0**.

```
$ pnpm install --dry-run
Dry run complete. A real install would make the following changes (nothing was written to disk):

Importers
.
  + is-negative 1.0.0

Packages
+ is-negative@1.0.0
```

When the lockfile is already up to date it prints `Dry run complete. pnpm-lock.yaml is up to date; a real install would make no changes.`

Resolves https://github.com/pnpm/pnpm/issues/7340.

### Why this shape

An earlier attempt (#12270, now closed) implemented `--dry-run` as `--frozen-lockfile --lockfile-only` — i.e. a fail-on-drift *lockfile validator*. That collides with the well-established meaning of `--dry-run` across npm/yarn ("preview, never fail") and duplicated existing behaviour (`pnpm install --frozen-lockfile --lockfile-only` already does that). This PR implements the intuitive preview meaning instead.

### How it works (pnpm)

- Reuses the existing `lockfileCheck` callback (resolve fully, skip the lockfile write, hand back the before/after wanted lockfile) plus `lockfileOnly` (skip `node_modules`, the workspace-state file, and metadata-cache writes).
- The frozen/headless fast path is disabled whenever `lockfileCheck` is set, so a check-only install always resolves and never materialises anything.
- The before/after lockfiles are diffed (reusing the dedupe diff engine, now exported as `calcDedupeCheckIssues`) and rendered into the report.
- `--dry-run` with a configured pnpr server is rejected (that path resolves/links through the server).

### Pacquet

Ported in the second commit — `pacquet install --dry-run` forces the fresh-resolve path, skips every write (a new `dry_run` flag on `InstallWithFreshLockfile` skips the `pnpm-lock.yaml` save), and a new `dry_run` module diffs the existing lockfile against the freshly-resolved one and prints the same report.
2026-06-16 19:12:56 +02:00

188 lines
3.2 KiB
JSON

{
"extends": "@pnpm/tsconfig",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": [
"src/**/*.ts",
"../../__typings__/**/*.d.ts"
],
"references": [
{
"path": "../../__utils__/assert-project"
},
{
"path": "../../__utils__/prepare"
},
{
"path": "../../__utils__/test-fixtures"
},
{
"path": "../../__utils__/test-ipc-server"
},
{
"path": "../../building/after-install"
},
{
"path": "../../building/policy"
},
{
"path": "../../catalogs/config"
},
{
"path": "../../catalogs/types"
},
{
"path": "../../cli/command"
},
{
"path": "../../cli/common-cli-options-help"
},
{
"path": "../../cli/utils"
},
{
"path": "../../config/matcher"
},
{
"path": "../../config/pick-registry-for-package"
},
{
"path": "../../config/reader"
},
{
"path": "../../config/writer"
},
{
"path": "../../core/constants"
},
{
"path": "../../core/error"
},
{
"path": "../../core/logger"
},
{
"path": "../../core/types"
},
{
"path": "../../deps/inspection/outdated"
},
{
"path": "../../deps/path"
},
{
"path": "../../deps/security/signatures"
},
{
"path": "../../deps/status"
},
{
"path": "../../fs/graceful-fs"
},
{
"path": "../../fs/read-modules-dir"
},
{
"path": "../../global/commands"
},
{
"path": "../../hooks/pnpmfile"
},
{
"path": "../../lockfile/fs"
},
{
"path": "../../lockfile/types"
},
{
"path": "../../network/auth-header"
},
{
"path": "../../network/fetch"
},
{
"path": "../../pkg-manifest/reader"
},
{
"path": "../../pkg-manifest/utils"
},
{
"path": "../../resolving/npm-resolver"
},
{
"path": "../../resolving/parse-wanted-dependency"
},
{
"path": "../../resolving/resolver-base"
},
{
"path": "../../store/connection-manager"
},
{
"path": "../../store/controller"
},
{
"path": "../../store/index"
},
{
"path": "../../testing/command-defaults"
},
{
"path": "../../testing/mock-agent"
},
{
"path": "../../testing/registry-mock"
},
{
"path": "../../worker"
},
{
"path": "../../workspace/project-manifest-reader"
},
{
"path": "../../workspace/project-manifest-writer"
},
{
"path": "../../workspace/projects-filter"
},
{
"path": "../../workspace/projects-graph"
},
{
"path": "../../workspace/projects-reader"
},
{
"path": "../../workspace/projects-sorter"
},
{
"path": "../../workspace/root-finder"
},
{
"path": "../../workspace/state"
},
{
"path": "../../workspace/workspace-manifest-writer"
},
{
"path": "../context"
},
{
"path": "../dedupe/check"
},
{
"path": "../dedupe/issues-renderer"
},
{
"path": "../deps-installer"
},
{
"path": "../env-installer"
},
{
"path": "../modules-yaml"
}
]
}