fix: installing Git-hosted packages (#3408)

close #3407
This commit is contained in:
Zoltan Kochan
2021-04-28 22:24:34 +03:00
committed by GitHub
parent 66dbd06e6f
commit 3b147ced99
8 changed files with 13 additions and 10 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/git-fetcher": patch
"@pnpm/tarball-fetcher": patch
---
Do not remove the Git temporary directory because it might still be in the process of linking to the CAFS.

View File

@@ -0,0 +1,5 @@
---
"@pnpm/package-store": patch
---
The temporary directory should be removed during prunning the store.

View File

@@ -24,7 +24,6 @@ export default () => {
// removing /.git to make directory integrity calculation faster
await rimraf(path.join(tempLocation, '.git'))
const filesIndex = await cafs.addFilesFromDir(tempLocation, opts.manifest)
await rimraf(tempLocation)
return { filesIndex }
},
}

View File

@@ -53,7 +53,7 @@ export function createCafsStore (
}
) {
const cafsDir = path.join(storeDir, 'files')
const baseTempDir = path.join(storeDir)
const baseTempDir = path.join(storeDir, 'tmp')
const importPackage = createPackageImporter({
packageImportMethod: opts?.packageImportMethod,
cafsDir,

View File

@@ -12,6 +12,7 @@ export default async function prune (storeDir: string) {
const cafsDir = path.join(storeDir, 'files')
await rimraf(path.join(storeDir, 'metadata'))
await rimraf(path.join(storeDir, 'metadata-full'))
await rimraf(path.join(storeDir, 'tmp'))
globalInfo('Removed all cached metadata files')
const pkgIndexFiles = [] as string[]
const removedHashes = new Set<string>()

View File

@@ -39,7 +39,6 @@
"@pnpm/fetching-types": "workspace:2.1.0",
"@pnpm/prepare-package": "workspace:1.0.0",
"@zkochan/retry": "^0.2.0",
"@zkochan/rimraf": "^2.1.1",
"ramda": "^0.27.1",
"ssri": "^8.0.1"
},
@@ -48,7 +47,6 @@
"@pnpm/logger": "^4.0.0",
"@pnpm/package-store": "workspace:12.0.4",
"@types/retry": "^0.12.0",
"@types/rimraf": "^3.0.0",
"@types/ssri": "^7.1.0",
"cp-file": "^9.0.0",
"nock": "12.0.3",

View File

@@ -12,7 +12,6 @@ import {
import { FetchFromRegistry } from '@pnpm/fetching-types'
import preparePackage from '@pnpm/prepare-package'
import * as retry from '@zkochan/retry'
import rimraf from '@zkochan/rimraf'
import R from 'ramda'
import ssri from 'ssri'
import { BadTarballError } from './errorTypes'
@@ -238,7 +237,6 @@ async function prepareGitHostedPkg (filesIndex: FilesIndex, cafs: Cafs) {
})
await preparePackage(tempLocation)
const newFilesIndex = await cafs.addFilesFromDir(tempLocation)
await rimraf(tempLocation)
return newFilesIndex
}

4
pnpm-lock.yaml generated
View File

@@ -3011,10 +3011,8 @@ importers:
'@pnpm/prepare-package': workspace:1.0.0
'@pnpm/tarball-fetcher': 'link:'
'@types/retry': ^0.12.0
'@types/rimraf': ^3.0.0
'@types/ssri': ^7.1.0
'@zkochan/retry': ^0.2.0
'@zkochan/rimraf': ^2.1.1
cp-file: ^9.0.0
nock: 12.0.3
ramda: ^0.27.1
@@ -3027,7 +3025,6 @@ importers:
'@pnpm/fetching-types': link:../fetching-types
'@pnpm/prepare-package': link:../prepare-package
'@zkochan/retry': 0.2.0
'@zkochan/rimraf': 2.1.1
ramda: 0.27.1
ssri: 8.0.1
devDependencies:
@@ -3036,7 +3033,6 @@ importers:
'@pnpm/package-store': link:../package-store
'@pnpm/tarball-fetcher': 'link:'
'@types/retry': 0.12.0
'@types/rimraf': 3.0.0
'@types/ssri': 7.1.0
cp-file: 9.0.0
nock: 12.0.3