mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-25 16:18:06 -05:00
7
.changeset/hungry-days-kiss.md
Normal file
7
.changeset/hungry-days-kiss.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
"@pnpm/lockfile-utils": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fix a bug where `--fix-lockfile` crashes on tarballs [#7368](https://github.com/pnpm/pnpm/issues/7368).
|
||||
@@ -212,6 +212,7 @@
|
||||
"sels",
|
||||
"semistrict",
|
||||
"serverjs",
|
||||
"sheetjs",
|
||||
"sindresorhus",
|
||||
"sirv",
|
||||
"soporan",
|
||||
|
||||
@@ -20,7 +20,15 @@ export function pkgSnapshotToResolution (
|
||||
return pkgSnapshot.resolution as Resolution
|
||||
}
|
||||
const { name } = nameVerFromPkgSnapshot(depPath, pkgSnapshot)
|
||||
const registry: string = (name[0] === '@' && registries[name.split('/')[0]]) || registries.default
|
||||
let registry: string = ''
|
||||
if (name != null) {
|
||||
if (name.startsWith('@')) {
|
||||
registry = registries[name.split('/')[0]]
|
||||
}
|
||||
}
|
||||
if (!registry) {
|
||||
registry = registries.default
|
||||
}
|
||||
let tarball!: string
|
||||
if (!(pkgSnapshot.resolution as TarballResolution).tarball) {
|
||||
tarball = getTarball(registry)
|
||||
|
||||
@@ -29,4 +29,12 @@ test('pkgSnapshotToResolution()', () => {
|
||||
integrity: 'AAAA',
|
||||
tarball: 'https://mycompany.jfrog.io/mycompany/api/npm/npm-local/@mycompany/mypackage/-/@mycompany/mypackage-2.0.0.tgz',
|
||||
})
|
||||
|
||||
expect(pkgSnapshotToResolution('@cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz', {
|
||||
resolution: {
|
||||
tarball: 'https://cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz',
|
||||
},
|
||||
}, { default: 'https://registry.npmjs.org/' })).toEqual({
|
||||
tarball: 'https://cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1039,12 +1039,13 @@ async function resolveDependency (
|
||||
currentLockfileContainsTheDep &&
|
||||
currentPkg.depPath &&
|
||||
currentPkg.dependencyLockfile &&
|
||||
currentPkg.name &&
|
||||
await exists(
|
||||
path.join(
|
||||
ctx.virtualStoreDir,
|
||||
dp.depPathToFilename(currentPkg.depPath),
|
||||
'node_modules',
|
||||
currentPkg.name!,
|
||||
currentPkg.name,
|
||||
'package.json'
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user