* feat: add --yes command line option
* feat: skip confirm modules purge prompt if --yes is passed
* refactor: factor out `ExecPnpmSyncOpts`
* test: add end-to-end test for --yes flag
* test: use `import type` in more places
Several tests are failing because a module isn't being mocked. This is
due to the mocked module being imported before the mock being set up.
Switching to `import type` should elide the import fully.
* build: replace ts-jest with simple transformer
* chore: remove `ts-jest`
* chore: remove babel dependencies from root project
* ci: use Node.js 22.13.0 (instead of 22.12.0)
Node.js 22.13.0 introduces the `stripTypeScriptTypes` function
* fix: copilot feedback
This fixes an issue where pnpm fetch would fail in Docker builds when
local directory dependencies (file: protocol) were not available.
The fix adds an ignoreLocalPackages option that is passed from the fetch
command to skip local dependencies during graph building, since pnpm
fetch only downloads packages from the registry and doesn't need local
packages that won't be available in Docker builds.
close#10460
When CI=true, pnpm automatically enables frozen-lockfile mode. Previously,
this could only be overridden via .npmrc files or CLI flags because the
code checked rawLocalConfig (which excludes env vars and hook changes).
Now checks the fully resolved config values (frozenLockfile and
preferFrozenLockfile) instead of rawLocalConfig, allowing:
- Environment variables (pnpm_config_frozen_lockfile=false)
- updateConfig hook in .pnpmfile.cjs
- .npmrc files (already worked)
- CLI flags (already worked)
Fixes#9861
* fix: force re-fetch when resolution integrity changes
When a resolver returns a resolution with a different integrity than
the current package's resolution, automatically force re-fetching the
package. This allows custom resolvers to trigger re-fetches by simply
returning the updated integrity, without needing to explicitly set
a forceFetch flag.
Closes#10451
* refactor: remove forceFetch
* test: fix
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
* feat: pass pkgSnapshot to shouldForceResolve
The shouldForceResolve hook now receives:
- depPath: The dependency path (e.g., 'lodash@4.17.21')
- pkgSnapshot: The lockfile entry with resolution, dependencies, etc.
This replaces the previous wantedDependency argument, which was inconsistent
with how wantedDependency is constructed for the resolve() method (where it
contains the user's alias and full specifier from package.json).
- Add currentPkg (with name/version) to custom resolver ResolveOptions
- Pass currentPkg through to custom resolvers in default-resolver
- Simplify checkCustomResolverForceResolve to use parseDepPath
* chore: create empty new `@pnpm/yaml.document-sync` package
* feat: implement @pnpm/yaml.document-sync
* feat: preserve comments when updating `pnpm-workspace.yaml`
* fix: add missing rootProjectManifestDir field to fix test
This was causing a test to fail due to the rootProjectManifestDir being
an empty string.
The main branch doesn't have this problem because `write-yaml-file`
internally does a `path.dirname(...)` call that ends up resolving the
empty string to `.`.
● logger warns about peer dependencies when linking
ENOENT: no such file or directory, mkdir ''
25 | singleQuote: true, // Prefer single quotes over double quotes
26 | })
> 27 | await fs.promises.mkdir(dir, { recursive: true })
| ^
28 | await writeFileAtomic(path.join(dir, fileName), manifestStr)
29 | }
30 |
at writeManifestFile (../../workspace/manifest-writer/src/index.ts:27:3)
at updateWorkspaceManifest (../../workspace/manifest-writer/src/index.ts:83:3)
at writeSettings (../../config/config-writer/src/index.ts:38:3)
at addLinkToManifest (src/link.ts:182:3)
at src/link.ts:161:7
at async Promise.all (index 0)
at Module.handler (src/link.ts:159:3)
at Object.<anonymous> (test/link.ts:300:3)%
* Update workspace/manifest-writer/src/index.ts
* refactor: factor out a `getRealNameAndSpec` function
* test: `pnpm add` does not modify existing catalog entries
* fix: resolve preferred version without mutating bare specifier
close#9759
* refactor: factor out a `getRealNameAndSpec` function
* fix: handle npm aliases without a bare specifier in `unwrapPackageName`
* Fix formatting in unwrapPackageName.ts
* feat: enable injected local packages to work with global virtual store
by leveraging `pkgLocationsByDepPath` for `file:` dependencies.
* fix: populate `pkgLocationsByDepPath` directly for directory dependencies in the graph builder
* refactor: store directory dependencies as a Map instead of an object
* refactor: improve file: dependency target directory resolution
by prioritizing `directoryDepsByDepPath` and providing a lockfile fallback.
* refactor: remove `pkgLocationsByDepPath` from hoisted dependency graph generation parameters
* test: fix
* test: fix
* refactor: simplify directory lookup for injected workspace packages
by directly using the dependency graph
* refactor: move extendProjectsWithTargetDirs to headless module and update imports
* refactor: make `directoryDepsByDepPath` required
in `LockfileToDepGraphOptions` and remove its nullish coalescing in headless
* refactor: directory dependency tracking
by renaming `directoryDepsByDepPath` to `injectionTargetsByDepPath`
and extracting related logic, and remove an unused export.
* docs: add changesets
* fix: implemented CR suggestions
* chore: configure `erasableSyntaxOnly`
* refactor: remove class property access modifiers in constructor
```
../dedupe/check/src/DedupeCheckIssuesError.ts:5:16 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
5 constructor (public dedupeCheckIssues: DedupeCheckIssues) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../reviewing/dependencies-hierarchy/src/getTree.ts:243:24 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
243 private constructor (private readonly keypath: readonly string[]) {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* chore: migrate from enum types
```
../pkg-manager/plugin-commands-installation/src/import/index.ts:66:6 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
66 enum YarnLockType {
~~~~~~~~~~~~
../lockfile/detect-dep-types/src/index.ts:5:13 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
5 export enum DepType {
~~~~~~~
```
* chore: add changelog
* chore: remove `ts-node` dev dependency (#10371)
* chore: remove `ts-node` dev dependency
* chore: remove `ts-node` usages from `package.json` scripts
* feat: enhance `store prune` to clean global virtual store
`pnpm store prune` will now clean the global virtual store
via a new project registry and mark-and-sweep garbage collection.
* test: add store prune test for transitive dependency preservation
* refactor: extract global virtual store pruning logic to a new file
* fix: improve symlink handling in global virtual store pruning
* fix: optimize removal of unreachable packages in global virtual store
* fix: refine project registry error handling
Throw `PnpmError` for inaccessible projects
and specifically clean up stale symlinks for `ENOENT` errors.
* test: create virtual store with install command
* refactor: standardize global virtual store directory structure
by placing unscoped packages under an `@` scope.
* test: update store prune tests to use `toContain` and `not.toContain` assertions`
* fix: linting issues
* Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: implemented CR suggestions
* fix: revert not needed change
* fix: use `is-subdir` to accurately determine if symlink targets
are within the global virtual store.
* revert: changes in package.json files
* test: add `--config.ci=false` to store prune tests