mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: rebuild should not fail if an index file is not found in the store (#9788)
This commit is contained in:
5
.changeset/modern-windows-smoke.md
Normal file
5
.changeset/modern-windows-smoke.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-rebuild": patch
|
||||
---
|
||||
|
||||
Rebuild should not fail if it cannot find an index file in the store for the built package.
|
||||
@@ -345,13 +345,18 @@ async function _rebuild (
|
||||
const pkgId = `${pkgInfo.name}@${pkgInfo.version}`
|
||||
if (opts.skipIfHasSideEffectsCache && resolution.integrity) {
|
||||
const filesIndexFile = getIndexFilePathInCafs(opts.storeDir, resolution.integrity!.toString(), pkgId)
|
||||
const pkgFilesIndex = await loadJsonFile<PackageFilesIndex>(filesIndexFile)
|
||||
sideEffectsCacheKey = calcDepState(depGraph, depsStateCache, depPath, {
|
||||
includeDepGraphHash: true,
|
||||
})
|
||||
if (pkgFilesIndex.sideEffects?.[sideEffectsCacheKey]) {
|
||||
pkgsThatWereRebuilt.add(depPath)
|
||||
return
|
||||
let pkgFilesIndex: PackageFilesIndex | undefined
|
||||
try {
|
||||
pkgFilesIndex = await loadJsonFile<PackageFilesIndex>(filesIndexFile)
|
||||
} catch {}
|
||||
if (pkgFilesIndex) {
|
||||
sideEffectsCacheKey = calcDepState(depGraph, depsStateCache, depPath, {
|
||||
includeDepGraphHash: true,
|
||||
})
|
||||
if (pkgFilesIndex.sideEffects?.[sideEffectsCacheKey]) {
|
||||
pkgsThatWereRebuilt.add(depPath)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
let requiresBuild = true
|
||||
|
||||
Reference in New Issue
Block a user