mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
refactor!(resolve-dependencies): remove options.updateDepth
This commit is contained in:
5
.changeset/flat-sloths-appear.md
Normal file
5
.changeset/flat-sloths-appear.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"supi": patch
|
||||
---
|
||||
|
||||
Installation on a non-up-to-date `node_modules`.
|
||||
5
.changeset/lemon-crews-impress.md
Normal file
5
.changeset/lemon-crews-impress.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": major
|
||||
---
|
||||
|
||||
`updateLockfile` options property is removed. `updateDepth=Infinity` should be used instead. Which is set for each project separately.
|
||||
@@ -63,7 +63,6 @@ export default async function (
|
||||
tag: string,
|
||||
virtualStoreDir: string,
|
||||
wantedLockfile: Lockfile,
|
||||
updateLockfile: boolean,
|
||||
workspacePackages: WorkspacePackages,
|
||||
}
|
||||
) {
|
||||
@@ -89,7 +88,6 @@ export default async function (
|
||||
resolvedPackagesByPackageId: {} as ResolvedPackagesByPackageId,
|
||||
skipped: wantedToBeSkippedPackageIds,
|
||||
storeController: opts.storeController,
|
||||
updateLockfile: opts.updateLockfile,
|
||||
virtualStoreDir: opts.virtualStoreDir,
|
||||
wantedLockfile: opts.wantedLockfile,
|
||||
}
|
||||
|
||||
@@ -126,7 +126,6 @@ export interface ResolutionContext {
|
||||
childrenByParentId: ChildrenByParentId,
|
||||
pendingNodes: PendingNode[],
|
||||
wantedLockfile: Lockfile,
|
||||
updateLockfile: boolean,
|
||||
currentLockfile: Lockfile,
|
||||
linkWorkspacePackagesDepth: number,
|
||||
lockfileDir: string,
|
||||
@@ -231,7 +230,6 @@ export default async function resolveDependencies (
|
||||
proceed: options.proceed,
|
||||
registries: ctx.registries,
|
||||
resolvedDependencies: options.resolvedDependencies,
|
||||
updateLockfile: ctx.updateLockfile,
|
||||
})
|
||||
const resolveDepOpts = {
|
||||
alwaysTryWorkspacePackages: options.alwaysTryWorkspacePackages,
|
||||
@@ -366,7 +364,6 @@ function getDepsToResolve (
|
||||
proceed: boolean,
|
||||
registries: Registries,
|
||||
resolvedDependencies?: ResolvedDependencies,
|
||||
updateLockfile: boolean,
|
||||
}
|
||||
) {
|
||||
const resolvedDependencies = options.resolvedDependencies ?? {}
|
||||
@@ -375,7 +372,7 @@ function getDepsToResolve (
|
||||
// The only reason we resolve children in case the package depends on peers
|
||||
// is to get information about the existing dependencies, so that they can
|
||||
// be merged with the resolved peers.
|
||||
const proceedAll = options.proceed || options.parentDependsOnPeers || options.updateLockfile
|
||||
const proceedAll = options.proceed || options.parentDependsOnPeers
|
||||
let allPeers = new Set<string>()
|
||||
for (const wantedDependency of wantedDependencies) {
|
||||
let reference = wantedDependency.alias && resolvedDependencies[wantedDependency.alias]
|
||||
|
||||
@@ -590,24 +590,26 @@ async function installInContext (
|
||||
stage: 'resolution_started',
|
||||
})
|
||||
|
||||
const defaultUpdateDepth = (() => {
|
||||
if (opts.force) return Infinity
|
||||
if (opts.update) {
|
||||
return opts.depth
|
||||
}
|
||||
return -1
|
||||
})()
|
||||
const preferredVersions = opts.preferredVersions ?? (
|
||||
!opts.update &&
|
||||
ctx.wantedLockfile.packages &&
|
||||
!R.isEmpty(ctx.wantedLockfile.packages) &&
|
||||
getPreferredVersionsFromLockfile(ctx.wantedLockfile.packages!) || undefined
|
||||
)
|
||||
const updateLockfile = ctx.wantedLockfile.lockfileVersion !== LOCKFILE_VERSION || !opts.currentLockfileIsUpToDate
|
||||
const defaultUpdateDepth = (() => {
|
||||
if (opts.force || updateLockfile) return Infinity
|
||||
if (opts.update) {
|
||||
return opts.depth
|
||||
}
|
||||
return -1
|
||||
})()
|
||||
const _toResolveImporter = toResolveImporter.bind(null, {
|
||||
defaultUpdateDepth,
|
||||
lockfileOnly: opts.lockfileOnly,
|
||||
preferredVersions,
|
||||
storeDir: ctx.storeDir,
|
||||
updateLockfile,
|
||||
virtualStoreDir: ctx.virtualStoreDir,
|
||||
workspacePackages: opts.workspacePackages,
|
||||
})
|
||||
@@ -634,7 +636,6 @@ async function installInContext (
|
||||
resolutionStrategy: opts.resolutionStrategy,
|
||||
storeController: opts.storeController,
|
||||
tag: opts.tag,
|
||||
updateLockfile: ctx.wantedLockfile.lockfileVersion !== LOCKFILE_VERSION || !opts.currentLockfileIsUpToDate,
|
||||
virtualStoreDir: ctx.virtualStoreDir,
|
||||
wantedLockfile: ctx.wantedLockfile,
|
||||
workspacePackages: opts.workspacePackages,
|
||||
@@ -842,9 +843,10 @@ async function toResolveImporter (
|
||||
opts: {
|
||||
defaultUpdateDepth: number,
|
||||
lockfileOnly: boolean,
|
||||
storeDir: string,
|
||||
virtualStoreDir: string,
|
||||
preferredVersions?: PreferredVersions,
|
||||
storeDir: string,
|
||||
updateLockfile: boolean,
|
||||
virtualStoreDir: string,
|
||||
workspacePackages: WorkspacePackages,
|
||||
},
|
||||
project: ImporterToUpdate
|
||||
@@ -861,7 +863,7 @@ async function toResolveImporter (
|
||||
const existingDeps = nonLinkedDependencies
|
||||
.filter(({ alias }) => !project.wantedDependencies.some((wantedDep) => wantedDep.alias === alias))
|
||||
let wantedDependencies!: Array<WantedDependency & { isNew?: boolean, updateDepth: number }>
|
||||
if (!project.manifest) {
|
||||
if (!project.manifest || opts.updateLockfile) {
|
||||
wantedDependencies = [
|
||||
...project.wantedDependencies,
|
||||
...existingDeps,
|
||||
|
||||
@@ -990,7 +990,7 @@ test('all the subdeps of dependencies are linked when a node_modules is partiall
|
||||
'bar',
|
||||
'foo',
|
||||
'foobarqar',
|
||||
'is-positive',
|
||||
'qar',
|
||||
]
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user