mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-29 04:21:39 -04:00
9
.changeset/blue-crabs-sparkle.md
Normal file
9
.changeset/blue-crabs-sparkle.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
"@pnpm/git-fetcher": patch
|
||||
"@pnpm/tarball-fetcher": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fixes a regression introduced in pnpm v6.23.3 via [#4044](https://github.com/pnpm/pnpm/pull/4044).
|
||||
|
||||
The temporary directory to which the Git-hosted package is downloaded should not be removed prematurely [#4064](https://github.com/pnpm/pnpm/issues/4064).
|
||||
@@ -24,7 +24,9 @@ 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)
|
||||
// Important! We cannot remove the temp location at this stage.
|
||||
// Even though we have the index of the package,
|
||||
// the linking of files to the store is in progress.
|
||||
return { filesIndex }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,4 +63,18 @@ test('fetch a package without a package.json', async () => {
|
||||
}
|
||||
)
|
||||
expect(filesIndex['denolib.json']).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
// Covers the regression reported in https://github.com/pnpm/pnpm/issues/4064
|
||||
test('fetch a big repository', async () => {
|
||||
const cafsDir = tempy.directory()
|
||||
const fetch = createFetcher().git
|
||||
const manifest = pDefer<DependencyManifest>()
|
||||
const { filesIndex } = await fetch(createCafsStore(cafsDir),
|
||||
{
|
||||
commit: 'a65fbf5a90f53c9d72fed4daaca59da50f074355',
|
||||
repo: 'https://github.com/sveltejs/action-deploy-docs.git',
|
||||
type: 'git',
|
||||
}, { manifest })
|
||||
await Promise.all(Object.values(filesIndex).map(({ writeResult }) => writeResult))
|
||||
})
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
"@pnpm/graceful-fs": "workspace:1.0.0",
|
||||
"@pnpm/prepare-package": "workspace:1.0.7",
|
||||
"@zkochan/retry": "^0.2.0",
|
||||
"@zkochan/rimraf": "^2.1.1",
|
||||
"ramda": "^0.27.1",
|
||||
"ssri": "^8.0.1"
|
||||
},
|
||||
|
||||
@@ -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 fromPairs from 'ramda/src/fromPairs'
|
||||
import omit from 'ramda/src/omit'
|
||||
import ssri from 'ssri'
|
||||
@@ -248,7 +247,9 @@ async function prepareGitHostedPkg (filesIndex: FilesIndex, cafs: Cafs) {
|
||||
})
|
||||
await preparePackage(tempLocation)
|
||||
const newFilesIndex = await cafs.addFilesFromDir(tempLocation)
|
||||
await rimraf(tempLocation)
|
||||
// Important! We cannot remove the temp location at this stage.
|
||||
// Even though we have the index of the package,
|
||||
// the linking of files to the store is in progress.
|
||||
return newFilesIndex
|
||||
}
|
||||
|
||||
|
||||
@@ -353,3 +353,16 @@ test('accessing private packages', async () => {
|
||||
async function getFileIntegrity (filename: string) {
|
||||
return (await ssri.fromStream(fs.createReadStream(filename))).toString()
|
||||
}
|
||||
|
||||
// Covers the regression reported in https://github.com/pnpm/pnpm/issues/4064
|
||||
test('fetch a big repository', async () => {
|
||||
process.chdir(tempy.directory())
|
||||
|
||||
const resolution = { tarball: 'https://codeload.github.com/sveltejs/action-deploy-docs/tar.gz/a65fbf5a90f53c9d72fed4daaca59da50f074355' }
|
||||
|
||||
const result = await fetch.tarball(cafs, resolution, {
|
||||
lockfileDir: process.cwd(),
|
||||
})
|
||||
|
||||
expect(result.filesIndex).toBeTruthy()
|
||||
})
|
||||
|
||||
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@@ -3253,7 +3253,6 @@ importers:
|
||||
'@types/retry': ^0.12.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
|
||||
@@ -3267,7 +3266,6 @@ importers:
|
||||
'@pnpm/graceful-fs': link:../graceful-fs
|
||||
'@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:
|
||||
|
||||
Reference in New Issue
Block a user