mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
fix: don't fail when publishedBy date cannot be calculated
This commit is contained in:
5
.changeset/ten-colts-melt.md
Normal file
5
.changeset/ten-colts-melt.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
---
|
||||
|
||||
Don't fail when publishedBy date cannot be calculated.
|
||||
@@ -42,3 +42,8 @@ test('the lowest version of a direct dependency is installed when resolution mod
|
||||
'@pnpm.e2e/foo': '^100.1.0',
|
||||
})
|
||||
})
|
||||
|
||||
test('time-based resolution mode should not fail when publishedBy date cannot be calculated', async () => {
|
||||
prepareEmpty()
|
||||
await install({}, await testDefaults({ resolutionMode: 'time-based' }))
|
||||
})
|
||||
|
||||
@@ -355,8 +355,10 @@ async function resolveDependenciesOfImporters (
|
||||
let time: Record<string, string> | undefined
|
||||
if (ctx.resolutionMode === 'time-based') {
|
||||
const result = getPublishedByDate(resolveResults.map(({ pkgAddresses }) => pkgAddresses).flat(), ctx.wantedLockfile.time)
|
||||
publishedBy = new Date(result.publishedBy.getTime() + 60 * 60 * 1000) // adding 1 hour delta
|
||||
time = result.newTime
|
||||
if (result.publishedBy) {
|
||||
publishedBy = new Date(result.publishedBy.getTime() + 60 * 60 * 1000) // adding 1 hour delta
|
||||
time = result.newTime
|
||||
}
|
||||
}
|
||||
const pkgAddressesByImportersWithoutPeers = await Promise.all(zipWith(async (importer, { pkgAddresses, postponedResolutionsQueue }) => {
|
||||
const newPreferredVersions = { ...importer.preferredVersions }
|
||||
|
||||
Reference in New Issue
Block a user