mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-11 01:15:11 -04:00
fix: use correct path fix for integrity.json with git dependency (#3272)
* fix: use correct path fix for integrity.json with git dependency * fix: integrity path Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
5
.changeset/stale-colts-speak.md
Normal file
5
.changeset/stale-colts-speak.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-store": patch
|
||||
---
|
||||
|
||||
fix: use correct path fix for integrity.json with git dependency
|
||||
@@ -1,6 +1,9 @@
|
||||
import { getFilePathInCafs, PackageFilesIndex } from '@pnpm/cafs'
|
||||
import { getContextForSingleImporter } from '@pnpm/get-context'
|
||||
import { nameVerFromPkgSnapshot } from '@pnpm/lockfile-utils'
|
||||
import {
|
||||
nameVerFromPkgSnapshot,
|
||||
packageIdFromSnapshot,
|
||||
} from '@pnpm/lockfile-utils'
|
||||
import { streamParser } from '@pnpm/logger'
|
||||
import * as dp from 'dependency-path'
|
||||
import extendOptions, {
|
||||
@@ -32,20 +35,22 @@ export default async function (maybeOpts: StoreStatusOptions) {
|
||||
const pkgs = Object.keys(wantedLockfile.packages ?? {})
|
||||
.filter((depPath) => !skipped.has(depPath))
|
||||
.map((depPath) => {
|
||||
const pkg = wantedLockfile.packages![depPath]
|
||||
const pkgSnapshot = wantedLockfile.packages![depPath]
|
||||
const id = packageIdFromSnapshot(depPath, pkgSnapshot, registries)
|
||||
return {
|
||||
depPath,
|
||||
integrity: pkg.resolution['integrity'],
|
||||
id,
|
||||
integrity: pkgSnapshot.resolution['integrity'],
|
||||
pkgPath: dp.resolve(registries, depPath),
|
||||
...nameVerFromPkgSnapshot(depPath, pkg),
|
||||
...nameVerFromPkgSnapshot(depPath, pkgSnapshot),
|
||||
}
|
||||
})
|
||||
|
||||
const cafsDir = path.join(storeDir, 'files')
|
||||
const modified = await pFilter(pkgs, async ({ integrity, pkgPath, depPath, name }) => {
|
||||
const modified = await pFilter(pkgs, async ({ id, integrity, depPath, name }) => {
|
||||
const pkgIndexFilePath = integrity
|
||||
? getFilePathInCafs(cafsDir, integrity, 'index')
|
||||
: path.join(storeDir, pkgPath, 'integrity.json')
|
||||
: path.join(storeDir, dp.depPathToFilename(id, opts.dir), 'integrity.json')
|
||||
const { files } = await loadJsonFile<PackageFilesIndex>(pkgIndexFilePath)
|
||||
return (await dint.check(path.join(virtualStoreDir, dp.depPathToFilename(depPath, opts.dir), 'node_modules', name), files)) === false
|
||||
}, { concurrency: 8 })
|
||||
|
||||
@@ -52,6 +52,7 @@ test('CLI does not fail when store status does not find modified packages', asyn
|
||||
'is-positive@3.1.0',
|
||||
'react@15.4.1',
|
||||
'webpack@5.24.2',
|
||||
'koorchik/node-mole-rpc',
|
||||
])
|
||||
// store status does not fail on not installed optional dependencies
|
||||
await execa('node', [pnpmBin, 'add', 'not-compatible-with-any-os', '--save-optional', '--store-dir', storeDir, '--registry', REGISTRY, '--verify-store-integrity'])
|
||||
|
||||
Reference in New Issue
Block a user